spring-security
tags question: http://stackoverflow.com/q/23810846
tags question: http://stackoverflow.com/q/23931625
tags question: http://stackoverflow.com/q/23783393
tags question: http://stackoverflow.com/q/23807375
tags question: http://stackoverflow.com/q/23890980
tags question: http://stackoverflow.com/q/23922025
tags question: http://stackoverflow.com/q/23914783
tags question: http://stackoverflow.com/q/23917844
type: Tag
tags question: http://stackoverflow.com/q/23919578
tags question: http://stackoverflow.com/q/23778451
tags question: http://stackoverflow.com/q/23889014
tags question: http://stackoverflow.com/q/23828229
tags question: http://stackoverflow.com/q/23809650
tags question: http://stackoverflow.com/q/23923316
tags question: http://stackoverflow.com/q/23831870
tags question: http://stackoverflow.com/q/23798324
tags question: http://stackoverflow.com/q/23896912
tags question: http://stackoverflow.com/q/23783404
tags question: http://stackoverflow.com/q/23818909
tag name: spring-security
tags question: http://stackoverflow.com/q/23817524
tags question: http://stackoverflow.com/q/23851936

http://stackoverflow.com/a/23789569
upvote count: 1
has body: while(rs.next()) { name = records.getString("name"); surname = records.getString("surname"); People peo= new People(name,surname); peoList.add(peo); } Where did records come from? This is not the variable name for your ResultSet, instead you named it rs. I think you mean to do: while(rs.next()) { name = rs.getString("name"); surname = rs.getString("surname"); People peo= new People(name,surname); peoList.add(peo); } The exception is being thrown in your original code because name and surname are both null, as is records because it does not exist. UPDATE: As a comment mentioned, you appear to also not have initialized peoList. You're code is a little difficult on the eyes, due to mixed style, etc. I re-wrote some of it, but here's the gist (including a properly initialized peoList: final static Logger LOG = Logger.getLogger(myClass.class.getName()); ResultSet rs = null; try { rs = stat.executeQuery("SELECT * from people WHERE surname='"+surname+"'"); } catch (SQLException ex) { LOG.severe("", ex); } String name, surname; List&lt;People&gt; peoList = new ArrayList&lt;People&gt;(); try { while(rs.next()) { name = rs.getString("name"); surname = rs.getString("surname"); People peo= new People(name,surname); peoList.add(peo); } } catch (SQLException ex) { LOG.severe("", ex); } return peoList;
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36588516
has comment: http://stackoverflow.com/comment/36588603
accepted answer of: http://stackoverflow.com/q/23789515
type: Answer
answers question: http://stackoverflow.com/q/23789515
has comment: http://stackoverflow.com/comment/36588935

http://stackoverflow.com/q/23802312
score: 1
tagged with: mdi
tagged with: java
linked to: http://stackoverflow.com/q/9414728
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36616494
has comment: http://stackoverflow.com/comment/36616022
accepted answer: http://stackoverflow.com/a/23805686
downvote count: 0
linked to: http://stackoverflow.com/q/2741036
has body: I am making a vehicle_management system in java swings. I have a MDI(muti-document interface) Window in which there are more then one panels can be open.But when one panel is open after another the previous one is hides under new one, so all the JPanel are stacks. what i want is that if a panel is open and user trying to open another panel the previous opened panel get closed.how to do that.
has comment: http://stackoverflow.com/comment/36616991
has comment: http://stackoverflow.com/comment/36616620
has comment: http://stackoverflow.com/comment/36612840
favorite count: 0
has comment: http://stackoverflow.com/comment/36616883
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/23805686
has title: How to prevent from user to open more than one JPanel in MDI Window?
possible better answer: http://stackoverflow.com/a/23808315
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23808315
has comment: http://stackoverflow.com/comment/36612472

http://stackoverflow.com/comment/36833585
type: QuestionComment
has text: Is this TCP, or is it UDP? Any chance you might post some of the code?
score: 0
comment on: http://stackoverflow.com/q/23918067
type: Comment

properties
tags question: http://stackoverflow.com/q/23908606
type: Tag
tags question: http://stackoverflow.com/q/23886148
tags question: http://stackoverflow.com/q/23823347
tag name: properties
tags question: http://stackoverflow.com/q/23891067
tags question: http://stackoverflow.com/q/23916772
tags question: http://stackoverflow.com/q/23928966
tags question: http://stackoverflow.com/q/23835508
tags question: http://stackoverflow.com/q/23871694
tags question: http://stackoverflow.com/q/23790589
tags question: http://stackoverflow.com/q/23916053
tags question: http://stackoverflow.com/q/23785816
tags question: http://stackoverflow.com/q/23791242
tags question: http://stackoverflow.com/q/23802951

http://stackoverflow.com/a/23874349
has comment: http://stackoverflow.com/comment/50562960
score: 0
type: Answer
has body: There are very big possibility that this is memory leak. Basically some objects which should removed by GC are still have links on them. You should use visualvm java tool to investigate this. http://rejeev.blogspot.com/2009/04/analyzing-memory-leak-in-java.html
answers question: http://stackoverflow.com/q/23874274

http://stackoverflow.com/q/23826203
has title: Cannot reach the web service from an other pc
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: endpoint
type: Question
has answer: http://stackoverflow.com/a/23826305
upvote count: 0
has body: I simply publish a web service with the following code in Java: String dbAccessAddress = "http://127.0.0.1:8024/SmartService"; try { if (ep != null &amp;&amp; ep.isPublished() == false) { ep = Endpoint.publish(dbAccessAddress, new DbAccess()); logger.info("DbAccess started: " + dbAccessAddress); } } catch (Exception ex) { logger.error("DbAccess failed(" + dbAccessAddress + ")", ex, false); } This service works perfectly on localhost but when I try to reach the service from an other computer within the local network, i can not connect to it. Timeout occurs. I also tried with the browser by writing the service wsdl URL but it can not reach the service. Only works locally. What is the problem?
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36657904
accepted answer: http://stackoverflow.com/a/23826305
tagged with: web-services
downvote count: 1

http://stackoverflow.com/a/23872355
answers question: http://stackoverflow.com/q/23871707
score: 0
has body: You can use action context when an action was initiated by the struts2 filter. The method onAuthenticationSuccess has nothing with struts2 and action context. Use servlet request object to get session. HttpSession session = request.getSession(false);
type: Answer

http://stackoverflow.com/comment/36745212
score: 0
comment on: http://stackoverflow.com/q/23871889
type: Comment
type: QuestionComment
has text: @SJuan76, that've worked! would you make an answer ?

spring-mvc
tags question: http://stackoverflow.com/q/23826192
tags question: http://stackoverflow.com/q/23782574
tags question: http://stackoverflow.com/q/23809650
tags question: http://stackoverflow.com/q/23920284
tags question: http://stackoverflow.com/q/23791195
tags question: http://stackoverflow.com/q/23894640
tags question: http://stackoverflow.com/q/23829716
tags question: http://stackoverflow.com/q/23791078
tags question: http://stackoverflow.com/q/23810352
tags question: http://stackoverflow.com/q/23801992
tags question: http://stackoverflow.com/q/23910489
tags question: http://stackoverflow.com/q/23819180
tags question: http://stackoverflow.com/q/23839223
tags question: http://stackoverflow.com/q/23917192
tags question: http://stackoverflow.com/q/23935534
tags question: http://stackoverflow.com/q/23896348
tags question: http://stackoverflow.com/q/23843437
tags question: http://stackoverflow.com/q/23904705
tags question: http://stackoverflow.com/q/23934543
tags question: http://stackoverflow.com/q/23839226
tags question: http://stackoverflow.com/q/23934110
tags question: http://stackoverflow.com/q/23804229
tags question: http://stackoverflow.com/q/23924649
tags question: http://stackoverflow.com/q/23877884
tags question: http://stackoverflow.com/q/23916843
tags question: http://stackoverflow.com/q/23917048
tags question: http://stackoverflow.com/q/23828640
tags question: http://stackoverflow.com/q/23917676
tags question: http://stackoverflow.com/q/23789444
tags question: http://stackoverflow.com/q/23788715
tags question: http://stackoverflow.com/q/23818328
tag name: spring-mvc
tags question: http://stackoverflow.com/q/23827773
tags question: http://stackoverflow.com/q/23868547
tags question: http://stackoverflow.com/q/23855362
tags question: http://stackoverflow.com/q/23835594
tags question: http://stackoverflow.com/q/23897984
tags question: http://stackoverflow.com/q/23881592
tags question: http://stackoverflow.com/q/23783204
type: Tag
tags question: http://stackoverflow.com/q/23851936
tags question: http://stackoverflow.com/q/23817358
tags question: http://stackoverflow.com/q/23928210
tags question: http://stackoverflow.com/q/23791815
tags question: http://stackoverflow.com/q/23843216
tags question: http://stackoverflow.com/q/23897798
tags question: http://stackoverflow.com/q/23931625
tags question: http://stackoverflow.com/q/23843262
tags question: http://stackoverflow.com/q/23786277
tags question: http://stackoverflow.com/q/23798879
tags question: http://stackoverflow.com/q/23782406
tags question: http://stackoverflow.com/q/23916926
tags question: http://stackoverflow.com/q/23810198
tags question: http://stackoverflow.com/q/23783393
tags question: http://stackoverflow.com/q/23890136
tags question: http://stackoverflow.com/q/23849666
tags question: http://stackoverflow.com/q/23842180
tags question: http://stackoverflow.com/q/23918918
tags question: http://stackoverflow.com/q/23788311
tags question: http://stackoverflow.com/q/23890861
tags question: http://stackoverflow.com/q/23797026
tags question: http://stackoverflow.com/q/23922025
tags question: http://stackoverflow.com/q/23793610
tags question: http://stackoverflow.com/q/23871498
tags question: http://stackoverflow.com/q/23802268
tags question: http://stackoverflow.com/q/23930848
tags question: http://stackoverflow.com/q/23895715
tags question: http://stackoverflow.com/q/23919578
tags question: http://stackoverflow.com/q/23868344
tags question: http://stackoverflow.com/q/23783712
tags question: http://stackoverflow.com/q/23788987
tags question: http://stackoverflow.com/q/23853729
tags question: http://stackoverflow.com/q/23799450
tags question: http://stackoverflow.com/q/23794936
tags question: http://stackoverflow.com/q/23892179
tags question: http://stackoverflow.com/q/23918073
tags question: http://stackoverflow.com/q/23835626
tags question: http://stackoverflow.com/q/23910086
tags question: http://stackoverflow.com/q/23806727
tags question: http://stackoverflow.com/q/23782996

http://stackoverflow.com/comment/36860576
has text: Why is there a restriction to create a Comparator<Station> (not making Station implements Comparable, but definining a Comparator to provide a criteria for sorting two Stations)?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23932811

http://stackoverflow.com/comment/36623880
comment on: http://stackoverflow.com/a/23808499
type: Comment
score: 6
type: AnswerComment
has text: Is any of ways above better than the other? Or does both work as good?

http://stackoverflow.com/q/23898030
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23898069
score: 3
has answer: http://stackoverflow.com/a/23898233
linked to: http://stackoverflow.com/q/10705848
tagged with: java
type: Question
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/23898069
linked to: http://stackoverflow.com/q/215497
answer count: 3
downvote count: 1
upvote count: 4
duplicate of: http://stackoverflow.com/q/10705848
has answer: http://stackoverflow.com/a/23898045
favorite count: 0
accepted answer: http://stackoverflow.com/a/23898045
has comment: http://stackoverflow.com/comment/36795705
has title: Define the main method as: public static void main(String[] args)
has body: Can someone please help me with the code below it builds without any error but when i Run it i get "Error: Main method not found in class Program, please define the main method as: public static void main(String[] args)"... any ideas why ? import java.util.*; public class Program { // Create an array/database for 100 prizes We can increase this number private Prize[] prizeDatabase = new Prize[100]; // variable to store the next available position in the database private int currentArrayPosition = 0; /** This method displays the menu to the user */ private void DisplayMenu() { System.out.println("Please select an option from the following:"); System.out.println("1. Enter details of a prize"); System.out.println("2. Print the details stored for all prizes"); System.out.println("3. Search for a prize by description or value"); System.out.println("4. Quit"); // Get the users selection String selection = new Scanner(System.in).nextLine(); if (selection.equals("1")) { EnterPrizeDetails(); } else if (selection.equals("2")) { PrintPrizes(); } else if (selection.equals("3")) { SearchPrize(); } else if (selection.equals("4")) { // do nothing, console will exit automatically } } /** Search a prize */ private void SearchPrize() { System.out.println("Please enter search term and press enter: "); // get the users search term from the console String searchTerm = new Scanner(System.in).nextLine(); System.out.println("Your following matches are: "); // Loop round all the prizes for (Prize prize : prizeDatabase) { if ((prize != null)) { // if the prize matches the users search criters then print the prize if (prize.MatchPrize(searchTerm)) { prize.PrintPrize(); } } } System.out.println(); DisplayMenu(); } /** Print all prizes in the database */ private void PrintPrizes() { System.out.println("The following prizes are in the database: "); for (Prize prize : prizeDatabase) { if (prize != null) { prize.PrintPrize(); } } System.out.println(); DisplayMenu(); } /** Enter a prize and store i…

http://stackoverflow.com/a/23907143
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23900882
score: 2
downvote count: 0
has body: Try java.util.Timer scheduleAtFixedRate(TimerTask task, long delay, long period)

http://stackoverflow.com/q/23852151
has answer: http://stackoverflow.com/a/23852470
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/38699236
answer count: 4
type: AnsweredQuestion
upvote count: 0
has title: why cannot i see a textView above another view in relative layout?
accepted answer: http://stackoverflow.com/a/23852194
has answer: http://stackoverflow.com/a/23852485
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/23852194
tagged with: java
score: -1
tagged with: layout
has body: I have this xml: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/errorMsg" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/pointsText" android:visibility="gone"/> <TextView android:id="@+id/pointsText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/offers_list" android:text="you have 100 points" android:visibility="visible"/> <ListView android:id="@+id/offers_list" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="false" android:dividerHeight="0dp" android:divider="#00000000"/> Yet I cannot see pointsText in my eclipse graphical previewer. What am I missing?
downvote count: 1
possible better answer: http://stackoverflow.com/a/23852470

http://stackoverflow.com/q/23785861
downvote count: 0
has comment: http://stackoverflow.com/comment/36581608
has title: Is there a way to get the deploy destination in Maven
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36583377
tagged with: maven
has comment: http://stackoverflow.com/comment/36670270
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/36582365
tagged with: java
type: Question
has body: I am trying to configure a Maven plugin in a parent POM file. I need to configure this plugin so that it runs outside of the standard Maven lifecycle through a plugin invocation. mvn some-plugin:plugin-goal The configuration item I'm seeking is the deploy destination for the Maven artifact. In other words, the path to the artifact in a Maven repository. I would like to add a configuration to my parent POM like the one below. com.something.plugins some-plugin com/my/groupId/${project.artifactId}/${project.version}/${project.build.finalName}.${project.packaging} This string (shown below in isolation) will give me the deploy destination for the target. However, it is not dynamic and can't be used in a parent POM because the groupId path (com/my/groupId) is hard-coded. My parent POM does not know the groupId of its children. com/my/groupId/${project.artifactId}/${project.version}/${project.build.finalName}.${project.packaging} Is there a property in Maven to get the deploy destination within a Maven repository? Or alternatively a property to retrieve the groupId as a path? Also, I understand that I get create this string with a Groovy script. However, I'm not running the plugin during the standard Maven lifecycle, but instead run it as part of a plugin execution. So the Groovy script would not run.
has comment: http://stackoverflow.com/comment/36582747
has comment: http://stackoverflow.com/comment/36582530
has comment: http://stackoverflow.com/comment/36581406

http://stackoverflow.com/q/23890002
has comment: http://stackoverflow.com/comment/36801381
favorite count: 0
has body: I don't know much about java and I have spend many days trying to find out what I am doing wrong. I have a JFrame form named FileManagerFrame and a Bean Form with a JTree inside. In JTree I have this code: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package FileManager; import java.io.File; import java.util.Collections; import java.util.Vector; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; /** * * */ public class FilesTree extends JTree { private File dir; /** * Creates new form FilesTree */ public FilesTree() { initComponents(); //FilesTree tree = new FilesTree(); File fList[] = File.listRoots(); for(int i = 0; i &lt; fList.length; i++) { dir = fList[i]; addNodes(null, dir); } // Add a listener addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node =(DefaultMutableTreeNode)e.getPath().getLastPathComponent(); System.out.println("You selected " + node); } }); } /** Add nodes from under "dir" into curTop. Highly recursive. */ DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { // String curPath = dir.getPath(); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(dir); if (curTop != null) { // should only be null at root curTop.add(curDir); } Vector ol = new Vector(); String[] tmp = dir.list(); for (int i = 0; i &lt; tmp.length; i++) { ol.addElement(tmp[i]); } Collections.sort(ol, String.CASE_INSENSITIVE_ORDER); File f; Vector files = new Vector(); // Make two passes, one for Dirs and one for Files. This is #1. for (int i = 0; i &lt; ol.size(); i++) { String thisObject = (String) ol.elementAt(i); String newPath; if (".".equals(dir.getName())) { newPath = thisObject; } else { newPath = dir + File.separator + thi…
has comment: http://stackoverflow.com/comment/36779756
has comment: http://stackoverflow.com/comment/36779952
has answer: http://stackoverflow.com/a/23890888
type: UnansweredQuestion
tagged with: java
downvote count: 2
tagged with: swing
type: Question
has title: JTree code doesn't work
tagged with: jtree
score: -2
has comment: http://stackoverflow.com/comment/36787864
has comment: http://stackoverflow.com/comment/36801406
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/36669764
type: Comment
type: QuestionComment
has text: Yes that's what I meant.
comment on: http://stackoverflow.com/q/23828703
score: 0

http://stackoverflow.com/comment/139485847
type: AnswerComment
has text: Does this approach faster than Integer.parseInt() ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23803972

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23930019
tags question: http://stackoverflow.com/q/23930650
tags question: http://stackoverflow.com/q/23905903
tags question: http://stackoverflow.com/q/23790830
tags question: http://stackoverflow.com/q/23859640
tags question: http://stackoverflow.com/q/23819553
tag name: jfreechart

http://stackoverflow.com/comment/48631523
has text: We're on Spring 3.1.3.RELEASE and I was dabbling with JDK8.45 and this didn't fix it. (I bumped aspectjrt to 1.8.5.) FYI.
comment on: http://stackoverflow.com/a/23802247
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23831254
answers question: http://stackoverflow.com/q/23830972
score: 0
type: Answer
has body: At a quick glance, the following should work: (0[1-9]|[1-2][0-9]|3[01])\-(0[1-9]|1[0-2])\-(\d{4}) At a second glance however you will find that this doesn't stop things like trying to match 31-02-2008, i.e.: that is the 31st of February, which is an invalid date. As others suggested it is preferable to use something like SimpleDateFormat.parse() if possible, as it will cover the day/month variations, and is more likely to cover things like leap years and such.

http://stackoverflow.com/a/53535071
type: Answer
upvote count: 27
answers question: http://stackoverflow.com/q/23866709
downvote count: 0
has comment: http://stackoverflow.com/comment/137498669
has body: I don't think other answers explained the key part: Why COUNT(*) returns more than one result? I just encountered the same issue today, and what I found out is that if you have another class extending the target mapped class (here CustomerData), Hibernate will do this magic. It will throw org.hibernate.NonUniqueResultException: query did not return a unique result:. Hope this will save some time for other unfortunate guys.
score: 27
has comment: http://stackoverflow.com/comment/121307517
has comment: http://stackoverflow.com/comment/133961244

http://stackoverflow.com/comment/36630505
comment on: http://stackoverflow.com/q/23811802
score: 1
has text: Does Skyrim render the entire world every time it draws a new frame? No, it employs a practice called [clipping](http://en.wikipedia.org/wiki/Clipping_%28computer_graphics%29#Importance_of_clipping_in_video_games). Don't waste precious processing time on drawing rectangles that you know won't even be visible to the player. That's a start.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36571166
comment on: http://stackoverflow.com/q/23779064
type: Comment
type: QuestionComment
has text: @RichardTingle From what I know, JUnit doesn't do warmups. I'd imagine this is because the user would be more interested in getting the tests done fast rather than relying on them for timing... If memory serves there are some plugins that add benchmarking-related things like warmups to JUnit tests though.
score: 0

http://stackoverflow.com/comment/36727529
has text: Thank you for remind and I will do some research on ImageObserver which I don't really understand.
comment on: http://stackoverflow.com/a/23862135
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36861077
comment on: http://stackoverflow.com/a/23932791
has text: Private variables **are** class members.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23817014
has comment: http://stackoverflow.com/comment/36675488
has comment: http://stackoverflow.com/comment/36675049
has comment: http://stackoverflow.com/comment/36664636
has comment: http://stackoverflow.com/comment/36670662
has comment: http://stackoverflow.com/comment/36651728
type: Answer
has comment: http://stackoverflow.com/comment/36719705
accepted answer of: http://stackoverflow.com/q/23816793
has comment: http://stackoverflow.com/comment/36667417
has comment: http://stackoverflow.com/comment/36651944
has comment: http://stackoverflow.com/comment/36669184
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36670908
has comment: http://stackoverflow.com/comment/36659231
has body: I would say that for a 401 at that point in the code, probably the key and/or secret are incorrect when you do createLinkedInOAuthService(linkedinKey, linkedinSecret) Please verify that you have the correct values in your code.
has comment: http://stackoverflow.com/comment/36668036
answers question: http://stackoverflow.com/q/23816793
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36666900

http://stackoverflow.com/a/23812430
has body: If the method in question is part of the Frame class, you need to invoke it on an instance of Frame. A quick look at the JavaDoc tells you the first argument should be the instance on which the method will be invoked. Try this: method.invoke(frame, sender, event);
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36631785
has comment: http://stackoverflow.com/comment/36631724
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23812356
type: Answer
answers question: http://stackoverflow.com/q/23812356

http://stackoverflow.com/q/23859876
favorite count: 0
has answer: http://stackoverflow.com/a/23859921
has answer: http://stackoverflow.com/a/23859907
accepted answer: http://stackoverflow.com/a/23859907
has comment: http://stackoverflow.com/comment/36723307
type: AnsweredQuestion
tagged with: java
downvote count: 3
upvote count: 1
has body: I want to copy files from directory to another, so I searched and I got this post: Copying files from one directory to another in Java I follow the first answer, but I couldn't find the jar of FileUtils and the URL in the comments is broken. Could you please help me to find the target jar? Thank you in advance.
has comment: http://stackoverflow.com/comment/36723023
tagged with: fileutils
has comment: http://stackoverflow.com/comment/36736866
has comment: http://stackoverflow.com/comment/36723021
type: Question
linked to: http://stackoverflow.com/q/1146153
score: -2
has title: Copying files from directory to other using FileUtils jar
answer count: 2
has comment: http://stackoverflow.com/comment/36722984
has comment: http://stackoverflow.com/comment/36722975
possible better answer: http://stackoverflow.com/a/23859921

http://stackoverflow.com/comment/36633177
comment on: http://stackoverflow.com/q/23812601
has text: Its not working.. Do I have to create the same filechooser in both classes? I mean, on the class that reads the file and the class that opens the file?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36834072
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23917759
has text: @user3580294 Rest assured, your assumption the cast being not necessary is spot on. Using a long literal (0x0...FL) for the masking value already turns the expressions type to long.
score: 1

http://stackoverflow.com/q/23781513
has comment: http://stackoverflow.com/comment/36574127
has comment: http://stackoverflow.com/comment/36573872
has body: For example,say I have a table A which has a primary_key a1 and corresponding version is 1.There is a history table corresponding to A say,A_History.This contains a record with same primary_key a1, but a different version,say 2. I will be given as input,the primary_key(a1) and two version numbers(1 and 2).I have to compare (using JAVA) the values of all attributes of the table for both the versions and display the non-matching records on a UI.
answer count: 0
has comment: http://stackoverflow.com/comment/36574439
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36574542
tagged with: java
has comment: http://stackoverflow.com/comment/36574289
has comment: http://stackoverflow.com/comment/36573779
type: Question
has comment: http://stackoverflow.com/comment/36574298
has comment: http://stackoverflow.com/comment/36573400
has title: I want to compare two versions of data from a table using JAVA and display the differences on a UI.What can be the best way to approach this?
score: 0
tagged with: sql

http://stackoverflow.com/comment/36842298
comment on: http://stackoverflow.com/q/23906737
has text: @Lodewijck try 'java -cp ./client-5.0.jar nl.tudelft.blabla.MainPane'
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36861514
comment on: http://stackoverflow.com/q/23933265
score: 0
type: Comment
type: QuestionComment
has text: Have you tried casting it to int? I mean Convert.ToInt32((int)thisElement)

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

http://stackoverflow.com/comment/36687266
has text: Side note: "controller" have many special meanings in different framework/languages... You may want to clarify what you mean by it in you particular case... Like "controller as it used in classic MVC design pattern" or "controller as in ASP.Net MVC"...
comment on: http://stackoverflow.com/q/23841313
score: 0
type: Comment
type: QuestionComment

optimization
tags question: http://stackoverflow.com/q/23866315
tags question: http://stackoverflow.com/q/23828068
tags question: http://stackoverflow.com/q/23875400
tag name: optimization
tags question: http://stackoverflow.com/q/23819301
tags question: http://stackoverflow.com/q/23938425
type: Tag

http://stackoverflow.com/q/23848613
linked to: http://stackoverflow.com/q/2231369
score: 0
answer count: 3
has body: I have a set of data that look like this. 1:2:3:4:5 6:7:8:9:10 I have manage to use array list to store the information using a delimiter of ":". However i would like to store the information of their line numbers together in the array list. class test { String items; String linenumber; } Example: test(1,1) test(2,1) test(6,2) test(7,2) Here is my current code. Scanner fileScanner = new Scanner(new File(fname)); fileScanner.useDelimiter("\n"); int counter = 0; String scounter; String test; String events; while(fileScanner.hasNext()) { events = fileScanner.next(); scounter = Integer.toString(counter); Base obj = new Base(scounter, events); baseArrayList.add(obj); } fileScanner.close(); I have try using delimiter "\n" and then trying to split out the string and it is not very successful. Any advice would be appreciated. public void Base_Seperator() { String temp, temp2; String[] split; String days, events; for(int i = 0; i &lt; baseArrayList.size(); i++) { temp = baseArrayList.get(i).events; temp2 = baseArrayList.get(i).days; split = temp.split(":"); } }
has title: Java storing both line number and value from a file
has comment: http://stackoverflow.com/comment/36701412
has answer: http://stackoverflow.com/a/23848902
linked to: http://stackoverflow.com/q/2770321
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36701309
tagged with: java
accepted answer: http://stackoverflow.com/a/23848837
linked to: http://stackoverflow.com/q/383947
has comment: http://stackoverflow.com/comment/36701266
type: Question
has answer: http://stackoverflow.com/a/23849050
possible better answer: http://stackoverflow.com/a/23848902
has answer: http://stackoverflow.com/a/23848837
has comment: http://stackoverflow.com/comment/36701471

http://stackoverflow.com/a/23995535
has comment: http://stackoverflow.com/comment/38117711
has comment: http://stackoverflow.com/comment/38117679
has comment: http://stackoverflow.com/comment/38117705
has body: If two classes loaded by different ClassLoaders without parent-child relationship have to share data, the normal Java language constructs do not work. If you can get hands on a Class object or an instance, you have to access them via Reflection, even if it is the same class just loaded by different loaders. Further, passing the data via heap variables won’t work as both ClassLoaders establish their own “namespace” hence a class loaded by two different loader creating two distinct Class objects will have their distinct copies of static variables as well. You need a storage which is independent from your own classes. Thankfully, that storage exists in the context of Taglets. The register method receives a Map containing all previously registered Taglets. But besides the fact that you have to use Reflection rather than instanceof or Class comparison to find your “friend” Taglets, there is another obstacle: the JavaDoc implementation will wrap your Taglets within another object. Putting it all together, you could implement the find-and-share logic into a base class of your Taglets and let the register method of the Taglets call it: import java.io.IOException; import java.lang.reflect.Field; import java.util.Map; import java.util.Properties; public abstract class Base { static Properties CONFIG=new Properties(); static void initProperties(Map&lt;?, ?&gt; fromTagManager) { String className=Base.class.getName(); for(Object o: fromTagManager.values()) { o=extractTagLet(o); if(o==null) continue; for(Class&lt;?&gt; cl=o.getClass(); cl!=null; cl=cl.getSuperclass()) if(cl.getName().equals(className) &amp;&amp; initFromPrevious(cl)) return; } // not found, first initialization try { CONFIG.load(Base.class.getResourceAsStream("config.properties")); } catch(IOException ex) { throw new ExceptionInInitializerError(ex); } } private static Object extractTagLet(Object o) { if(!o.getClass().getSimpleName().equals("LegacyTaglet")) return o; try { Field f=o.getClass().getDeclaredField("le…
has comment: http://stackoverflow.com/comment/37274426
has comment: http://stackoverflow.com/comment/38078538
score: 0
has comment: http://stackoverflow.com/comment/38078531
has comment: http://stackoverflow.com/comment/37274526
has comment: http://stackoverflow.com/comment/38117695
has comment: http://stackoverflow.com/comment/38853905
has comment: http://stackoverflow.com/comment/37273584
has comment: http://stackoverflow.com/comment/37282681
type: Answer
has comment: http://stackoverflow.com/comment/38117668
has comment: http://stackoverflow.com/comment/38863693
answers question: http://stackoverflow.com/q/23914909

http://stackoverflow.com/a/23785108
has body: If it doesn't exists, is there at least some methodology to cut down on the repetition? Nope, not really - not unless you control the type. If you do control the type, you can make the set methods return this, allowing you to chain the method calls. This is often useful for builder types: Person person = Person.newBuilder().setName("John").setAge(32).build(); (You can just make your types mutable rather than separating builder types from immutable non-builder types, but I'm just a fan of immutability...)
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23785053
type: Answer
accepted answer of: http://stackoverflow.com/q/23785053
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/23858782
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23851416
has body: the bug was in DatabaseManager.java in the finally block @ close(getConnection()). Here is the fix. DatabaseManager.java public ResultSet executeQuery(String sql) throws Exception { ResultSet result = null; CachedRowSetImpl cachedResult = null; Connection con = getConnection(); try { result = con.createStatement().executeQuery(sql); cachedResult = new CachedRowSetImpl(); cachedResult.populate(result); return cachedResult; } catch (SQLException e) { System.err.println("ERROR: " + e.getMessage()); e.printStackTrace(); } finally { closeConnection(con); } return cachedResult; }

http://stackoverflow.com/q/23851409
has comment: http://stackoverflow.com/comment/36706756
tagged with: hql
has comment: http://stackoverflow.com/comment/36707389
type: Question
has comment: http://stackoverflow.com/comment/36706586
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36706863
has comment: http://stackoverflow.com/comment/36707501
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36706835
has body: I have a table canvastowidgets { idCanvas int PK idWidgets int PK version varchar sequence int position int inPanelOrNot int } and the mapping xml as below <column name="idCanvas" /> <generator class="assigned" /> <column name="idWidgets" /> <column name="sequence" /> <column name="position" /> <column name="inPanelOrNot" /> When I execute the query as below Query query = session.createQuery("from CanvasHasWidget where idCanvas = :id"); query.setParameter("id",canvas.getCanvasId()); return query.list(); query is select canvashasw0_.idCanvas as idCanvas1_2_, canvashasw0_.idWidgets as idWidget2_2_, canvashasw0_.sequence as sequence3_2_, canvashasw0_.position as position4_2_, canvashasw0_.inPanelOrNot as inPanelO5_2_ from canvastowidgets canvashasw0_ where idCanvas=? 07:38:16,822 TRACE BasicBinder:81 - binding parameter [1] as [INTEGER] - [1] 07:38:16,829 TRACE BasicExtractor:78 - extracted value ([idCanvas1_2_] : [INTEGER]) - [1] 07:38:16,835 TRACE BasicExtractor:78 - extracted value ([idCanvas1_2_] : [INTEGER]) - [1] 07:38:16,840 TRACE BasicExtractor:78 - extracted value ([idCanvas1_2_] : [INTEGER]) - [1] The list returns 3 rows where I have 3 rows in table. but all 3 rows which returned are same.
has answer: http://stackoverflow.com/a/23851938
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23851938
has title: Hibernate load same row

http://stackoverflow.com/comment/36579639
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23784752
has text: Why would you want to do that?
score: 0

http://stackoverflow.com/q/23906199
answer count: 1
linked to: http://stackoverflow.com/q/9867273
linked to: http://stackoverflow.com/q/7199439
has comment: http://stackoverflow.com/comment/36811577
has comment: http://stackoverflow.com/comment/36811284
has comment: http://stackoverflow.com/comment/100338131
upvote count: 1
duplicate of: http://stackoverflow.com/q/11116020
tagged with: getresource
favorite count: 0
type: UnansweredQuestion
downvote count: 2
duplicate of: http://stackoverflow.com/q/9867273
has title: getClass().getResource() return null
duplicate of: http://stackoverflow.com/q/7199439
linked to: http://stackoverflow.com/q/11116020
has answer: http://stackoverflow.com/a/23906666
duplicate of: http://stackoverflow.com/q/16763356
has comment: http://stackoverflow.com/comment/36811428
tagged with: java
score: -1
tagged with: image
linked to: http://stackoverflow.com/q/16763356
type: Question
tagged with: resource-files
has comment: http://stackoverflow.com/comment/36811192
tagged with: null
has body: Hi i am making a quiz application with my project partner and at the end of the quiz i am trying to display an image from out of my resource folders to the winners (a trophy). Everything worked fine untill he tried to run the application on his computer. The project is shared, so if he changes something it changes in my files aswell and vice versa. But at this time i can't even let it work on my computer anymore. Here is an image how i placed the image in a resourcefolder called Images. You can see this and the code on here. My code is as follows : BufferedImage image = null; java.net.URL url = getClass().getResource("src/Images/trophy.png"); /* Draw an image for the winning team */ try { if (url == null) System.out.println("TEST"); else { image = ImageIO.read(url); g.drawImage(image, w / 2, 300, this); /* Draw the image */ } } catch (IOException e) { e.printStackTrace(); } I've already tried cleaning the project like advised in other posts, i've already changed the location to this aswell "/src/Images/trophy.png" but this isn't working aswell. Anybody knows whats wrong? Thanks!

http://stackoverflow.com/comment/36620322
comment on: http://stackoverflow.com/a/23806444
has text: I have removed the word test also but again the same error
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23880401
has comment: http://stackoverflow.com/comment/36762516
has body: I'm trying to paint an image using setRGB, and I go get the RGB values from a text file, however the image always paints black. But if I provide my own values, it works. Here's the code that always paints in Black: public JMenuBar menubar; public JMenuItem importFile; public Scanner filePath; StringTokenizer tokens = null; BufferedImage image; int[][][] images; JPanel panelDown = new JPanel(); MyPanel myPanel; Color myColor; int[] coords = new int[2]; int i = 0, j = 0; public class MyPanel extends JPanel { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //g.setColor(myColor); g.drawImage(image, 0, 0, null); //g.drawRect(10, 10, 40, 50); } } public Window2() { super("Exercise 2"); menubar = new JMenuBar(); setLayout(new BorderLayout()); JPanel panelBar = new JPanel(); add(panelBar, BorderLayout.NORTH); add(panelDown, BorderLayout.CENTER); importFile = new JMenuItem("Import", 'I'); panelBar.add(menubar); menubar.add(importFile); importFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { FileDialog fd = new FileDialog(Window2.this, "Import Maze", FileDialog.LOAD); fd.setFile(".txt"); fd.setLocation(Window2.this.getX() + 100, Window2.this.getY() + 100); fd.show(); if (!fd.getFile().endsWith(".txt")) { JOptionPane.showMessageDialog(Window2.this, "Wrong file extension", "Error", JOptionPane.WARNING_MESSAGE); } else { File theFile = new File(fd.getDirectory() + "\\" + fd.getFile()); try { filePath = new Scanner(theFile); } catch (FileNotFoundException ex) { Logger.getLogger(Window2.class.getName()).log(Level.SEVERE, null, ex); } images = readFile(filePath); panelDown.setLayout(new GridLayout(coords[0], coords[1])); for (int k = 0; k &lt; coords[0]; k++) { for (int l = 0; l &lt; coords[1]; l++) { int red = images[k][l][0]; int green = images[k][l][1]; int blue = images[k][l][2]; m…
has comment: http://stackoverflow.com/comment/36762141
has comment: http://stackoverflow.com/comment/36761522
has comment: http://stackoverflow.com/comment/36761874
type: AnsweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36761497
has comment: http://stackoverflow.com/comment/36761889
tagged with: swing
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/36761747
type: Question
has title: BufferedImage setRGB isn't accepting given values
has comment: http://stackoverflow.com/comment/36762054
has comment: http://stackoverflow.com/comment/36762415
score: -2
has comment: http://stackoverflow.com/comment/36761521
has comment: http://stackoverflow.com/comment/36762378
has answer: http://stackoverflow.com/a/23880863
has comment: http://stackoverflow.com/comment/36761982
tagged with: rgb
accepted answer: http://stackoverflow.com/a/23880863
has comment: http://stackoverflow.com/comment/36761619
has comment: http://stackoverflow.com/comment/36762033
upvote count: 0
has comment: http://stackoverflow.com/comment/36761573
has comment: http://stackoverflow.com/comment/36762259
answer count: 1
has comment: http://stackoverflow.com/comment/36762489
has comment: http://stackoverflow.com/comment/36762465
favorite count: 0

http://stackoverflow.com/comment/36817055
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23909480
score: 1
has text: If your `ArrayList` holds `MapPoint` objects, why is `MapPoint` not implementing `Parcelable`?

http://stackoverflow.com/q/23805995
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36623886
tagged with: mysql
tagged with: java
has body: I use JDBC Java MySQL driver, but I found it is some how slow in cases when I run tests where I do drop table populate data and read it from straight after. data appears not there, But is I do delay for some second - data is there. I am afraid that not only Tests works this way and production code also may not read last data written. So I need read just after written. without delay. Would some caching help? Googled for and tried manuals still could not find answer. here is some code i do use for inserting and retrieving: private Connection conn = null; private Statement stmt0; private Statement stmt1; @Inject public DBConnectorMysql(@Named("JDBC_URL") String url, @Named("JDBC_CRED") String creds) throws SQLException { conn = DriverManager.getConnection(url + creds); stmt0 = conn.createStatement(); stmt1 = conn.createStatement(); } @Override public ResultSet executeQuery(String query) throws SQLException { return stmt0.executeQuery(query); } @Override public int executeUpdate(String query, String... values) throws SQLException { PreparedStatement stmt = conn.prepareStatement(query, Statement.RETURN_GENERATED_KEYS); int i = 0; for (String s: values){ stmt.setString( ++i, s ); } stmt.executeUpdate(); int newId = -1; ResultSet rs = stmt.getGeneratedKeys(); if (rs.next()) { newId = rs.getInt(1); } rs.close(); stmt.close(); return newId; } I do use Java SE with Mysql driver I actively use three tables without foreign key.
type: Question
has title: Mysql configuration for using some caching
score: 0
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/23809275

http://stackoverflow.com/a/61987118
type: Answer
answers question: http://stackoverflow.com/q/23794997
has body: Don't omit the / in the end, and try: -Djava.rmi.server.codebase=file:/C:/Users/samue_000/public_html/classes/
score: 0

http://stackoverflow.com/comment/36675152
score: 0
type: Comment
type: QuestionComment
has text: Gotcha! That was my Friday afternoon wise comment.
comment on: http://stackoverflow.com/q/23835182

http://stackoverflow.com/comment/36667660
comment on: http://stackoverflow.com/a/23831259
score: 0
type: AnswerComment
type: Comment
has text: I can't see anywhere that this List is made available to another thread. It is not so clear in SO but have a look in [GrepCode](http://grepcode.com/file/repo1.maven.org/maven2/org.apache.httpcomponents/httpclient/4.3.1/org/apache/http/client/protocol/RequestAddCookies.java#174)

http://stackoverflow.com/comment/36610418
type: Comment
comment on: http://stackoverflow.com/q/23797816
type: QuestionComment
score: 1
has text: "EclipseLink does not support the cache usage for native queries or queries that have complex result sets such as returning data or multiple objects." - So there is no way I can do it.

http://stackoverflow.com/a/23876893
has body: In your receiveFile() method, you read the first 10 MB of what's received - probably all of it - into byteArray. Then, in the following line: byteArray = BOS.toByteArray(); You throw away the previous value of byteArray including all the data you've received, replacing it with the empty contents of BOS. What you need to do instead is read from the input stream into the buffer, then write from the buffer to your FileOutputStream. There's no need to bother with a ByteArrayOutputStream.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23876411
has comment: http://stackoverflow.com/comment/36755515
score: 0
accepted answer of: http://stackoverflow.com/q/23876411

http://stackoverflow.com/q/23851097
type: UnansweredQuestion
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23851110
tagged with: nested-loops
tagged with: java
score: -1
upvote count: 0
answer count: 3
has title: Why my Nested loop output wont move to a new line
has answer: http://stackoverflow.com/a/23851155
has body: This should be the final output, but my code goes down a straight line. (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) The code: public class PP2A { public static final int MAX = 5; public static void main(String[] args) { loop(); } public static void loop() { int count,number; for(count=1; count&lt;=MAX; count++) { for(number=1; number&lt;= count; number++) { System.out.println(" (^_^) "); } System.out.println(); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/23851112

http://stackoverflow.com/q/23914394
tagged with: http://stackoverflow.com/tag/html
has body: this is my program Movie Name : Hero: Director: Insert update Delete when i click on the any of the href link the values of above text boxes should also to be carried to that particular jsp page i used getparameter method but i am not getting what i entered but they are taking null values
tagged with: url-rewriting
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23914441
tagged with: href
tagged with: java
has title: href tags in jsp's and passing data by clicking on href tag
type: Question
score: 2
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0

http://stackoverflow.com/comment/36723096
type: AnswerComment
comment on: http://stackoverflow.com/a/23859757
type: Comment
has text: Why you would need to do that? E.g. what are you trying to accomplish with that?
score: 0

http://stackoverflow.com/a/23824601
answers question: http://stackoverflow.com/q/23802274
type: Answer
has body: Turned out to be an unhandled race condition. I updated a table before the submitted job had completed which caused an error. Thanks
score: 0

email
tags question: http://stackoverflow.com/q/23911110
tags question: http://stackoverflow.com/q/23801935
tags question: http://stackoverflow.com/q/23909807
tags question: http://stackoverflow.com/q/23940036
tags question: http://stackoverflow.com/q/23780543
tags question: http://stackoverflow.com/q/23886093
tags question: http://stackoverflow.com/q/23802924
tags question: http://stackoverflow.com/q/23862939
tags question: http://stackoverflow.com/q/23822266
tags question: http://stackoverflow.com/q/23936220
tags question: http://stackoverflow.com/q/23827359
tags question: http://stackoverflow.com/q/23824241
tags question: http://stackoverflow.com/q/23904560
type: Tag
tags question: http://stackoverflow.com/q/23905132
tag name: email

http://stackoverflow.com/q/23840331
tagged with: java
upvote count: 1
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/28135338
tagged with: ksoap2
has body: I am using 4.0.3 target and I am using ksoap2. The webservice is WCF of Visual Studio 2010 Express. It Could be an error of soap_action, call or namespace. I am getting next error each time 05-24 02:49:42.738: W/System.err(5231): android.os.NetworkOnMainThreadException 05-24 02:49:42.748: W/System.err(5231): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1154) 05-24 02:49:42.748: W/System.err(5231): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 05-24 02:49:42.748: W/System.err(5231): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 05-24 02:49:42.748: W/System.err(5231): at java.net.InetAddress.getAllByName(InetAddress.java:214) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 05-24 02:49:42.748: W/System.err(5231): at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) 05-24 02:49:42.748: W/System.err(5231): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:46) 05-24 02:49:42.748: W/System.err(5231): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68) 05-24 02:49:42.748: W/System.err(5231): at org.tempuri.IAndroid.getAllPro…
has answer: http://stackoverflow.com/a/23840695
has comment: http://stackoverflow.com/comment/36685611
answer count: 2
possible better answer: http://stackoverflow.com/a/23841411
has comment: http://stackoverflow.com/comment/51540444
downvote count: 0
has answer: http://stackoverflow.com/a/23841411
accepted answer: http://stackoverflow.com/a/23840695
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
has title: How to resolve android.os.NetworkOnMainThreadException?
duplicate of: http://stackoverflow.com/q/6343166
tagged with: android
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23783617
type: Question
has body: a have to call a remote web service which contains complex tyles in the wsdl, using java and apache axis. The solution http://axis.apache.org/axis/java/user-guide.html#WSDL2JavaBuildingStubsSkeletonsAndDataTypesFromWSDL is not enough for me, because i have to suppoprt ANY type of class, i mean the serialized class is not determined until runtime. I have no problems with simple types, but when complex types are found in the wsdl, i get problems. See the example, private Object getParamData(org.apache.axis.client.Call call, Parameter parameter, String arg, Parameters parameters) { QName paramType = org.apache.axis.wsdl.toJava.Utils.getXSIType(parameter); TypeEntry type = parameter.getType(); if (type instanceof BaseType &amp;&amp; ((BaseType)type).isBaseType()) { DeserializerFactory factory = call.getTypeMapping().getDeserializer(paramType); Deserializer deserializer = factory.getDeserializerAs(Constants.AXIS_SAX); return ((SimpleDeserializer)deserializer).makeValue(arg); } else { // What to do for complex types? // ElementDeserializerFactory defact = new ElementDeserializerFactory(); // ((Call)iCall).registerTypeMapping(Element.class, paramType, new ElementSerializerFactory, defact); I can create deserializer factory but active deserializers are empty and i con get any value for return.
upvote count: 2
tagged with: java
tagged with: web-services
type: UnansweredQuestion
score: 2
tagged with: apache
tagged with: wsdl
answer count: 0
downvote count: 0
tagged with: complextype
favorite count: 0
has title: setting complex types in java apache web service call

http://stackoverflow.com/a/23868983
has comment: http://stackoverflow.com/comment/36739946
type: Answer
answers question: http://stackoverflow.com/q/23868957
score: 2
upvote count: 2
has body: %s is the placeholder for a String use %d instead. String.format() is also the slowest way to build Strings. Use a Stringbuilder or for simple cases just the + operator. frameRate = "FPS " + frameCount;
has comment: http://stackoverflow.com/comment/36740273
downvote count: 0

http://stackoverflow.com/a/23937841
type: AcceptedAnswer
type: Answer
has body: You are absolutely correct to be usable it should be either png or jpeg(there are others too). Png and 9 patch png are preferred in android. You can find more about it on the developers website.
has comment: http://stackoverflow.com/comment/36874483
has comment: http://stackoverflow.com/comment/36874991
answers question: http://stackoverflow.com/q/23937218
score: 0
accepted answer of: http://stackoverflow.com/q/23937218

http://stackoverflow.com/comment/36746976
comment on: http://stackoverflow.com/a/23872661
type: Comment
has text: Thanks a lot ! This one actually seems to work. My Projectiles arent flying at the moment, but that may be a different problem. Atleast my frames are fine and not missing any objects as sometimes before and I get no Exceptions. I let you know, if it solved my problem, when my Projectiles work with this solution
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36823280
comment on: http://stackoverflow.com/a/23911871
has text: Thanks for the answer @matthew-wilson. Trying to push this a little further, how can I do it if I want to save the output of this bean call to a header? I'm expecting something like `setHeader("anotherHeader", simple("bean:myBean?method=beanMethod(${header.someHeader})"))`
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23917788
has comment: http://stackoverflow.com/comment/36868378
type: Question
has comment: http://stackoverflow.com/comment/36868276
tagged with: mongodb
score: 0
has title: Incremental Mongodb Update
has comment: http://stackoverflow.com/comment/36864568
answer count: 0
has body: I'm trying to update my db incrementally by parsing a csv and counting how many times each person has been to a country or state, if they're within the US. public static void main(String[] args) throws UnknownHostException { Scanner dir = new Scanner(System.in); String dir_loc; System.out.println("Enter File Directory:"); dir_loc=dir.nextLine(); Scanner dbloc = new Scanner(System.in); String db_loc; System.out.println("Enter Database location:"); db_loc=dbloc.nextLine(); Scanner port = new Scanner(System.in); int port_loc; System.out.println("Enter Port:"); port_loc=port.nextInt(); dir.close(); dbloc.close(); port.close(); System.out.println("uploading"); String directoryName = dir_loc; File directory = new File(directoryName); File[] fileList = directory.listFiles(); DB dB = (new MongoClient(db_loc, port_loc)).getDB("visits"); DBCollection dBCollection = dB.getCollection("Channel"); BasicDBObject doc = null; for(File file: fileList) { String dataFileName = file.toString(); BufferedReader bReader = null; try { bReader = new BufferedReader(new FileReader(dataFileName)); } catch (FileNotFoundException e2) { e2.printStackTrace(); System.exit(-1); } String line = null; int count = 0; int statecount = 0; try { while((line = bReader.readLine()) !=null) { String dataValue[] = line.split("\t"); String user_id = (dataValue[2]); String country = (dataValue[1]); boolean user_idExists = dBCollection.equals(user_id); if(user_idExists){ if(dataValue[1].equals("US")) { String state = (dataValue[5]); System.out.println(state); boolean stateExists = dBCollection.equals(state); if(stateExists){ statecount ++; doc = new BasicDBObject("user_id", user_id).append("country", country).append("state", state) .append("count", statecount); } else{ statecount = 1; doc = new BasicDBObject("user_id", user_id).append("country", country).append("state", state) .append("count", statecount); } } else{ boolean countryExists = dBCollection.equals(country); if(countryExists){ count ++; doc = new BasicD…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36834664
tagged with: java

http://stackoverflow.com/a/23781551
upvote count: 1
has comment: http://stackoverflow.com/comment/36616365
score: 1
has comment: http://stackoverflow.com/comment/36573546
downvote count: 0
has comment: http://stackoverflow.com/comment/36573879
has comment: http://stackoverflow.com/comment/36575934
has comment: http://stackoverflow.com/comment/36648932
has comment: http://stackoverflow.com/comment/36573643
answers question: http://stackoverflow.com/q/23780282
type: Answer
has comment: http://stackoverflow.com/comment/36614603
has body: Try this out. It may work. Use Freemarker USE $. /WEB-INF/jsp/profile.jsp It may work
has comment: http://stackoverflow.com/comment/36650010
has comment: http://stackoverflow.com/comment/36616229
has comment: http://stackoverflow.com/comment/36646105

http://stackoverflow.com/a/23813016
answers question: http://stackoverflow.com/q/23812828
type: Answer
has body: Peter's answer is probably going to solve your problem. But why not take this time to improve the overall design of your program. Do you really want to pass Object into method(..)? Why not: interface Processable&lt;I, O&gt; { O process(I input); } and have a NoOp Processor that simply does nothing. What your doing right now is not very OO.
score: 0

http://stackoverflow.com/comment/126760748
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23925631
has text: @JohnnyWiller "Bound" means that the receiver of the method call is bound at lambda capture time.

http://stackoverflow.com/comment/36718030
score: 0
type: AnswerComment
has text: Ok, thanks for your answer. But I've written some code but I haven't found the solution, because there are a lot of buttons to implements and I would avoid to put a lot of if to understand which button is been pressed. I make an example. In the map there are 30 buttons and three categories of buttons (10 that call a method, 10 another and so on). Each button pass different information to the method. Can I manage this situation avoiding a cascade of if in the class that must manage the pression of the buttons?
type: Comment
comment on: http://stackoverflow.com/a/23857236

http://stackoverflow.com/a/46877713
answers question: http://stackoverflow.com/q/23872644
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: For anyone still looking for a solution, I feel this is an answer that speaks closest to the desired behaviour - using a ternary operator in the bean definition.

http://stackoverflow.com/q/23878338
possible better answer: http://stackoverflow.com/a/23879628
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23879628
has comment: http://stackoverflow.com/comment/36787644
has answer: http://stackoverflow.com/a/23878390
accepted answer: http://stackoverflow.com/a/23878390
tagged with: timezone
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to get the Timezone Hour and Minute in Java?
has body: I found a code on how to get a Timezone: TimeZone.getDefault().getID() It returns the name or Timezone region like "Asia/Singapore" or "Asia/Manila". Is there anyone who knew how to get the sign, timezone hour, and timezone minute? like +08:00, or -09:30 Thanks!

http://stackoverflow.com/comment/36693439
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23842498
type: Comment
has text: well i ended up using onback key press, its even more suitable for a messenger application, i dont want it to bother, ill put an exit button for that later

architecture
tags question: http://stackoverflow.com/q/23867381
type: Tag
tag name: architecture

http://stackoverflow.com/comment/36571310
comment on: http://stackoverflow.com/q/23779064
score: 0
has text: Given what @user3580294 has said the most likely issue here is that you are microbenchmarking incorrectly. Java initially runs by interpreting bytecode (moderate speed), then if appropropriate it will compile that bytecode to native code (fast). This means that any shared methods will be slower in the first test because they are (at least initially) being interpreted; worse still the compilation may happen during the test which can further skew results. As a bare minimum always include a warmup phase in any microbenchmark
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36733171
comment on: http://stackoverflow.com/q/23863401
has text: If you need to switch the authentication, this should probably be thread per thread and not globally. You shouldn't be looking at that but more a custom `DataSource` wrapper.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36797160
type: QuestionComment
has text: Guess ...if a person gets one downvode ... others simply downvote !(they won't even read also i guess) ... this is bad ... this question looks a valid one to me ... as backward compatibility for handling certain JSON structure is a good info in the site ... ill try to improve my explanation standards in the further posts
score: 0
comment on: http://stackoverflow.com/q/23898245
type: Comment

http://stackoverflow.com/comment/36763438
has text: This code will dynamically keep adding `RelativeLayout`s to it's parent LinearLayout. @hiphopdroid is right, I want to remove THAT button's parent RelativeLayout.
comment on: http://stackoverflow.com/a/23881434
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/23919578
tagged with: java
has title: AngularJS Web Application with Spring Security
type: Question
upvote count: 5
has body: I am working on implementing Spring Security in an AngularJS application. I am relatively new to both technologies, and I have found several very helpful sites with tutorials and examples of how to implement AngularJS and Spring Security. My problem currently lies in restricting URL paths to certain users. IT sounds like a simple problem, but I have drowned myself with documentation trying to figure out a problem that must have been solved previously. In AngularJS, there is a hash mark in the URL when navigating to different URLs and that seems to cause a problem with Spring. There is no error thrown, but the resource is not restricted. My code is below: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> contextConfigLocation /WEB-INF/paperwebapp-servlet.xml org.springframework.web.context.ContextLoaderListener webapp org.springframework.web.servlet.DispatcherServlet contextConfigLocation * 1 webapp / characterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true characterEncodingFilter /* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* app-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:p="http://www.springframework.org/schema/p" 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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.s…
tagged with: spring-security
tagged with: security
answer count: 1
has answer: http://stackoverflow.com/a/23920229
downvote count: 0
favorite count: 0
tagged with: angularjs
score: 5
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23920229

knapsack-problem
type: Tag
tag name: knapsack-problem
tags question: http://stackoverflow.com/q/23887860

http://stackoverflow.com/q/23855929
tagged with: java
has comment: http://stackoverflow.com/comment/36715158
tagged with: methods
has title: Error with abstract class and methods
downvote count: 1
tagged with: arrays
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23856159
has comment: http://stackoverflow.com/comment/36715130
tagged with: abstract-class
upvote count: 0
has body: I have an abstract class Player and i want to create two kind of players. Fast and Technical Players.So i created this abtsract class: public abstract class Player { private int speed; private int technical; private Cell playerCell; public abstract void computeAbility(); public abstract void clonePlayer(); public Player(){ Random rand = new Random(); speed = rand.nextInt(50); technical = rand.nextInt(50); } //i also have accesor and mutator methods } public class FastPlayer extends Player { private int overallAtrributes; public FastPlayer(){ super(); setSpeed(2*getSpeed()); } public void computeOverallAtrributes(){ overallAtrributes = getSpeed() + getTechnical(); } public void clonePlayer(){ FastPlayer cloneFastPlayer = new FastPlayer(); cloneFastPlayer.setTechnical(getTechnical()); cloneFastPlayer.setSpeed(getSpeed()); } } public class TechnicalPlayer extends Player { private int overallAtrributes; public TechnicalPlayer(){ setTechnical(2*getTechnical()); } public void computeOverallAtrributes(){ overallAtrributes = getSpeed() + getTechnical(); } public void clonePlayer(){ TechnicalPlayer cloneTechnicalPlayer = new TechnicalPlayer(); cloneTechnicalPlayer.setTechnical(getTechnical()); cloneTechnicalPlayer.setSpeed(getSpeed()); } } Now i want create a reproducePlayer method in Player class to produce a Player of the same type as current Player and i want to put the new person in the same Cell. So i created this method in Player class: public void reproduce(){ this.clonePlayer(); //how can i put the new Player in the same Cell with current Player? } I also want to create a method movePlayer which moves the Player in a Random neighbor Cell of my array. i dont have create the class Cell yet.
has answer: http://stackoverflow.com/a/23856392
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/36715121
type: Question
answer count: 2

http://stackoverflow.com/q/23840864
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23840893
tagged with: primes
tagged with: java
type: Question
type: AnsweredQuestion
has title: Programming Sieve of Eratosthenes and Writing to a file
has body: So I have an assignment where we have to generate all the primes between 0 a user-determined value less than 200 using the Sieve of Eratosthenes algorithm, and then write those primes to a file called "primesTo200.txt" with a maximum of 10 prime numbers per line. Now my code works perfectly fine when I enter 120 as the maximum prime value, but when I try to enter any other number between 0-200, it will generate the primes fine but I get an "out of bounds exception" error when it tries to write to the file. Why is that?? I haven't hard-coded anything that would make only 120 work... could someone help me please?? ^_^ import java.util.Arrays; import java.util.Scanner; import java.io.*; public class A1Q1 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a maximum value up to which you wish to generate prime numbers [max 200]: "); int maxValue = keyboard.nextInt(); while(maxValue &gt; 200 || maxValue &lt; 0) { System.out.println("Sorry, that is not a max value between [0 - 200]. Please enter another integer: "); maxValue = keyboard.nextInt(); } int[] primes = generatePrimes(maxValue); System.out.println(Arrays.toString(primes)); try { FileWriter fileName = new FileWriter("primesTo200.txt."); recordArray(primes, fileName); } catch(IOException ioe) { ioe.printStackTrace(); } } public static int[] generatePrimes(int maxValue) { boolean[] array = new boolean[maxValue + 1]; int[] primesFull = new int[maxValue]; int count = 0; for(int i = 2; i &lt; array.length; i++) { array[i] = true; } for(int nextPrime = 2; nextPrime * nextPrime &lt;= maxValue; nextPrime++) { for(int i = 2; i * nextPrime &lt;= maxValue; i++) { array[i * nextPrime] = false; } } for(int i = 2; i &lt;= maxValue; i++) { if(array[i] == true) { primesFull[count] = i; count++; } } int[] primes = new int[count]; System.arraycopy(primesFull, 0, primes, 0, count); return primes; } public static void recordArray(int[] primes, FileWriter fileName) { PrintWr…
has answer: http://stackoverflow.com/a/23840893

http://stackoverflow.com/comment/36765034
type: QuestionComment
has text: json string looks good to me. There is nothing wrong in the json data.
score: 0
comment on: http://stackoverflow.com/q/23882251
type: Comment

http://stackoverflow.com/q/23906748
favorite count: 0
has answer: http://stackoverflow.com/a/23907672
has title: Groovy compiler does not accept Java 8 lambdas
accepted answer: http://stackoverflow.com/a/23907672
tagged with: java-8
answer count: 1
score: 43
tagged with: java
downvote count: 1
upvote count: 44
tagged with: closures
has body: As we know, the Groovy syntax accepts closures. Today also, Java 8 adds in its syntax closure. However, when I write a Java 8 closure in a Groovy file, I get an error like the following: Person.findAll().stream().filter(e-&gt; e.age &gt; 20) We get this error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 7: unexpected token: -&gt; @ line 7, column 39. Person.findAll().stream().filter(e-&gt; e.controllerId &gt; 0) ^ 1 error Nevertheless, the following works successfully: Person.findAll().stream()
has comment: http://stackoverflow.com/comment/36843796
tagged with: groovy
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36820323

http://stackoverflow.com/a/23810985
has comment: http://stackoverflow.com/comment/36629056
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36629499
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23810781
has body: Since you do: IListener&lt;String&gt; listener = myListener; listener.onEvent("XYZ"); it means IListener's .onEvent() is called. But Mockito's proxy is over MyListener, and you redefine .onEvent() in the latter. As a result, Mockito will not see your calls to IListener's .onEvent(). If you remove the override to .onEvent() in MyListener then it will work (why did you override it in the first place by the way?). One way to do this would be to initiate your mock as an IListener&lt;String&gt;, not a MyListener. Another way, but urgh. Note that your mock must be final for this to work. doAnswer(new Answer&lt;Void&gt;() { @Override public Void answer(final InvocationOnMock invocation) throws Throwable { final String o = (String) invocation.getArguments()[0]; myListener.onEvent(o); return null; } }).when((IListener&lt;String&gt;) myListener).onEvent(anyString());
has comment: http://stackoverflow.com/comment/36653473
type: Answer
answers question: http://stackoverflow.com/q/23810781
score: 2
has comment: http://stackoverflow.com/comment/36629765

http://stackoverflow.com/q/23936220
has comment: http://stackoverflow.com/comment/36890449
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23991508
tagged with: java
has body: I want to send email attachements through Exchange server using java. Sending email is working fine: ExchangeService service = new ExchangeService(); ExchangeCredentials credentials = new WebCredentials(username,password); service.setCredentials(credentials); service.setUrl(new URI(MailHost)); EmailMessage msg = new EmailMessage(service); msg.setSubject("My Subject!"); msg.setBody(MessageBody.getMessageBodyFromText("My Message")); msg.getToRecipients().add(mailTo); Can anyone please help me?
type: Question
tagged with: exchange-server
tagged with: exchange-server-2010
accepted answer: http://stackoverflow.com/a/23991508
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/36869244
possible better answer: http://stackoverflow.com/a/35880688
tagged with: email
downvote count: 0
has answer: http://stackoverflow.com/a/35880688
favorite count: 0
has comment: http://stackoverflow.com/comment/36868320
upvote count: 2
has title: How to send email attachments with microsoft exchange?

http://stackoverflow.com/comment/36864531
type: AnswerComment
has text: You are using pre-JDK 7 code. A similar (and better) method already exists in Java 7.
type: Comment
comment on: http://stackoverflow.com/a/23934777
score: 0

glassfish
tags question: http://stackoverflow.com/q/23813669
tags question: http://stackoverflow.com/q/23873680
tags question: http://stackoverflow.com/q/23786624
tags question: http://stackoverflow.com/q/23800241
tags question: http://stackoverflow.com/q/23901560
tags question: http://stackoverflow.com/q/23900826
tags question: http://stackoverflow.com/q/23937494
tags question: http://stackoverflow.com/q/23918201
tags question: http://stackoverflow.com/q/23913164
tags question: http://stackoverflow.com/q/23907941
tags question: http://stackoverflow.com/q/23906034
tags question: http://stackoverflow.com/q/23783882
tags question: http://stackoverflow.com/q/23792976
tags question: http://stackoverflow.com/q/23808594
tags question: http://stackoverflow.com/q/23837339
tags question: http://stackoverflow.com/q/23917084
tags question: http://stackoverflow.com/q/23827820
tags question: http://stackoverflow.com/q/23892484
tag name: glassfish
tags question: http://stackoverflow.com/q/23796268
tags question: http://stackoverflow.com/q/23862505
tags question: http://stackoverflow.com/q/23886951
type: Tag

http://stackoverflow.com/q/23850898
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23866962
tagged with: gwt-super-dev-mode
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23866962
tagged with: gwt
tagged with: debugging
accepted answer: http://stackoverflow.com/a/24334132
tagged with: source-maps
answer count: 2
has comment: http://stackoverflow.com/comment/37501345
has comment: http://stackoverflow.com/comment/37617185
downvote count: 0
has body: So far, debugging in GWT super dev mode seems to be a real pain. If there are any errors, there is no stack trace, just a cryptic message given in the chrome console. Is there a way to get all errors to print a stack trace, like in the dev mode? I already have source maps on I believe, since if I go to Sources in Chrome's dev tools, I can see the source code of my java classes.
favorite count: 0
linked to: http://stackoverflow.com/q/1149703
has title: Debugging in GWT Super Dev Mode?
score: 6
has comment: http://stackoverflow.com/comment/37511673
has answer: http://stackoverflow.com/a/24334132
upvote count: 6
has comment: http://stackoverflow.com/comment/37484891

http://stackoverflow.com/a/23837130
has comment: http://stackoverflow.com/comment/36679058
has comment: http://stackoverflow.com/comment/36679248
accepted answer of: http://stackoverflow.com/q/23836980
has comment: http://stackoverflow.com/comment/36679198
has body: This is an easier way to go, using a do-while loop and a switch. Also fixed choice Scanner keyboard = new Scanner(System.in); double weight; int choice; System.out.println("What is your weight in pounds?"); weight = keyboard.nextDouble(); do { System.out.println("Which planet would you like to see your weight on?\n 1. Venus 2. Mars 3. Jupiter\n 4. Saturn 5. Uranus 6. Neptune\n 7. Exit"); choice = keyboard.nextInt(); switch(choice) { case 1: System.out.println("Your weight on Venus would be " + (weight * 0.78)); break; case 2: System.out.println("Your weight on Mars would be " + (weight * .39)); break; case 3: System.out.println("Your weight on Jupiter would be " + (weight * 2.65)); break; case 4: System.out.println("Your weight on Saturn would be " + (weight * 1.17)); break; case 5: System.out.println("Your weight on Uranus would be" +(weight * 1.05)); break; case 6: System.out.println("Your weight on Neptune would be " + (weight * 1.23)); break; case 7: System.out.println("Bye"); break; default: System.out.println("This was not a choice, try again!"); break; } } while (choice != 7);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23836980
has comment: http://stackoverflow.com/comment/36679276
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/23846702
has comment: http://stackoverflow.com/comment/36697561
tagged with: awt
has answer: http://stackoverflow.com/a/23847121
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36697324
has body: I am trying to create a map for a game I am making with a JPanel that uses gridLayout. In my first tests I use a 5x5 grid and create my small panels which are a subclass of JPanel. My program creates them fine but when I add all of the panels into the larger panel and display it, only the first square shows up and the rest is blank. Why does it do that? Here is my code for the MapSpace(smaller panel): import javax.swing.*; import java.awt.*; public class MapSpace extends JPanel{ private int ownerTag; private int xPos, yPos; public MapSpace(){ xPos = 0; yPos = 0; ownerTag = 0; setBackground(Color.WHITE); } public MapSpace(MapSpace m){ xPos = m.getX(); yPos = m.getY(); ownerTag = m.getID(); setBackground(m.getColor()); } and here is my code for the Map: import javax.swing.*; import java.awt.*; import java.util.*; public class Map extends JPanel{ private int cols, rows; private int randCol, randRow; private MapSpace[][] spaces; Random gen = new Random(); public Map(int w, int h){ cols = h; rows = w; setLayout(new GridLayout(cols, rows)); setBackground(Color.WHITE); spaces = new MapSpace[cols][rows]; for(int i = 0; i &lt; cols; i++){ for(int j = 0; j &lt; rows; j++){ MapSpace panel = new MapSpace(i, j); spaces[i][j] = panel; } } assignSpaces(3); setColors(); for(int i = 0; i &lt; cols; i++){ for(int j = 0; j &lt; rows; j++){ MapSpace spot = new MapSpace(spaces[i][j]); add(spot); } } setSize(400, 400); } the second nested for loop is where all the mapSpaces are added but when I put the map in a JFrame and display it in a GUI window only one small square in the top left corner appears.
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36697235
tagged with: java
tagged with: jpanel
has title: GridLayout stacks all JPanels on first cell
type: Question
tagged with: grid-layout

http://stackoverflow.com/comment/36599141
comment on: http://stackoverflow.com/a/23794378
type: AnswerComment
score: 0
type: Comment
has text: I didn't mark it before because it wasn't the proposed answer the solution to my problem, just that comment. Maybe you could please edit your answer and point out what was the real issue and how it was solved. Thank you again.

http://stackoverflow.com/a/23816536
answers question: http://stackoverflow.com/q/23816369
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36640149
type: Answer
upvote count: 3
has body: It's a clear cut case for polymorphism. You can declare the method in User (as Baalthasarr says), then override it in the subtypes (UserA, UserB, etc) as necessary. Then you just use loggedUser.clearAgenda() and the JRE will figure out which method to use automatically at runtime. public abstract class User { public void clearAgenda() {} // do nothing (or or something if you want) } public class UserA extends User { @Override public void clearAgenda() { ... } // do stuff specific to A } public class UserB extends User { @Override public void clearAgenda() { ... } // do stuff specific to B } public class UserC extends User { } public class System { private User loggedUser; public void clearUserAgenda() { // This will use the most appropriate method. If the type is // UserA, UserA's `clearAgenda` method will be used. Similar // for UserB. For UserC, The abstract User class's `clearAgenda` // method is used, because it was not overridden in UserC. loggedUser.clearAgenda(); } } If there's stuff you want to do that's common to all User subclasses, you can put it in User and still run it even if you override the method. For example: public class UserA extends User { @Override public void clearAgenda() { super.clearAgenda(); // do the stuff common to all User subclasses ... // do stuff specific to A } }
accepted answer of: http://stackoverflow.com/q/23816369
has comment: http://stackoverflow.com/comment/36640369

http://stackoverflow.com/q/23816635
has answer: http://stackoverflow.com/a/23816671
tagged with: java
has answer: http://stackoverflow.com/a/23816813
upvote count: 1
has comment: http://stackoverflow.com/comment/36640010
downvote count: 1
has title: About finally block
type: Question
linked to: http://stackoverflow.com/q/3226100
tagged with: try-finally
duplicate of: http://stackoverflow.com/q/3226100
has answer: http://stackoverflow.com/a/23816700
tagged with: try-catch-finally
has body: I know finally's purpose is to guarantee that some instructions or cleanup code get executed. But what is the actuall difference of using finally or putting the code after the catch block. I mean, give me an example of a case where you need to use finally because otherwise the code might not execute at all.
has answer: http://stackoverflow.com/a/23816726
score: 0
tagged with: finally
favorite count: 0
possible better answer: http://stackoverflow.com/a/23816815
has comment: http://stackoverflow.com/comment/36639979
answer count: 5
has answer: http://stackoverflow.com/a/23816815
accepted answer: http://stackoverflow.com/a/23816726
type: AnsweredQuestion

http://stackoverflow.com/q/23869228
has answer: http://stackoverflow.com/a/56453843
has comment: http://stackoverflow.com/comment/36740535
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip
possible better answer: http://stackoverflow.com/a/23870468
has answer: http://stackoverflow.com/a/23870468
type: Question
has comment: http://stackoverflow.com/comment/36741031
has answer: http://stackoverflow.com/a/23870501
has title: How to read file from ZIP using InputStream?
tagged with: java
has answer: http://stackoverflow.com/a/61411148
tagged with: inputstream
has answer: http://stackoverflow.com/a/50648338
has body: I must get file content from ZIP archive (only one file, I know its name) using SFTP. The only thing I'm having is ZIP's InputStream. Most examples show how get content using this statement: ZipFile zipFile = new ZipFile("location"); But as I said, I don't have ZIP file on my local machine and I don't want to download it. Is an InputStream enough to read? UPD: This is how I do: import java.util.zip.ZipInputStream; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; public class SFTP { public static void main(String[] args) { String SFTPHOST = "host"; int SFTPPORT = 3232; String SFTPUSER = "user"; String SFTPPASS = "mypass"; String SFTPWORKINGDIR = "/dir/work"; Session session = null; Channel channel = null; ChannelSftp channelSftp = null; try { JSch jsch = new JSch(); session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT); session.setPassword(SFTPPASS); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp) channel; channelSftp.cd(SFTPWORKINGDIR); ZipInputStream stream = new ZipInputStream(channelSftp.get("file.zip")); ZipEntry entry = zipStream.getNextEntry(); System.out.println(entry.getName); //Yes, I got its name, now I need to get content } catch (Exception ex) { ex.printStackTrace(); } finally { session.disconnect(); channelSftp.disconnect(); channel.disconnect(); } } }
has answer: http://stackoverflow.com/a/57563117
downvote count: 0
answer count: 7
upvote count: 55
favorite count: 0
accepted answer: http://stackoverflow.com/a/23870501
score: 55
has answer: http://stackoverflow.com/a/62359030

java
tags question: http://stackoverflow.com/q/23895815
tags question: http://stackoverflow.com/q/23820896
tags question: http://stackoverflow.com/q/23795747
tags question: http://stackoverflow.com/q/23805388
tags question: http://stackoverflow.com/q/23800018
tags question: http://stackoverflow.com/q/23796540
tags question: http://stackoverflow.com/q/23894725
tags question: http://stackoverflow.com/q/23920198
tags question: http://stackoverflow.com/q/23842614
tags question: http://stackoverflow.com/q/23903575
tags question: http://stackoverflow.com/q/23915129
tags question: http://stackoverflow.com/q/23865546
tags question: http://stackoverflow.com/q/23908749
tags question: http://stackoverflow.com/q/23882447
tags question: http://stackoverflow.com/q/23939270
tags question: http://stackoverflow.com/q/23897814
tags question: http://stackoverflow.com/q/23866700
tags question: http://stackoverflow.com/q/23893345
tags question: http://stackoverflow.com/q/23789957
tags question: http://stackoverflow.com/q/23879058
tags question: http://stackoverflow.com/q/23823353
tags question: http://stackoverflow.com/q/23916812
tags question: http://stackoverflow.com/q/23825908
tags question: http://stackoverflow.com/q/23794003
tags question: http://stackoverflow.com/q/23904539
tags question: http://stackoverflow.com/q/23921149
tags question: http://stackoverflow.com/q/23840007
tags question: http://stackoverflow.com/q/23844509
tags question: http://stackoverflow.com/q/23885552
tags question: http://stackoverflow.com/q/23801056
tags question: http://stackoverflow.com/q/23822529
tags question: http://stackoverflow.com/q/23847201
tags question: http://stackoverflow.com/q/23843780
tags question: http://stackoverflow.com/q/23835253
tags question: http://stackoverflow.com/q/23846902
tags question: http://stackoverflow.com/q/23921995
tags question: http://stackoverflow.com/q/23875277
tags question: http://stackoverflow.com/q/23839808
tags question: http://stackoverflow.com/q/23820463
tags question: http://stackoverflow.com/q/23870899
tags question: http://stackoverflow.com/q/23868933
tags question: http://stackoverflow.com/q/23921802
tags question: http://stackoverflow.com/q/23779674
tags question: http://stackoverflow.com/q/23830283
tags question: http://stackoverflow.com/q/23841845
tags question: http://stackoverflow.com/q/23905288
tags question: http://stackoverflow.com/q/23868608
tags question: http://stackoverflow.com/q/23900494
tags question: http://stackoverflow.com/q/23860595
tags question: http://stackoverflow.com/q/23874491
tags question: http://stackoverflow.com/q/23921678
tags question: http://stackoverflow.com/q/23890137
tags question: http://stackoverflow.com/q/23837218
tags question: http://stackoverflow.com/q/23931859
tags question: http://stackoverflow.com/q/23823686
tags question: http://stackoverflow.com/q/23866411
tags question: http://stackoverflow.com/q/23802642
tags question: http://stackoverflow.com/q/23872557
tags question: http://stackoverflow.com/q/23893928
tags question: http://stackoverflow.com/q/23940124
tags question: http://stackoverflow.com/q/23821442
tags question: http://stackoverflow.com/q/23920323
tags question: http://stackoverflow.com/q/23866710
tags question: http://stackoverflow.com/q/23862279
tags question: http://stackoverflow.com/q/23828946
tags question: http://stackoverflow.com/q/23911860
tags question: http://stackoverflow.com/q/23780821
tags question: http://stackoverflow.com/q/23780333
tags question: http://stackoverflow.com/q/23913481
tags question: http://stackoverflow.com/q/23931208
tags question: http://stackoverflow.com/q/23824633
tags question: http://stackoverflow.com/q/23899345
tags question: http://stackoverflow.com/q/23932393
tags question: http://stackoverflow.com/q/23786667
tags question: http://stackoverflow.com/q/23924304
tags question: http://stackoverflow.com/q/23813491
tags question: http://stackoverflow.com/q/23835626
tags question: http://stackoverflow.com/q/23826149
tags question: http://stackoverflow.com/q/23878253
tags question: http://stackoverflow.com/q/23820282

http://stackoverflow.com/q/23804761
type: UnansweredQuestion
tagged with: maven-3
type: Question
has title: Managing profiles during release
has comment: http://stackoverflow.com/comment/36632232
score: 0
tagged with: maven
has body: I'm new of maven-release-plugin and I'm try to release my java web application for the first time. Now I'm able to tag the application, but I have some issues during the process. I try to explain you in a better way. I'm working on a modular project: |-- parent |-- model pom.xml |-- services pom.xml |-- rest pom.xml |-- web-app pom.xml pom.xml This is the parent's pom tagged: 4.0.0 it.myCompany myApp 2.1.0 pom model services rest web-app scm:svn:svn://192.168.0.9/home/svn/myFolder/tags/myApp2.1.0/ scm:svn:svn://192.168.0.9/home/svn/myFolder/tags/myApp2.1.0/ org.apache.maven.plugins maven-release-plugin 2.2.2 com.google.code.maven-scm-provider-svnjava maven-scm-provider-svnjava 2.1.1 <providerImplementations> javasvn </providerImplementations> tomcat7:deploy org.apache.tomcat.maven tomcat7-maven-plugin 2.1 http://192.168.0.21:8081/manager/text tomcat-devel Development <db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass> <db.connectionURL>jdbc:oracle:thin:@192.168.0.12:1521:development</db.connectionURL> <db.username>myUser</db.username> <db.password>MyPass</db.password> <maven.test.skip>true</maven.test.skip> <maven.javadoc.skip>true</maven.javadoc.skip> Customer1 <db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass> <db.connectionURL>jdbc:oracle:thin:@192.168.0.13:1521:Customer1</db.connectionURL> <db.username>myUser</db.username> <db.password>MyPass</db.password> <maven.test.skip>true</maven.test.skip> <maven.javadoc.skip>true</maven.javadoc.skip> Customer2 <db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass> <db.connectionURL>jdbc:oracle:thin:@192.168.0.14:1521:Customer2</db.connectionURL> <db.username>myUser</db.username> <db.password>MyPass</db.password> <maven.test.skip>true</maven.test.skip> <maven.javadoc.skip>true</maven.javadoc.skip> Instead this is the section of my persistence.xml contained within of the model project <property name="javax.persistence.jdbc.driver" value="${db.driverClass}" /> <property name="javax.persis…
tagged with: maven-release-plugin
has comment: http://stackoverflow.com/comment/36652736
tagged with: java
answer count: 0

http://stackoverflow.com/a/23822139
type: Answer
has body: String htmlString=" ... .. ... "; String[] tempData=htmlString.split("<body class=/"temporaryrevision/""); String data = tempData[0]+"bgcolor=/"#FFFFFF/""+tempData[1];
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23822079
answers question: http://stackoverflow.com/q/23822079
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36662731
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23828692
type: Comment
has text: Sorry, it was reformatted by SO. I marked it as code...

http://stackoverflow.com/q/23876868
score: 9
type: Question
has answer: http://stackoverflow.com/a/46011100
has body: I've recently switched to Mac OSX, and when opening a project that I was developing on Windows, I get this error: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-freetype64.dylib' for target: Mac OS X, 64-bit at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115) at com.badlogic.gdx.graphics.g2d.freetype.FreeType.initFreeType(FreeType.java:541) at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.&lt;init&gt;(FreeTypeFontGenerator.java:102) at com.evh98.lithium.ui.Central.load(Central.java:43) at com.evh98.lithium.Lithium.create(Lithium.java:60) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdx-freetype64.dylib at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:124) at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:245) at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:113) ... 6 more Any help would be greatly appreciated, thanks in advance.
answer count: 2
has title: Couldn't load shared library GDX Freetype Mac
favorite count: 0
has answer: http://stackoverflow.com/a/26339218
tagged with: macos
upvote count: 9
type: UnansweredQuestion
downvote count: 0
tagged with: libgdx
tagged with: java

http://stackoverflow.com/q/23914372
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36828831
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36829153
has comment: http://stackoverflow.com/comment/36828425
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/36828892
has body: I'm writing a view for an Eclipse RCP application and am trying to set the display size of tabs in a text input field. The text widget is declared as: Text txtInput; txtInput = new Text(inputHolder, SWT.SINGLE); Trying to set the tabsize (to 4 spaces rather than default 8) using txtInput.setTabs(4); does nothing and looking through the source for the Text widget there is a line to prevent the tabsize being changed for single line widgets. void setTabStops (int tabs) { if ((style &amp; SWT.SINGLE) != 0) return; //rest of code to change tabStopsize } I have tried setting the Text widget to have SWT.MULTI style and the tabsize changes as expected but I do not want a multiline input. What is the reason for the restriction on single line inputs and is there any way around it? Thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/36826376
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23916574
tagged with: swt
has comment: http://stackoverflow.com/comment/36827389
upvote count: 1
has comment: http://stackoverflow.com/comment/36826541
has title: Setting tab size in single line SWT text widget

http://stackoverflow.com/comment/36618194
comment on: http://stackoverflow.com/q/23805470
score: 0
type: Comment
type: QuestionComment
has text: A singleton doesn't (by itself) prevent other instances of the class from being created, it simply assures that one and only one instance will be created using the prescribed singleton access technique. Your (gag) "multiton" has multiple prescribed access techniques.

http://stackoverflow.com/q/23931266
score: 0
has answer: http://stackoverflow.com/a/23932564
linked to: http://stackoverflow.com/q/21766588
answer count: 4
has title: Display Line Numbering by using Checkbox Menu Item
accepted answer: http://stackoverflow.com/a/23932164
tagged with: swing
has answer: http://stackoverflow.com/a/23931533
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23932164
has comment: http://stackoverflow.com/comment/36859551
type: Question
has body: I want to display the Line numbers using checkbox menu Item.I am almost completed this task.But,problem here is Display line numbers whenever press the enter key only rather than check the checkbox menu item.I want to display the line numbers when click the checkbox item itself.Please give me some suggestions... Here is code: public class ViewLineNumbs extends javax.swing.JFrame { int i=0; JTextArea tx,lines; JScrollPane scrollpane; public ViewLineNumbs() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); Create = new javax.swing.JMenuItem(); ViewLineNumbers = new javax.swing.JCheckBoxMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); Create.setText("Create"); Create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CreateActionPerformed(evt); } }); jMenu1.add(Create); ViewLineNumbers.setSelected(true); ViewLineNumbers.setText("ViewLineNumbers"); ViewLineNumbers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ViewLineNumbersActionPerformed(evt); } }); jMenu1.add(ViewLineNumbers); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALU…
possible better answer: http://stackoverflow.com/a/23931533
tagged with: awt
has answer: http://stackoverflow.com/a/23931578

http://stackoverflow.com/comment/37010485
score: 0
has text: I was told to try a reactive mongo driver so I switched to ReactiveMongo (https://github.com/ReactiveMongo/Play-ReactiveMongo) but did not observe any improvement despite my previous message (I only thought it had improved but the database was too poorly populated for the problem to arise). I am completely at a loss and out of ideas now.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23779378

http://stackoverflow.com/comment/36675105
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23828608
has text: I did an exact copy-paste and ended up with: Type mismatch: cannot convert from ObservableList<new Callback<ActionStep,Observable[]>(){}> to ObservableList<ActionStep>. What type is listOfSteps supposed to be ? It is current an ObservableList<ActionStep>.
type: Comment

http://stackoverflow.com/comment/36709449
type: QuestionComment
comment on: http://stackoverflow.com/q/23849944
score: 0
has text: WSO2 Carbon products are released with Neethi 2.0.4 which is compatible with axis2 1.6.1.wso2v10. I believe Neethi 3.x is not compatible with axis2 1.6.1.
type: Comment

http://stackoverflow.com/comment/36773765
comment on: http://stackoverflow.com/a/23886967
type: Comment
has text: more like "you are able to do that specific thing *to* the object"
score: 1
type: AnswerComment

http://stackoverflow.com/q/23859523
type: Question
has answer: http://stackoverflow.com/a/23860535
score: 0
answer count: 2
has title: Server-side validation in Android: asynchronous method called in if statement workaround
tagged with: asynchronous
has answer: http://stackoverflow.com/a/23859759
tagged with: parse-platform
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
tagged with: java
has body: I was using the Parse API and was trying to implement a change password feature when came across this issue. I was trying to validate that the user's current password matches their attempted current password (what the user entered into the EditText). Since the Parse API, doesn't allow access to the user's encrypted password, I'm validating that the user's input matches the current password by trying to log in with the attempted current password and username. If the log in was successful, then the attempted current password is correct. When the change password button is clicked, I check if the attempted current password matches the actual current password: if (mCurrentPassword != null &amp;&amp; passwordsMatch(mCurrentPassword)) { mCurrentPasswordEditText.setError(getString(R.string.error_incorrect_password)); } I created a passwordsMatch(String mAttemptedCurrentPassword) method here: private boolean passwordsMatch(String mCurrentPassword) { HashMap&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("username", mUser.getUsername()); params.put( "attemptedCurrentPassword", mCurrentPassword); ParseCloud.callFunctionInBackground("validateMatchingPasswords", params, new FunctionCallback&lt;Object&gt;() { public void done(Object o, ParseException e) { if (e == null) { // password match (success) } else { // password do not match (failure) } } }); } The above code is incomplete. I have a cloud code function, which tries log the user in and responds with a success or error. I am having trouble finding a workaround because I don't understand threading that well. How can I make the if (passwordsMatch) statement wait for the passwordsMatch method to get a result? Edit: For those unfamiliar to Parse, here is what the ParseCloud.callFunctionInBackground function is doing: It is essentially an AsyncTask. It has a callback FunctionCallback, which implements the done method. The done method is called when ParseCloud.callFunctionInBackground returns a res…

http://stackoverflow.com/a/23891218
answers question: http://stackoverflow.com/q/23891087
downvote count: 0
type: Answer
upvote count: 6
has body: You will not be able to declare class B like you wrote. To create an instance of B you'll need to call A constructor: public abstract class B extends A { public B() { super(10); //or other number } } public class C extends B { public C(int a) { super(); } } In other words, you always call constructor of "previous level", whether the class is abstract or not. In order to avoid this strange number 10 I wrote and missing int parameter of C constructor, I suggest adding to child class constructor at least all parameters parent class constructor requires for any extends pair of classes.
score: 6

http://stackoverflow.com/comment/36907855
type: Comment
has text: When you serialize/deserialize the Object, is the object to be serialiez/deserialized which defines the behavior, not the client, which based on your first paragraph makes the serialization/deserialization process a fine implementation of Prototype, but your conclusion says it isn't.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23941720

http://stackoverflow.com/comment/36740556
type: AnswerComment
comment on: http://stackoverflow.com/a/23852789
has text: yes I have fixed the issue I was basically problem with emulator that it wa leaking it is working pretty much fine in mobile application and I have removed registerReceiver() from onResume() and place it in onCreate()
type: Comment
score: 1

http://stackoverflow.com/comment/36635946
has text: @JimiKimble Maybe you should ask on the Lombok mailing list about the change. I'd suppose it was just a temporary glitch, but according to what you wrote it wasn't. The [changelog](http://projectlombok.org/changelog.html) lets us hope that a new official version is soon to come.
comment on: http://stackoverflow.com/a/23812431
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23914395
has body: Your program is single-threaded, which means that it executes the sequence of "commands" you programmed from top to bottom. For example, in this example setCanPlay(true); play(); //your for loop setCanPlay(false); the setCanPlay(false) instruction will only execute once the for loop has finished executing. What you need is to have the for loop running in the background, and to be able to modify canPlay while the for loop is running. That's called multi-threading and you should lookup the classes Runnable, Task and Service in the java api doc to learn how to implement it. You would end up with something like this: setCanPlay(true); play(); //your for loop, launched in another thread. setCanPlay(false); // Executed while the for loop is running That would start and end the playing instantly. Multithreading is the only way to stop an executing program (from the outside).
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23914034
has comment: http://stackoverflow.com/comment/36827969
has comment: http://stackoverflow.com/comment/36833719
upvote count: 1
score: 1

http://stackoverflow.com/comment/36606647
comment on: http://stackoverflow.com/q/23797033
has text: @SergeBallesta No, `initMethod` and `@PostConstruct` are handled by separate components.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23906737
has comment: http://stackoverflow.com/comment/36813447
favorite count: 0
has comment: http://stackoverflow.com/comment/36813727
has comment: http://stackoverflow.com/comment/36813291
has comment: http://stackoverflow.com/comment/36821608
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/36812299
has comment: http://stackoverflow.com/comment/36812662
has answer: http://stackoverflow.com/a/23907403
downvote count: 1
has comment: http://stackoverflow.com/comment/36813432
has body: I have an application, which I try to build using Maven. I can build a jar, but running it does nothing: it can't find a Main class. I set however the MainClass in the POM. When I try to run the MainPane.class in the target folder from the command line returns: "Error: could not find or load Main class MainPane". (After navigating inside the target folder and run 'java MainPane') I can run this class from Eclipse and it has a main method: public static void main(String[] args) { System.out.println("test"); } I should be able to run the class file in the target folder right? What can possibly go wrong?
tagged with: java
has comment: http://stackoverflow.com/comment/36842298
has comment: http://stackoverflow.com/comment/36813591
has comment: http://stackoverflow.com/comment/36812298
has comment: http://stackoverflow.com/comment/36812312
score: -1
type: Question
upvote count: 0
has title: Can't run compiled java file with main method
has comment: http://stackoverflow.com/comment/36823681
has comment: http://stackoverflow.com/comment/36812598
has comment: http://stackoverflow.com/comment/36812538
answer count: 3
has comment: http://stackoverflow.com/comment/36812832
has comment: http://stackoverflow.com/comment/36820250
has answer: http://stackoverflow.com/a/23907057
has answer: http://stackoverflow.com/a/23909296

http://stackoverflow.com/comment/36744753
comment on: http://stackoverflow.com/q/23871707
type: Comment
type: QuestionComment
has text: Where do you use this code?
score: 0

http://stackoverflow.com/a/23834197
has comment: http://stackoverflow.com/comment/36676181
type: Answer
answers question: http://stackoverflow.com/q/23834131
score: 0
has body: Provide fully qualified name for hibernate configuration mapping file, SessionFactory sF = new Configuration(). configure("/org/manu/dtd/hibernate.cfg.xml").buildSessionFactory();

http://stackoverflow.com/a/23877443
has comment: http://stackoverflow.com/comment/36756849
has comment: http://stackoverflow.com/comment/36756596
type: Answer
has comment: http://stackoverflow.com/comment/36755956
downvote count: 0
has comment: http://stackoverflow.com/comment/36755998
has comment: http://stackoverflow.com/comment/36755692
has comment: http://stackoverflow.com/comment/36755829
score: 2
has body: It seems like you are sending a GET request to /context/NewFile.html. Your web.xml has mapped Servlet1 as handling requests with pattern /*, in other words, everything. So Servlet1 is used to handle the request to /NewFile.html, but it doesn't have a handler method for GET requests, so it responds with a 405.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23877391
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23877391

http://stackoverflow.com/comment/78359470
comment on: http://stackoverflow.com/q/23811543
score: 0
type: Comment
type: QuestionComment
has text: I think anubian already answered in his comment. this seems to be a copied/duplicate question. And yes question is also incomplete.

http://stackoverflow.com/comment/42091586
score: 0
has text: @ViniciusMiana, feel free to edit the answer to add the Scala version, thx
type: Comment
comment on: http://stackoverflow.com/a/23816747
type: AnswerComment

http://stackoverflow.com/comment/36736073
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23866926
type: Comment
has text: but on use of Big Decimal it is giving exponential value. For example on n= 100 it is giving output as 7.888609052210118054117285652827862296732064351090230047702789306640625E-31

http://stackoverflow.com/comment/36734033
has text: Added the stack trace, sorry for the servlet typo.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23864896

http://stackoverflow.com/a/27820111
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23938633
score: 1
answers question: http://stackoverflow.com/q/23938633
upvote count: 1
has body: Spark 1.2.0 depends on hadoop 2.2.0 be default. If you can update your spark dependency to 1.2.0 (or newer) that will solve the problem.

http://stackoverflow.com/comment/36683860
has text: Do you have any suggestions on how i could rewrite my Object model?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23839560
type: Comment

http://stackoverflow.com/a/44781379
upvote count: 11
answers question: http://stackoverflow.com/q/23906736
score: 11
has body: Bouncy Castle actually provides a JSSE implementation as of version 1.56. Just make sure to configure it with a higher priority at the application startup: Security.insertProviderAt(new BouncyCastleJsseProvider(), 1); or, as alternative, in global &lt;JRE_HOME&gt;/lib/security/java.security file: security.provider.1=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider ... security.provider.6=com.sun.net.ssl.internal.ssl.Provider You can use it then with the standard API: SSLContext context = SSLContext.getInstance("TLS");
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/78121887

http://stackoverflow.com/a/23851862
upvote count: 6
answers question: http://stackoverflow.com/q/23851668
downvote count: 0
has body: The string split() method works well if you have a string of multiple numbers separated by spaces. String numbers = "1 23 456"; String[] numbersArray = numbers.split(" "); // splitting string by spaces System.out.println(numbersArray.toString()); // output ["1","23","456"] Then you can use Integer.parseInt() on each index of the array. Hope that helps
type: Answer
score: 6

http://stackoverflow.com/a/23801172
score: 1
has comment: http://stackoverflow.com/comment/36610410
upvote count: 1
answers question: http://stackoverflow.com/q/23800926
has comment: http://stackoverflow.com/comment/36612049
downvote count: 0
has comment: http://stackoverflow.com/comment/36610480
has comment: http://stackoverflow.com/comment/36610287
type: Answer
has body: The lock is on the B-object that is used by A. This object can be anywhere, in my example it is in class A, but it could be passed to A through a parameter of the execute()-method. Imagine this: public class A{ public B objectB; public void execute(){ objectB = new B(); // objectB is synchronized during the execution of the following call, no other // Thread can access ANY synchronized method of objectB or any // synchonized(this) block within objectB in this time objectB.syncedMethod(); } } public class B{ public synchronized void syncedMethod(){ //doImportantStuff } public synchronized void anotherSyncmethod(){ //do other important stuff } } The effect is same like synchronizing on "this" inside the method (I guess the resulting Java bytecode will be different, see comments) public class B{ public void syncedMethod(){ synchronized(this){ //doImportantStuff } } public void anotherSyncmethod(){ synchronized(this){ //do other important stuff } } }
has comment: http://stackoverflow.com/comment/36611650

http://stackoverflow.com/q/23823223
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23823291
favorite count: 0
has title: JSP comments visible to client
upvote count: 3
has answer: http://stackoverflow.com/a/23823291
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36652471
score: 3
has body: I faced an interview and interviewer asked how to write the JSP comments which are visible to client(HTML page). I replied &lt;%-- comment --%&gt; Is there any other way to do this?
tagged with: java
has comment: http://stackoverflow.com/comment/36652506
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23880161
has comment: http://stackoverflow.com/comment/36761131
has comment: http://stackoverflow.com/comment/36784794
has comment: http://stackoverflow.com/comment/36761058
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: collections
tagged with: java
downvote count: 3
has body: In many places Java utilizes the approach to have both, for example, Collection and Collections class. Collection is interface, it defined some methods. Collections class also provide some method. Why didn't they choose to place all methods inside the interface? because the names are too puzzled word. Collection is like Collections. I know the historical reason. like interrupt() and interrupted() , because java must fit to old version, the methods' names are likely, make developer difficult to write and read. But the collection framwork must have reason in this way.
type: Question
has comment: http://stackoverflow.com/comment/36761201
score: -2
has title: Why Java utilizes both Collection and Collections classes to provide different things
has answer: http://stackoverflow.com/a/23880265
answer count: 1

http://stackoverflow.com/q/23904312
tagged with: lucene
score: 0
has body: I've used Lucene 4.0 and I can not find the "term()" method in IndexReader class with Lucene version 4.0. How to read the index? Please help. I want to know the contents (Terms, Term Frequency and so on) of the index file.Thanks.
answer count: 1
has answer: http://stackoverflow.com/a/23948941
has title: How to read lucene 4.0 index with java?
accepted answer: http://stackoverflow.com/a/23948941
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/23871820
upvote count: 1
has comment: http://stackoverflow.com/comment/36825113
has comment: http://stackoverflow.com/comment/36754175
type: Answer
has comment: http://stackoverflow.com/comment/36782632
has comment: http://stackoverflow.com/comment/36775032
downvote count: 1
has body: You are facing the problem of Spurious wakeup.So what is happening that the thread which is notifying the all other thread might be call earlier of other thread and after that other thread will run and wait for the wake up.Because of spurious wake up some thread complete. Change your code... class A{ boolean flag=true; synchronized void waitThread(String threadName){ System.out.println("waiting..."+threadName); try{ while(flag){ wait(); } }catch(InterruptedException e){ } System.out.println("Notified..."+threadName); } synchronized void notifyThread(){ flag=false; notifyAll(); } }
answers question: http://stackoverflow.com/q/23846648
score: 0

http://stackoverflow.com/comment/36726153
has text: You are right - answers to the question referenced above answer mine as well. But I didn't find that other question because I didn't look for its keywords (dog, animal, polymorphic). Maybe others will phrase their search more like I did, so the existence of this question might still be of use to somebody.
score: 0
comment on: http://stackoverflow.com/q/23840887
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23793449
tagged with: getproperty
score: 3
has comment: http://stackoverflow.com/comment/36599184
has comment: http://stackoverflow.com/comment/36596551
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36596377
answer count: 3
has title: Java system.getProperty issue
downvote count: 0
has comment: http://stackoverflow.com/comment/36596347
favorite count: 0
has comment: http://stackoverflow.com/comment/36599370
has answer: http://stackoverflow.com/a/23793706
has comment: http://stackoverflow.com/comment/36596891
has answer: http://stackoverflow.com/a/23811993
has comment: http://stackoverflow.com/comment/36597205
tagged with: macos
has comment: http://stackoverflow.com/comment/36597276
has comment: http://stackoverflow.com/comment/36599512
has answer: http://stackoverflow.com/a/23795379
has body: I found that on my OSX system I have "weird" setup. Java reads my user name as "root" instead of my actual user name. Turns out the code I used uses System.getPropery("user.name") call. So, I made up stand-alone snipped (I save it under test.java) which prints java system user.name property and my UNIX user name environment: class UserName { public static void main(String[] args) { String name; name = System.getProperty("user.name"); System.out.println("user.name="+name); name = System.getenv("USER"); System.out.println("USER="+name); } } if I compile it as javac test.java and then run it (under my account, not root one) as java UserName it prints the following: user.name=root USER=vk My question is where/how java sets user.name and why it is set to root instead of my actual UNIX name. I'm not java expert and don't really know internals of System.getProperty API. The second question is it possible to change this settings somehow in UNIX environment that it will read properly my user name. Finally may be my environment or java configuration is broken and there is some hidden file (properties) which should be fixed.
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/q/23874896
has body: How do I create a property that can accept both a ArrayList&lt;Integer&gt; and ArrayList&lt;String&gt;? I tried setting it as ArrayList&lt;Object&gt; but it doesn't accept either parameters.
has title: Google App Engine Datastore Entity properties with different types
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23876049
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36764382
has comment: http://stackoverflow.com/comment/36751993

http://stackoverflow.com/q/23928945
has answer: http://stackoverflow.com/a/23930935
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23930935
tagged with: cordova
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
has body: Is it possible: to render a Android layout created by native java code into a HTML div using Phonegap? I know about the plugin concepts, but I dont'n know how to pass the layout to the webview to render it per javascript into one div. All I found until now is how to shrink the Phonegap webview layout and add an additional layout. Then the both layouts are shown at the same time, but I would like to display the additional layout in the webview layout and control its position per javascript or css. To render a specific view will also be sufficient, not the whole layout.
tagged with: java
type: Question
has title: Render Android layout into html div

http://stackoverflow.com/a/23884209
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36768567
answers question: http://stackoverflow.com/q/23883976
has comment: http://stackoverflow.com/comment/36768596
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23883976
has comment: http://stackoverflow.com/comment/36768710
has body: You have to change the contextRoot of your application. There is 3 places where you can do that: in a file in the WAR: META-INF/context.xml in TOMCAT_HOME/conf/Catalina/localhost/xxx.xml or in server.xml file but it's better not to change it here. In one of these places, you can add this: &lt;Context path="/" docBase="/TOMCAT_HOME/webapps/yourapp" /&gt;

http://stackoverflow.com/q/23907273
has answer: http://stackoverflow.com/a/23907665
has body: Code:: Object obj=jsonobject.get("results"); the obj contains: [ { "providedLocation": { "latLng": { "lat": 12.931088, "lng": 77.620949 } }, "locations": [ { "latLng": { "lat": 12.931088, "lng": 77.620949 }, "adminArea5Type": "City", "adminArea4": "Bangalore Urban", "adminArea5": "Bangalore", "adminArea4Type": "County", "street": "Sarjapur Road", "adminArea1": "IN", "adminArea3": "Karnataka", "type": "s", "displayLatLng": { "lat": 12.928883, "lng": 77.617502 }, "linkId": 0, "postalCode": "560095", "dragPoint": false, . . . } ] } ] What i am trying to do:: I an trying to extract "Bangalore" from "adminArea5" What i tried:: i tried to use code to convert into json jsonobject = new JSONObject(obj); what i am getting back is {} Question:: Where i am doing wrong ? how to correct myself in code? How to do parsing to this scenario Code i used:: JSONObject jsonobject,jsonobject1; try { HttpClient Client = new DefaultHttpClient(); HttpGet httpget = new HttpGet(Const.URL_JSON_OBJECT.trim()); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); Content = Client.execute(httpget, responseHandler); jsonobject = new JSONObject(Content); //jsonobject1 = (JSONObject)jsonobject.get("results"); Object obj=jsonobject.get("results"); jsonobject = new JSONObject(obj);
has answer: http://stackoverflow.com/a/23907367
possible better answer: http://stackoverflow.com/a/23907338
has answer: http://stackoverflow.com/a/23907338
tagged with: android
accepted answer: http://stackoverflow.com/a/23907665
answer count: 4
type: AnsweredQuestion
has title: Parsing a Nested JSON
has comment: http://stackoverflow.com/comment/36812995
has comment: http://stackoverflow.com/comment/36813096
has answer: http://stackoverflow.com/a/23907434
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
has comment: http://stackoverflow.com/comment/36813359

http://stackoverflow.com/comment/36786627
has text: Folder? Which folder are you talking about?
score: 0
comment on: http://stackoverflow.com/q/23888000
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24883610
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23833656
downvote count: 0
has body: If I understand well, you have 5 tuples in the database, 5 different instances in the map (given that the names are uniques ?) and 15 different instances loaded by JPA, which are equals by groups of 3... I guess this is a problem of Cache Level. It is possible that EclipseLink creates different equal instances for a same tuple while reading if the loaded instances are stored in the Persistence Context Cache - Level 2 (i.e. the EntityManager) - and not the Persistence Unit Cache - Level 1 (i.e. the EntityManagerFactory) . You probably use a different EntityManager for each read operation. In such a case, EclipseLink can not find the previously cached entity. This depends on your application configuration. The problem could also be caused by a memory lack and a weak reference cache. Further explanation is available in the EclipseLink cache documentations page.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23833656

http://stackoverflow.com/a/23780666
has body: The only point in code obfuscation at development time is to check that the obfuscation doesn't break anything. Beside this, the component that manage the obfuscation is the ProGuard: The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security like when you are Licensing Your Applications. To enable it in android studio: Note: When using Android Studio, you must add Proguard to your gradle.build file's build types. For more information, see the Gradle Plugin User Guide. To know more about the ProGuard tool just read the android's documentation :)
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23780578
score: 4
answers question: http://stackoverflow.com/q/23780578

http://stackoverflow.com/q/23911771
has answer: http://stackoverflow.com/a/23912392
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: bufferedimage
has title: Buttom "Save" saves blank canvas
tagged with: java
type: Question
has body: Here is part of the code of my simple graphics editor. This should save the image that I drew, but instead it saves a blank canvas. What did I do wrong? BufferedImage bi = new BufferedImage(center.getWidth(), center.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g2 = bi.createGraphics(); center.printAll(g2); g2.dispose(); JFileChooser jfc = new JFileChooser(); int ret = jfc.showDialog(null, "Save file"); if (ret == JFileChooser.APPROVE_OPTION) { File outputFile = jfc.getSelectedFile(); ImageIO.write(bi, "BMP", outputFile);
tagged with: canvas
answer count: 1
downvote count: 0
tagged with: applet
favorite count: 0

r.java-file
tags question: http://stackoverflow.com/q/23931732
type: Tag
tags question: http://stackoverflow.com/q/23858072
tag name: r.java-file
tags question: http://stackoverflow.com/q/23917900

http://stackoverflow.com/comment/36583961
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787170
has text: You're adding `1` to `i` twice with post-increment. `k` never matters here.

http://stackoverflow.com/q/23853363
has comment: http://stackoverflow.com/comment/37122848
has comment: http://stackoverflow.com/comment/37254221
has comment: http://stackoverflow.com/comment/36727845
has comment: http://stackoverflow.com/comment/37145868
accepted answer: http://stackoverflow.com/a/24143218
favorite count: 0
has comment: http://stackoverflow.com/comment/37128773
linked to: http://stackoverflow.com/q/13545351
tagged with: android
has comment: http://stackoverflow.com/comment/37124168
upvote count: 6
has title: Buildozer doesn't work with java under cygwin
tagged with: build
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24098467
tagged with: java
has comment: http://stackoverflow.com/comment/37126914
has body: I'm trying to buildozer android debug deploy in my cygwin environment. So far it worked quite well, but upon trying to build, I run into the following error: $ buildozer android debug deploy # Check configuration tokens # Ensure build layout # Check configuration tokens # Preparing build # Check requirements for android Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 92, in check_requirements self._set_win32_java_home() File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 186, in _set_win32_java_home import _winreg ImportError: No module named _winreg # Install platform # Apache ANT found at /home/Data/.buildozer/android/platform/apache-ant-1.8.4 # Android SDK found at /home/Data/.buildozer/android/platform/android-sdk-21 # Android NDK found at /home/Data/.buildozer/android/platform/android-ndk-r9c 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 You can find the complete Android SDK requirements here: http://developer.android.com/sdk/requirements.html # Android packages installation done. # Check application requirements # Check garden requirements # Compile platform # Command failed: ./distribute.sh -m "kivy" -d "first_kivy_test" What is funny, is that if I do java -version in cygwin it returns java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) so cygwin does know java. What am I missing here? EDIT: Ok, I've tried to do the following in the android.py file of buildozer on line 92: import cygwinreg as _winreg But that just gave me the following error instead of the _winreg not recognized: Traceback (most recent…
tagged with: winreg
has answer: http://stackoverflow.com/a/24098467
linked to: http://stackoverflow.com/q/1906445
linked to: http://stackoverflow.com/q/3052743
has comment: http://stackoverflow.com/comment/37149612
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24143218
score: 5
tagged with: cygwin
answer count: 2

http://stackoverflow.com/a/23853425
has comment: http://stackoverflow.com/comment/36710385
has comment: http://stackoverflow.com/comment/36710428
type: AcceptedAnswer
downvote count: 0
has body: try this : public List&lt;String&gt; customPrefixes(PermissionUser u) { List&lt;String&gt; returnlist = new ArrayList&lt;String&gt;(); for (String k : u.getAllPermissions().keySet()) { List&lt;String&gt; perms = (List&lt;String&gt;)(u.getAllPermissions()).get(k); for (String s : perms) { String[] split = s.split("."); if ((split.length &gt;= 3) &amp;&amp; (split[0].equalsIgnoreCase("plugin")) &amp;&amp; (split[1].equalsIgnoreCase("prefix"))) { returnlist.add(split[2]); } } } return returnlist; } You were missing "&lt;String&gt;" in the List declaration
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/36710516
has comment: http://stackoverflow.com/comment/36710526
upvote count: 11
answers question: http://stackoverflow.com/q/23853404
has comment: http://stackoverflow.com/comment/36710407
has comment: http://stackoverflow.com/comment/36710502
has comment: http://stackoverflow.com/comment/36710564
accepted answer of: http://stackoverflow.com/q/23853404

http://stackoverflow.com/comment/36784794
has text: i have reword my question, and i think i find a reason. because some methods are not born to a kind of class. and in some case method must use instance, only class can not support.like the asLifoQueue() in Collections, must have an instance
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23880161
score: 0

http://stackoverflow.com/comment/36681384
has text: Java has a documentation feature called Javadoc. Look up the javadoc of the `Thread` class and read what `join()` does.
comment on: http://stackoverflow.com/q/23838102
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36683904
type: Comment
comment on: http://stackoverflow.com/q/23839593
type: QuestionComment
has text: You need to increment `location++;` after calling `currentArtist = myArray[location];`, otherwise you'll end up with an index that is out of bounds (as the error suggests). Also don't compare String values using `==`.
score: 4

http://stackoverflow.com/q/23792823
tagged with: jpanel
has comment: http://stackoverflow.com/comment/36595565
has answer: http://stackoverflow.com/a/23793001
accepted answer: http://stackoverflow.com/a/23793001
linked to: http://stackoverflow.com/q/7229226
upvote count: 1
tagged with: graphics2d
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36595392
has comment: http://stackoverflow.com/comment/36594788
has comment: http://stackoverflow.com/comment/36595101
has body: I am new to swing and I have been following the tutorials at the Oracle website. So I have an imagePanel class using which, I paint an image onto a JPanel. Next, I need to draw shapes over this image. So I call the drawShapes function in the paintComponent method of the imagePanel class. The issue that I am facing is, whenever I draw any shape say rect or oval it doesnt not draw the shape according to the position I specify for the y-axis. It only takes the x-axis into account. So ideally, fillOval(30,70,10,10) is tantamount to fillOval(30,30,10,10) Am i doing something wrong or is there some way to overcome this? public class ImagePanel extends JPanel { private Image img; public ImagePanel(String loc) { this(new ImageIcon(loc).getImage()); } public ImagePanel(Image img) { this.img = img; Dimension size = new Dimension(img.getWidth(null), img.getHeight(null)); setPreferredSize(size); setMinimumSize(size); setMaximumSize(size); setSize(size); setLayout(null); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, 0, 0, null); renderShapes(g); } private void renderShapes(g){ Graphics2D g2d = (Graphics2D)g; g2d.fillOval(20,70,10,10); g2d.fillRect(120,40,10,10); } } EDIT The renderShapes method for the screenshot provided is posted below. private void renderShapes(g){ Graphics2D g2d = (Graphics2D)g; g2d.fillRect(220,50,10,10); g2d.fillRect(20,140,10,10); }
has comment: http://stackoverflow.com/comment/36595671
favorite count: 0
has comment: http://stackoverflow.com/comment/36595535
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36595453
score: 1
has comment: http://stackoverflow.com/comment/36595518
tagged with: swing
linked to: http://stackoverflow.com/q/23714810
type: Question
has comment: http://stackoverflow.com/comment/36595600
has comment: http://stackoverflow.com/comment/36595657
tagged with: java
has comment: http://stackoverflow.com/comment/36595067
has title: Drawing shapes over an ImagePanel

http://stackoverflow.com/q/23783404
has answer: http://stackoverflow.com/a/23783833
has comment: http://stackoverflow.com/comment/36655015
type: Question
accepted answer: http://stackoverflow.com/a/23783833
tagged with: spring-security
score: 0
has title: Programmatically login user in Spring Security in a Filter
has comment: http://stackoverflow.com/comment/36577721
answer count: 1
tagged with: servlet-filters
tagged with: spring
type: AnsweredQuestion
tagged with: java
has body: I am trying to implement a filter to programmatically login a user based on certain criteria. This is my filter-method: public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; Cookie[] cookies = request.getCookies(); boolean typo3loggedin = true; String memberNo = "100003"; HttpRequestResponseHolder holder = new HttpRequestResponseHolder(request, response); SecurityContext securityContext = contextRepository.loadContext(holder); Authentication authentication = securityContext.getAuthentication(); if (cookies != null &amp;&amp; cookies.length &gt; 0 ) { for (int i = 0; i &lt; cookies.length; i++) { String name = cookies[i].getName(); String value = cookies[i].getValue(); if (name.equalsIgnoreCase("fe_typo_user")) typo3loggedin = true; // logger.debug(String.format("cookie-name: %s, cookie-value: %s", name, value)); } } if (typo3loggedin &amp;&amp; (authentication == null || !authentication.isAuthenticated())) { List&lt;GrantedAuthority&gt; grantedAuths = new ArrayList&lt;GrantedAuthority&gt;(); grantedAuths.add(new SimpleGrantedAuthority("ROLE_USER")); if (authentication == null ) authentication = new UsernamePasswordAuthenticationToken(memberNo, "", grantedAuths); securityContext.setAuthentication(authentication); contextRepository.saveContext(securityContext, request, response); logger.debug("Logged-in from typo3 as user " + memberNo); } filterChain.doFilter(servletRequest, servletResponse); } But whenever I try to save the Authentication, I get the following error: java.lang.ClassCastException: org.mortbay.jetty.Response cannot be cast to org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper at org.springframework.security.web.context.HttpSessionSecurityContextRepository.saveContext(HttpSessionSecurityContextRe…

http://stackoverflow.com/a/23881066
has body: You must qualify the allocation with an enclosing instance of type Boss. Boss we = new Boss("asdf","sdfsdf","sdfsdf","sdfsdf","sdfsdfs",232,235); we.fullAddress(); Worker ww = we.new Worker("asdf", "sdfsdf", "sdfsdf", "sdfsdf", "sdfsdfs", 232, 235, "sdfs"); ww.fullAddress();
type: Answer
answers question: http://stackoverflow.com/q/23880709
score: 0

http://stackoverflow.com/comment/36651355
has text: @OlegEstekhin, I know `NullPointerException` but this is different case.
comment on: http://stackoverflow.com/q/23822507
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23936757
downvote count: 0
has body: I assume you have an array of String and a Map of map. Now you want to search the value fields of inner map against the array of String and if make a new string array with matching values. If that is the case the below program will help you.. import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class InnerMapSearch { public static void main(String[] args) { Map&lt;String, HashMap&lt;String, String&gt;&gt; outer_map = new HashMap&lt;String, HashMap&lt;String, String&gt;&gt;(); Map&lt;String, String&gt; inner_map = new HashMap&lt;String, String&gt;(); String[] searchParams = {"blabla1", "blabla3", "blabla20"}; //Populating the map int reader = 1; while (reader &lt; 10) { String nameAsKey1 = "blabla" + reader; // value1 inner_map.put("name", nameAsKey1); String surnameAsKey2 = "blabla" + reader; // value2 inner_map.put("surname", surnameAsKey2); outer_map.put(String.valueOf(reader), (HashMap&lt;String, String&gt;) inner_map); inner_map = new HashMap&lt;String, String&gt;(); reader++; } //Searching Set&lt;String&gt; searchResults = new HashSet&lt;String&gt;(); // Using set to avoid duplicate // Iterate over the outer map for(String key : outer_map.keySet()){ // Iterate through each inner_map value of outer map for(Entry&lt;String, String&gt; innerEntry : outer_map.get(key).entrySet()){ // Iterate through the list of search params and see if its present in inner_hashmap for(String searchParam : searchParams){ if(searchParam.equals(innerEntry.getValue())){ // The search parameter is in inner map so adding to result. searchResults.add(searchParam); } } } } // Converting the list to an array. String[] searchResultsArray = searchResults.toArray(new String[searchResults.size()]); } }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23842117
has comment: http://stackoverflow.com/comment/36884691
accepted answer of: http://stackoverflow.com/q/23842117
type: AcceptedAnswer

http://stackoverflow.com/q/23835814
has title: HTTPSURLConnection failed on Java 7 update 51
accepted answer: http://stackoverflow.com/a/23914825
type: Question
has comment: http://stackoverflow.com/comment/36825371
answer count: 1
has body: My Java application runs through Java web start and I'm downloading a file from a web server using browser's session ID. It works fine on previous to Java 7 update 51 but failed on Java 7 update 51. Here is the code. There is no issue on HTTP URL. Problem only occurs with HTTPSURL. When Java application makes connection with the HTTPS URL, web server not considering URL as a valid URL. URL webURL = new URL(m_url); conn = webURL.openConnection(); conn.setRequestProperty("Cookie", cookie); Cookie has valid session ID. Again this works fine on Prior to Java 7 update 51. Anything has changed on Java 7 update 51 related to HTTPS URL Connection? It seems to be Java Web start sends empty HTTPS request before sending actual HTTPS request. Again this happens only after Java 7 update 51.
tagged with: httpsurlconnection
has answer: http://stackoverflow.com/a/23914825
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/23873297
has comment: http://stackoverflow.com/comment/36748719
has comment: http://stackoverflow.com/comment/36749405
has body: Added quotations for string comparisons, default value for java_version, error catch, and simplified if statement. Try this. set "java_version=0" for /f "tokens=3" %%C in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /v Java7FamilyVersion 2^&gt;nul') do set "java_version=%%C" if not "%java_version%"=="1.7.0_55" goto install exit :install msiexec.exe /I "%~DP0jre1.7.0_55.msi" /q /norestart /L "%windir%\log\Oracle_SUN_JAVA7_SE_Up55_DE_x86_0253_Install.log"
has comment: http://stackoverflow.com/comment/36749335
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23873014
accepted answer of: http://stackoverflow.com/q/23873014
type: Answer
has comment: http://stackoverflow.com/comment/36748768
downvote count: 0
score: 1

http://stackoverflow.com/comment/36683079
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23838828
has text: @DougHauf the code have some server-side part , so it may not work in ur IDE , u can replace "listmateriel" by some single jradiobutton

http://stackoverflow.com/comment/36860819
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23931935
score: 0
has text: Whereas Arrays are good for traversing, adding data at the end and getting element from a specific location. If you add or remove element from the middle it will shift all the elements after that location.

http://stackoverflow.com/comment/36668651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23831198
has text: running it in debug mode i inserted a breakpoint under game = gamePnl.game; when it reaches the instance of this in my main class the debugger shows "Debugger stopped on uncompilable source code."
score: 0

http://stackoverflow.com/comment/36681185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23838208
has text: Should I edit the question?
score: 0

http://stackoverflow.com/q/23792449
has title: Assign a reference to a `Function` using Reflection
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23792612
tagged with: java
possible better answer: http://stackoverflow.com/a/23792536
has answer: http://stackoverflow.com/a/23792536
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23792612
has body: With Java 8 it's now possible to get a reference to a method as a first class object using the :: syntax like this: Map&lt;Integer, String&gt; strings = new HashMap&lt;&gt;(); ... Function&lt;Integer, String&gt; get = strings::get; ... How do I achieve the same assignment using reflection (as opposed to coding it as shown)?
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/23867211
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23865063
score: 1
answers question: http://stackoverflow.com/q/23865063
has body: It seems you have added the javax api dependency to the jboss-deployment-structure.xml of your deployment, but if you look at your exception message: ClassNotFoundException: javax.naming.NamingException from [Module "de.foo.soa.myfoo.modules:main" it is missing from "de.foo.soa.myfoo.modules" module, not from your deployment. The modules module.xml file is where you need to add the dependency.
type: AcceptedAnswer

http://stackoverflow.com/comment/36676444
type: Comment
has text: There is available() function on the stream
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23835839

http://stackoverflow.com/comment/36655786
comment on: http://stackoverflow.com/q/23817619
has text: Also note that JDBC disallows scrolling on a `FORWARD_ONLY` resultset, but maybe MySQL upgrades to a scrollable result set as it is cached anyway by default.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36633486
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23812609
has text: Problem spotted: `Price = Float.parseFloat(request.getParameter("Price"));`. You will get a `NullPointerException` if trying to parse a `null` argument.
score: 0

http://stackoverflow.com/q/23792020
tagged with: android
has title: bug inserting fifth item to hashmap in java
has answer: http://stackoverflow.com/a/23792145
favorite count: 0
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
accepted answer: http://stackoverflow.com/a/23792145
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36593262
has comment: http://stackoverflow.com/comment/36593598
has body: i have a wired bug, HashMap map =new HashMap&lt;String, String&gt; () i add items to map, (map start with size 2) table HashMap$HashMapEntry[2] (id=830028484912) [0] null [1] null after adding 2 items map growth to 4 and looks like table HashMap$HashMapEntry[4] (id=830055921064) [0] HashMap$HashMapEntry (id=830055921104) [1] null [2] HashMap$HashMapEntry (id=830055922960) [3] null after adding 2 more items (total 4) it look like table HashMap$HashMapEntry[4] (id=830055921064) [0] HashMap$HashMapEntry (id=830055921104) [1] HashMap$HashMapEntry (id=830055930192) [2] HashMap$HashMapEntry (id=830055922960) [3] HashMap$HashMapEntry (id=830055933488) after adding the fifth item it should grow to 8 and contain 5 items, but it contain only 4 table HashMap$HashMapEntry[8] (id=830055946352) [0] null [1] HashMap$HashMapEntry (id=830055930192) [2] HashMap$HashMapEntry (id=830055922960) [3] HashMap$HashMapEntry (id=830055946408) [4] HashMap$HashMapEntry (id=830055921104) [5] null [6] null [7] null i insert items using put, when all keys and value are different, i found a solution but it a bad one, reconfigure the hash map to start with more items then i put, for example in this case any item over 5 will fit, however i make it s a part of an infrastructure and i don't want to limit it, i want it to grow when needed.

http://stackoverflow.com/q/23874131
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36749075
has answer: http://stackoverflow.com/a/23874350
has body: Let's say you have an HTML Online Form where you have to Register to vote: &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; First name: &lt;input type="text" name="firstname"&gt;&lt;br&gt; Last name: &lt;input type="text" name="lastname"&gt;&lt;br&gt; Address: &lt;input type="text" name="address"&gt;&lt;br&gt; City: &lt;input type="text" name="city"&gt;&lt;br&gt; State: &lt;input type="text" name="state"&gt;&lt;br&gt; Zip: &lt;input type="text" name="zip"&gt;&lt;br&gt; Phone Number: &lt;input type="text" name="phone"&gt;&lt;br&gt; Affiliation:&lt;br&gt; &lt;input type="radio" name="affil" value="demo"&gt;Democrat&lt;br&gt; &lt;input type="radio" name="affil" value="green"&gt;Green Party&lt;br&gt; &lt;input type="radio" name="affil" value="liber"&gt;Liberterian&lt;br&gt; &lt;input type="radio" name="affil" value="repub"&gt;Republican&lt;br&gt; &lt;input type="radio" name="affil" value="None"&gt;Unafiiliated&lt;br&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; I want to make it so when you click submit a Response page that shows the user a summary of what they posted Example: First Name: [Value] Last Name: [Value] etc. I want to use Java Servlet to do this. However, while I've programmed in Java before I don't have any experience with Servlets and I'm confused on how to start. So the main tasks I THINK I have to do are 1.Create a Java file. 2.Use HTTPApplets? 3.Make it so the HTML references the Java file in some way. 4.Have the Java (Servlet) show values based on what's passed in. As said, I'm just not sure how to start. Any help would be great, thanks.
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36748977
tagged with: java
score: -1
tagged with: servlets
type: Question
favorite count: 0
has title: Using Java Servlet as a Response Page to an HTML form?
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/36804036
type: AnswerComment
type: Comment
has text: I think the Image is loading because I try taking out the G at the end of PNG and the cursor just disappears all together. I will try to see if that works. Thanks
comment on: http://stackoverflow.com/a/23902201
score: 0

http://stackoverflow.com/comment/36825412
score: 0
has text: Here I am using a third party libraries which actually using Spring.
comment on: http://stackoverflow.com/q/23913684
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23911116
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23780515
answers question: http://stackoverflow.com/q/23780515
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The best solution I found for this problem does include parsing the URL to parts, but at least it's done using the java.net.URL Java library. java.net.URL does not have a function to escape special chars. java.net.URI, which does have such functionality, won't accept un-escaped square brackets in the URL path. The following solution combines the two to solve the problem: URL url = new URL(urlString); URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); String escapedURL = uri.toString();

http://stackoverflow.com/a/23860674
has comment: http://stackoverflow.com/comment/36725254
upvote count: 3
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23860661
has body: The problem is that you are not specifying the instance that PrintList is to be called on. To fix that, change this: PrintList(); // what is wrong here? to this: s.PrintList();

http://stackoverflow.com/a/23822042
answers question: http://stackoverflow.com/q/23821792
has body: String your_format_date=sdf.format(pickUpDate); System.out.println("pick Up Date " + your_format_date);
type: Answer
score: 0

http://stackoverflow.com/comment/36613328
type: QuestionComment
comment on: http://stackoverflow.com/q/23802550
has text: Could you post your UserSearchDAO class and stacktrace? Did you remember about using all necesarry ejb annotations?
score: 0
type: Comment

http://stackoverflow.com/comment/36714122
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23855065
has text: Do you get an error message also, and not just the procedure call where the error is? And what happens if you try to load the FXML that includes the custom control?

android
tags question: http://stackoverflow.com/q/23857730
tags question: http://stackoverflow.com/q/23829935
tags question: http://stackoverflow.com/q/23792840
tags question: http://stackoverflow.com/q/23850157
tags question: http://stackoverflow.com/q/23866937
tags question: http://stackoverflow.com/q/23896723
tags question: http://stackoverflow.com/q/23940071
tags question: http://stackoverflow.com/q/23850664
tags question: http://stackoverflow.com/q/23872458
tags question: http://stackoverflow.com/q/23899328
tags question: http://stackoverflow.com/q/23828085
tags question: http://stackoverflow.com/q/23870408
tags question: http://stackoverflow.com/q/23913762
tags question: http://stackoverflow.com/q/23883518
tags question: http://stackoverflow.com/q/23828349
tags question: http://stackoverflow.com/q/23818101
tags question: http://stackoverflow.com/q/23823044
tags question: http://stackoverflow.com/q/23896302
tags question: http://stackoverflow.com/q/23841113
tags question: http://stackoverflow.com/q/23843701
tags question: http://stackoverflow.com/q/23900697
tags question: http://stackoverflow.com/q/23796576
tags question: http://stackoverflow.com/q/23899281
tags question: http://stackoverflow.com/q/23794428
tags question: http://stackoverflow.com/q/23868662
tags question: http://stackoverflow.com/q/23905729
tags question: http://stackoverflow.com/q/23892710
tags question: http://stackoverflow.com/q/23893761
tags question: http://stackoverflow.com/q/23898245
tags question: http://stackoverflow.com/q/23839604
tags question: http://stackoverflow.com/q/23816608
tags question: http://stackoverflow.com/q/23789439
tags question: http://stackoverflow.com/q/23930117
tags question: http://stackoverflow.com/q/23843055
tags question: http://stackoverflow.com/q/23788077
tags question: http://stackoverflow.com/q/23899900
tags question: http://stackoverflow.com/q/23846723
tags question: http://stackoverflow.com/q/23858203
tags question: http://stackoverflow.com/q/23804887
tags question: http://stackoverflow.com/q/23924827
tags question: http://stackoverflow.com/q/23839175
tags question: http://stackoverflow.com/q/23837847
tags question: http://stackoverflow.com/q/23894373
tags question: http://stackoverflow.com/q/23798341
tags question: http://stackoverflow.com/q/23902518
tags question: http://stackoverflow.com/q/23929873
tags question: http://stackoverflow.com/q/23836393
tags question: http://stackoverflow.com/q/23825143
tags question: http://stackoverflow.com/q/23920150
tags question: http://stackoverflow.com/q/23930216
tags question: http://stackoverflow.com/q/23915568
tags question: http://stackoverflow.com/q/23905546
tags question: http://stackoverflow.com/q/23812169
tags question: http://stackoverflow.com/q/23880813
tags question: http://stackoverflow.com/q/23783496
tags question: http://stackoverflow.com/q/23802043
tags question: http://stackoverflow.com/q/23792471
tags question: http://stackoverflow.com/q/23851201
tags question: http://stackoverflow.com/q/23829509
tags question: http://stackoverflow.com/q/23877330
tags question: http://stackoverflow.com/q/23833326
tags question: http://stackoverflow.com/q/23843963
tags question: http://stackoverflow.com/q/23940484
tags question: http://stackoverflow.com/q/23811989
tags question: http://stackoverflow.com/q/23785383
tags question: http://stackoverflow.com/q/23877694
tags question: http://stackoverflow.com/q/23921020
tags question: http://stackoverflow.com/q/23841213
tags question: http://stackoverflow.com/q/23805016
tags question: http://stackoverflow.com/q/23887739
tags question: http://stackoverflow.com/q/23895693
tags question: http://stackoverflow.com/q/23864440
tags question: http://stackoverflow.com/q/23856841
tags question: http://stackoverflow.com/q/23928279
tags question: http://stackoverflow.com/q/23841976
tags question: http://stackoverflow.com/q/23888941
tags question: http://stackoverflow.com/q/23809849
tags question: http://stackoverflow.com/q/23904821
tags question: http://stackoverflow.com/q/23903733
tags question: http://stackoverflow.com/q/23883106

http://stackoverflow.com/q/23805263
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23805636
has comment: http://stackoverflow.com/comment/36655085
has body: I am trying to upgrade to Akka 2.3.2 using java 1.6. So i got this kind of exception. I have tried to add the scala-library jar file and the typesafe conf jar file but I still get this exception.. can anyone please advise me on how to fix this problem.Thanx java.lang.NoSuchMethodException: akka.cluster.ClusterActorRefProvider.&lt;init&gt;(java.lang.String, akka.actor.ActorSystem$Settings, akka.event.EventStream, akka.actor.DynamicAccess) at java.lang.Class.getConstructor0(Class.java:2715) at java.lang.Class.getDeclaredConstructor(Class.java:1987) at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$2.apply(DynamicAccess.scala:76) at scala.util.Try$.apply(Try.scala:161) at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:73) at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84) at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84) at scala.util.Success.flatMap(Try.scala:200) at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84) at akka.actor.ActorSystemImpl.liftedTree1$1(ActorSystem.scala:584) at akka.actor.ActorSystemImpl.&lt;init&gt;(ActorSystem.scala:577) at akka.actor.ActorSystem$.apply(ActorSystem.scala:141) at akka.actor.ActorSystem$.apply(ActorSystem.scala:118) at akka.actor.ActorSystem$.create(ActorSystem.scala:66) at akka.actor.ActorSystem.create(ActorSystem.scala) at com.indaba.processor.singletons.ClusterActorSystemSingleton.createActorSystem(ClusterActorSystemSingleton.java:65) at com.indaba.processor.singletons.ClusterActorSystemSingleton.getActorSystem(ClusterActorSystemSingleton.java:42) at com.indaba.processor.frontend.eventProcessingService.SubmitEvent(eventProcessingService.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23805636
type: Question
tagged with: java
has title: java.lang.NoSuchMethodException: akka.cluster.ClusterActorRefProvider

http://stackoverflow.com/a/23843762
has comment: http://stackoverflow.com/comment/36691523
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23843726
upvote count: 1
has body: I guess you got NPE. You need to remove this lines str1 = et1.getText().toString(); str2 = et2.getText().toString(); It's because you're trying to getText() from EditText and there is no Text in it. So i would suggest you move this lines under some Listener events where you get values after you set value in your EditText. You implement like @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.b1: str1 = et1.getText().toString(); str2 = et2.getText().toString(); tv2.setText(str1); }}

http://stackoverflow.com/q/23872082
score: 1
tagged with: java
upvote count: 1
tagged with: actor
has title: LibGDX actor doesn't show
type: Question
tagged with: libgdx
answer count: 2
has answer: http://stackoverflow.com/a/23872230
downvote count: 0
tagged with: button
favorite count: 0
has body: I have a problem with buttons and labels. I have following code in Create method: Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage = new Stage(new ScreenViewport()); atlas = new TextureAtlas("buttons/btnplay.pack"); font = new BitmapFont(); skin = new Skin(atlas); Table table = new Table(skin); table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); TextButtonStyle style = new TextButtonStyle(); style.up = skin.getDrawable("btndown"); style.down = skin.getDrawable("btndown"); style.font = font; TextButton btnPlay = new TextButton("DELAASDASDSAD",style); btnPlay.setPosition(100, 100); btnPlay.setWidth(100); btnPlay.setHeight(100); btnPlay.background(skin.getDrawable("btnup")); table.add(btnPlay); stage.addActor(btnPlay); And in rendering method: stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); Now the problem is that button or label doesn't show on screen and i don't see reason why. Any suggestion?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23884754

http://stackoverflow.com/q/23920284
accepted answer: http://stackoverflow.com/a/23921381
has title: Spring 2.5 Form Validation Errors found in Validator Implementation don't update View <form:error/> tags
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36838912
has comment: http://stackoverflow.com/comment/36838867
score: 0
tagged with: validation
has body: For reference, I have been largely using this: http://www.mkyong.com/spring-mvc/spring-mvc-form-handling-example/ Basically, I have a class called EJournalValidator.java: package com.blah.blah.validator; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import com.blah.blah.EJournalForm; public class EJournalValidator implements Validator{ public boolean supports(Class clazz) { return EJournalForm.class.isAssignableFrom(clazz); } public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "strStartDate", "ejournal.strStartDate", "Field name is required."); } } It is mapped to the controller in my servlet.xml which contains some important aspects in my spring 2.5 beans list: /WEB-INF/messages/message It validates the search criteria in my form, represented by our model .java file and a controller for form load and submission (for us showForm() and handleRequest()). The trouble is, my view doesn't seem to get updated where my tag is in my .jsp: <form:input id="strStartDate" path="strStartDate"/> <form:errors path="strStartDate" cssClass="error" /> Unfortunately, even though I know an error is flagged appropriately when I submit null for this field via a break point in my EJournalValidator.java file, the error isn't updated in the view. Any idea why that might be? Some say if you redirect using something like: return "redirect:/spring/person/list"; Then that can cause something like this, but that doesn't seem to be the case here. In debugging, these were errors found if I put a breakpoint in my validate method of EJournalValidator.java and inspected the errors variable when I try to submit blank in the field I'm checking: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'ej' on field 'strStartDate': rejected value []; codes [ejournal.strStartD…
has comment: http://stackoverflow.com/comment/36839246
has answer: http://stackoverflow.com/a/23921381
has comment: http://stackoverflow.com/comment/36838158
has comment: http://stackoverflow.com/comment/36838113
has comment: http://stackoverflow.com/comment/36838379
has answer: http://stackoverflow.com/a/23935188
tagged with: spring
has comment: http://stackoverflow.com/comment/36838063
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36866710
has comment: http://stackoverflow.com/comment/36838218
possible better answer: http://stackoverflow.com/a/23935188
tagged with: java
tagged with: forms

recursion
type: Tag
tags question: http://stackoverflow.com/q/23844874
tags question: http://stackoverflow.com/q/23837218
tags question: http://stackoverflow.com/q/23876368
tags question: http://stackoverflow.com/q/23902842
tag name: recursion
tags question: http://stackoverflow.com/q/23833934
tags question: http://stackoverflow.com/q/23832109
tags question: http://stackoverflow.com/q/23816769
tags question: http://stackoverflow.com/q/23812349
tags question: http://stackoverflow.com/q/23869016
tags question: http://stackoverflow.com/q/23785536
tags question: http://stackoverflow.com/q/23852798
tags question: http://stackoverflow.com/q/23854328
tags question: http://stackoverflow.com/q/23932519
tags question: http://stackoverflow.com/q/23860046

http://stackoverflow.com/q/23811160
has comment: http://stackoverflow.com/comment/36629181
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36629225
duplicate of: http://stackoverflow.com/q/4138827
favorite count: 0
has body: For the program I need to write, I have to make sure that the user gives me a five-digit number which is in the form of a palindrome. The program must check to make sure that the number is a palindrome, and if it is not, that it gives an error. Does anyone have any idea how to do something like that? I am using Eclipse, if it helps. Mostly, I just need help making sure that the number given to the program is only five digits, no more and no less.
has title: How to ask the user for a five-digit input in Java?
has answer: http://stackoverflow.com/a/23811221
has answer: http://stackoverflow.com/a/23811290
type: UnansweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36629936
has comment: http://stackoverflow.com/comment/36629184
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36629286
tagged with: eclipse
linked to: http://stackoverflow.com/q/4138827

http://stackoverflow.com/q/23913381
tagged with: asp.net
favorite count: 0
has answer: http://stackoverflow.com/a/23913661
has answer: http://stackoverflow.com/a/23913975
tagged with: android
linked to: http://stackoverflow.com/q/4369537
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23913754
tagged with: multithreading
has answer: http://stackoverflow.com/a/23913730
has body: So, on a button click, I create a new thread and then I am sending data to an asp.net script and after sending the data, I am "clearing" the EditText field. But, after I send the data, the textview is not cleared and the app freezes and sometimes crashes. Here is my Activity code: http://www.mstreetllc.com/Lab.asp package com.example.testphp; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import java.util.ArrayList; import java.util.List; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.message.BasicNameValuePair; // import everything you need import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { Button sendButton; EditText msgTextField; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // load the layout setContentView(R.layout.fragment_main); // make message text field object msgTextField = (EditText) findViewById(R.id.msgTextField); // make send button object sendButton = (Button) findViewById(R.id.sendButton); sendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Thread thread = new Thread(new Runnable(){ @Override public void run() { try { // get the message from the message text box String msg = msgTextField.getText().toString(); // make sure the fields are not empty if (msg.length() &gt; 0) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.mstreetllc.com/Lab.asp"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair…
downvote count: 1
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36824421
has answer: http://stackoverflow.com/a/23913691
linked to: http://stackoverflow.com/q/9884246
has title: Android app freezes/crashed when sending data in a new thread on button click
upvote count: 0

http://stackoverflow.com/q/23940208
has comment: http://stackoverflow.com/comment/36878418
tagged with: java
linked to: http://stackoverflow.com/q/3856767
has answer: http://stackoverflow.com/a/23942191
upvote count: 2
has answer: http://stackoverflow.com/a/23940301
answer count: 3
has comment: http://stackoverflow.com/comment/36878331
linked to: http://stackoverflow.com/q/16274988
has comment: http://stackoverflow.com/comment/36874744
favorite count: 0
tagged with: foreground
has comment: http://stackoverflow.com/comment/36875839
has title: How can I create an android service that dalvik will not kill?
tagged with: android
has comment: http://stackoverflow.com/comment/36878270
has answer: http://stackoverflow.com/a/23941631
tagged with: service
accepted answer: http://stackoverflow.com/a/23941631
has body: Before I begin my question, I want to preface this with: I KNOW IT'S A BAD IDEA TO FORCE A SERVICE TO RUN FOREVER... I simply do not care. This application is not for consumer use. It is not going on the app store. It is for my use only. Alright, well I have this unused HTC Sensation running 4.0.3 (ICS) sitting around, and I have volunteered it to a local theatre for a task. The task is for it to ring on cue whenever it is needed in the show. We don't want a sim card in it because someone might accidentally call the phone during the show when it is not supposed to ring. So I created a fake phone application that receives a signal via TCP from a server that I have set up to send signals to devices over the LAN. Right now I have the listener running in an infinite loop in a service. I am, however, still experiencing the service not responding to the TCP signals. I would really appreciated it if some android guru's could give me some hints/tips for making this service as reliable as possible, good/bad coding techniques aside I want to do everything possible to make this service unkillable. This phone has only one job now, and that is to always be listening for incoming messages, no matter what. Things I have done so far: Created a Service (and launched a separate thread from that service) Used startForeground(id, notification); Activated DeviceAdmin and created a wakelock anything else you guys can think of?
score: 2
tagged with: wakelock
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23940301
downvote count: 0
type: Question
linked to: http://stackoverflow.com/q/600207

http://stackoverflow.com/a/23895356
score: 1
answers question: http://stackoverflow.com/q/23895338
upvote count: 1
has body: Runtime Exceptions could be thrown but there is no real need for it. In the other hand Checked Exceptions if thrown in the body of a method should be declared in the signature of that method. In that case, the method without declaring the "throws" will not compile. For the Runtime Exception try to call the test method, you'll see that the exception is thrown in all cases. public static void main(String[] args){ YourClass.test(); }
downvote count: 0
type: Answer

http://stackoverflow.com/q/23812999
has title: junit: NullPointer on injected bean when testing controller with mockmvc
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23818582
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/36632988
has body: So I have this test case: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:rest-context-test.xml") public class CustomerControllerTest { private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders .standaloneSetup(new CustomerController()).build(); } @Test public void testGetCustomerById() throws Exception { mockMvc.perform(get("/customers/{ccid}", 1)).andExpect(status().isOk()) .andExpect(content().contentType("application/json")) .andExpect(jsonPath("$.ccid").value("1")); } } That loads rest-context-test.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee" 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/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"&gt; &lt;bean id="customerServiceImpl" class="myorg.service.impl.MockCustomerServiceImpl" /&gt; &lt;/beans&gt; With the hope of being able to AutoWire customerServiceImpl into my controller: @Controller @RequestMapping("customers") public class CustomerController { private static Logger Logger = LoggerFactory .getLogger(CustomerController.class); @Autowired @Qualifier("customerServiceImpl") private CustomerService customerService; @RequestMapping(value = "/{ccid}", method = RequestMethod.GET, produces = "application/json") @ResponseStatus(HttpStatus.OK) @ResponseBody public Customer getCustomerById(@PathVariable Integer ccid) throws BadRequestException, ServerError…
possible better answer: http://stackoverflow.com/a/23818582
has answer: http://stackoverflow.com/a/67915467
upvote count: 3
answer count: 3
tagged with: mocking
tagged with: junit
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/23813335
accepted answer: http://stackoverflow.com/a/23813335
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/23857670
score: 0
has title: How to consistently access a file?
has comment: http://stackoverflow.com/comment/36718537
tagged with: python
tagged with: multiplatform
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36720067
has comment: http://stackoverflow.com/comment/36718502
tagged with: java
has comment: http://stackoverflow.com/comment/36718638
tagged with: http://stackoverflow.com/tag/c
type: Question
has comment: http://stackoverflow.com/comment/36718553
has answer: http://stackoverflow.com/a/23857700
answer count: 2
has body: I'm looking for a way to select a file, and a time frame/or until a certain action is performed, and "use" or "read" the file for that amount of time. Just a way to keep other programs from accessing it. The quality assurance department as my company is in need of an application like this and I believe it's possible to make it but I'm not sure how to approach this. Possibly "read" the file over and over until the time is reach or an action is performed? Any ideas?
has answer: http://stackoverflow.com/a/23857728

http://stackoverflow.com/comment/36756790
type: QuestionComment
comment on: http://stackoverflow.com/q/23865555
score: 0
has text: Can you make up a code sample to be tested? It would help answering your question.
type: Comment

http://stackoverflow.com/comment/36927744
score: 0
type: Comment
has text: @Robin - That's because this is not full code - you need to fill in the `...` with whatever the method takes as a parameter, just like you have in you code in the question
type: AnswerComment
comment on: http://stackoverflow.com/a/23906357

http://stackoverflow.com/q/23781419
has answer: http://stackoverflow.com/a/23781676
tagged with: java
tagged with: set
linked to: http://stackoverflow.com/q/40480
tagged with: collections
accepted answer: http://stackoverflow.com/a/23781764
type: Question
has body: Why I am unable to add elements to the Set when I am passing it as a reference. Following is my code: public static void main(String[] args) { Set&lt;String&gt; mySet = null; populateSet(mySet); if(mySet.contains("A")) {//Getting warning variable can only be null here System.out.println("Set populated"); }else{ System.out.println("Set Not populated"); } } private static void populateSet(Set&lt;String&gt; mySet) { mySet = new HashSet&lt;String&gt;(); mySet.add("A"); mySet.add("B"); } I am getting NullPointerException for the above code. But when I am creating an HashSet object and passing it as reference, it's working fine public static void main(String[] args) { Set&lt;String&gt; mySet = new HashSet&lt;String&gt;(); populateSet(mySet); if(mySet.contains("A")) { System.out.println("Set populated"); }else{ System.out.println("Set Not populated"); } } private static void populateSet(Set&lt;String&gt; mySet) { mySet.add("A"); mySet.add("B"); } What is the difference between these two approach?
tagged with: hashset
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23781764
possible better answer: http://stackoverflow.com/a/23781475
tagged with: pass-by-reference
has title: Unable to add elements to a Collection by passing it by reference to a method
has answer: http://stackoverflow.com/a/23781475
type: AnsweredQuestion

http://stackoverflow.com/a/23898408
answers question: http://stackoverflow.com/q/23898266
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23898266
has body: Retrofit isn't really used for parsing JSON into Java objects (internally it actually uses GSON for the parsing of API responses). I would suggest using JSON.org, GSON or Jackson for parsing your JSON file. The simplest way to do this is to use the JSON.org parser: import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; import org.json.JSONArray; import org.json.JSONObject; import org.junit.Test; @Slf4j public class JsonTest { @Test public void test() throws Exception { HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet("http://jsonblob.com/api/jsonBlob/5384f843e4b0441b35d1329d"); request.addHeader("accept", "application/json"); HttpResponse response = client.execute(request); String json = IOUtils.toString(response.getEntity().getContent()); //here's where you're actually parsing the JSON JSONObject object = new JSONObject(json); JSONObject metadata = object.getJSONObject("movies_metadata"); JSONObject movies = metadata.getJSONObject("movies"); JSONArray movieNames = movies.names(); for (int i = 1; i&lt; movieNames.length(); i++) { String movieKey = movieNames.getString(i); log.info("The current object's key is {}", movieKey); JSONObject movie = movies.getJSONObject(movieKey); log.info("The Description is {}", movie.getString("Description")); log.info("The Movie_Logo is {}", movie.getString("Movie_Logo")); } } } I put your JSON into a JSON Blob and then used their API to request it in the unit test. The output from the unit test is: 14:49:30.450 [main] INFO JsonTest - The current object's key is Movie 2 14:49:30.452 [main] INFO JsonTest - The Description is Sample description for Movie 2 14:49:30.452 [main] INFO JsonTest - The Movie_Logo is logo1.png 14:49:30.452 [main] INFO JsonTest - The current object's key is Movie 1 14:49:30.453 [mai…
type: AcceptedAnswer

http://stackoverflow.com/a/23789393
has comment: http://stackoverflow.com/comment/36595342
has comment: http://stackoverflow.com/comment/36589643
has comment: http://stackoverflow.com/comment/36680698
has comment: http://stackoverflow.com/comment/36620001
has comment: http://stackoverflow.com/comment/36618310
score: 0
has comment: http://stackoverflow.com/comment/36630058
has comment: http://stackoverflow.com/comment/36624584
has comment: http://stackoverflow.com/comment/36588082
has body: I've found that the problem comes from lambda expression usage :( replacing all lambdas with regular for fixes the problem exchangeCurrencyToCurrency.entrySet().stream().forEach((entry) -&gt; { String cryptsyCurrencyCode = entry.getKey(); String currencySymbol = entry.getValue(); com.jarvis.data.entity.Currency currency = dataService.getCurrency(currencySymbol); if (notNull(currency)) { associateCurrency(currency, cryptsyCurrencyCode); } else { LOGGER.debug("associated currency [" + currencySymbol + "] does not exist in database, removing from configuration"); markedForRemoval.add(cryptsyCurrencyCode); } }); result for(Map.Entry&lt;String, String&gt; entry : exchangeCurrencyToCurrency.entrySet()){ String cryptsyCurrencyCode = entry.getKey(); String currencySymbol = entry.getValue(); com.jarvis.data.entity.Currency currency = dataService.getCurrency(currencySymbol); if (notNull(currency)) { associateCurrency(currency, cryptsyCurrencyCode); } else { LOGGER.debug("associated currency [" + currencySymbol + "] does not exist in database, removing from configuration"); markedForRemoval.add(cryptsyCurrencyCode); } }
has comment: http://stackoverflow.com/comment/36588234
has comment: http://stackoverflow.com/comment/36620201
type: Answer
answers question: http://stackoverflow.com/q/23787068
has comment: http://stackoverflow.com/comment/36606021
has comment: http://stackoverflow.com/comment/36609098

http://stackoverflow.com/a/23937040
score: 2
answers question: http://stackoverflow.com/q/23936280
downvote count: 0
upvote count: 2
type: Answer
has body: The best way to match your test case is: String camelCasePattern = "^[a-z]+([A-Z][a-z0-9]+)+"; This will ensure it starts with a lowecase, and then has a repeating pattern of one capital letter, followed by some lowercase characters Matches camelCaseTest but not camelCaseDOneWrong

http://stackoverflow.com/a/23779799
has body: Getters and Setters are convention and nothing else. (Well, to be accurate they are defined in the JavaBeans specification but that's not a binding part of the language.) You can name them differently of course if for some reason you don't want to follow the convention; this could cause confusion but it is possible. So for example you could have public class Item { private String name; private int sellIn; private int quality; public Item(String name, int sellIn, int quality) { this.name = name; this.quality = quality; this.sellIn = sellIn; } public void declareSellInAs(int sellIn) { this.sellIn = sellIn; } public void makeQualityBe(int quality) { this.quality = quality; } public String retrieveName() { return name; } public int whatIsSellIn() { return sellIn; } public int howGoodIsTheQuality() { return quality; } } I wouldn't recommend doing anything like that unless you have a really good reason though. If you break compatibility to the JavaBeans specification many frameworks which depend on it will have problems with your code.
has comment: http://stackoverflow.com/comment/36570457
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23779646
has comment: http://stackoverflow.com/comment/36570527
has comment: http://stackoverflow.com/comment/36572117
upvote count: 2
has comment: http://stackoverflow.com/comment/36572284
has comment: http://stackoverflow.com/comment/36570402
has comment: http://stackoverflow.com/comment/36572149
type: Answer
has comment: http://stackoverflow.com/comment/36572227

http://stackoverflow.com/comment/36586068
has text: Like I said, Scala DOES NOT require typed actors for anything to be wildly more productive than the OO approach - you need to learn about pattern matching to understand this. Scala is an FP-OOP hybrid and oftentimes OOP is at the wrong level of abstraction for a particular use case. Scala is type-safe and as a result, so is pattern-matching. There are many problems that object-oriented decomposition can't resolve without tons of boilerplate when pattern matching can. Feel free to look at Coursera's "Functional Programming Principles in Scala" by Martin Odersky, week 4, videos 4.5 and 4.6.
comment on: http://stackoverflow.com/a/23787912
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/36875319
type: Comment
comment on: http://stackoverflow.com/q/23940612
score: 0
type: QuestionComment
has text: "cannot be resolved" usually means you are trying to use a reference variable you haven't declared/instantiated yet.

http://stackoverflow.com/a/23875185
upvote count: 2
has body: I am afraid that maybe that infinite loop inside paint() is interfering with the events management (remember that there is a single thread for those 2 things to be done). Why don't you just fire a repaint() on every significant event (for example, a key press)?
score: 2
has comment: http://stackoverflow.com/comment/36754556
downvote count: 0
answers question: http://stackoverflow.com/q/23875063
type: Answer

http://stackoverflow.com/q/23873071
has comment: http://stackoverflow.com/comment/36747287
has comment: http://stackoverflow.com/comment/36748302
tagged with: jsp
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36748142
has comment: http://stackoverflow.com/comment/36748346
has title: How do I correctly deploy a .war file?
has comment: http://stackoverflow.com/comment/36747433
has comment: http://stackoverflow.com/comment/36747335
has comment: http://stackoverflow.com/comment/36747348
has comment: http://stackoverflow.com/comment/36747337
tagged with: deployment
has comment: http://stackoverflow.com/comment/36748205
has comment: http://stackoverflow.com/comment/36747476
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36747967
has comment: http://stackoverflow.com/comment/36747997
type: Question
has comment: http://stackoverflow.com/comment/36747171
has comment: http://stackoverflow.com/comment/36748037
has body: I am attempting to deploy a test.war file for the first time. I have installed Tomcat 7 using apt-get on Ubuntu server 12.04. The webapps directory is located here: /var/lib/tomcat7/webapps. Tomcat 7 is installed here: /usr/share/tomcat7. I have produced a basic web project called test using Eclipse which works fine using a local Tomcat 7 server. In the project I have a basic index.jsp file and a Testservlet.java servlet file. Using an FTP client I have uploaded the test.war file to /var/lib/tomcat7/webapps where it automatically deploys. But how do I browse to this directory in a web browser to view the website? I have previously attempted to move the project inside the /var/lib/tomcat7/webapps/ROOT directory which allows me to view the index.jsp file when i navigate to http://my-host.com:8080/test but I get a 404 error when I attempt to browse to the Testservlet page at this address http://my-host.com:8080/Testservlet. This is the Testservlet annotation: @WebServlet(description = "a test servlet", urlPatterns = { "/Testservlet" }) So what am I missing in this whole process? Is there something else I need to do after deploying the .war file in the webapps directory to be able to browse to the website without having to put it in to the /ROOT sub directory? EDIT: I get a 404 error when I navigate to http://my-host.com:8080/test/Testservlet AND when I navigate to http://my-host.com:8080/test when the test.war is deployed in /var/lib/tomcat7/webapps. EDIT: This is the web.xml for test project. <?xml version="1.0" encoding="UTF-8"?> test index.jsp EDIT: removed annotation in servlet and adding servlet mapping to web.xml <?xml version="1.0" encoding="UTF-8"?> test index.jsp test testpackage.Testservlet test /Testservlet EDIT: added Testservlet.java code: package testpackage; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servle…
has comment: http://stackoverflow.com/comment/36749174
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/36747734

http://stackoverflow.com/comment/36735452
has text: what about "* * * */2 * ?"
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23866452
type: QuestionComment

http://stackoverflow.com/a/69192349
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23903842
score: 1
has comment: http://stackoverflow.com/comment/135038072
downvote count: 0
has body: I tried with following command in cmd of windows, it has worked finally: &quot;%JAVA_HOME%&quot;\bin\keytool.exe -import -trustcacerts -alias *Certificate filename* -file *full path of certificate location ending with certificatename* -keystore &quot;%JAVA_HOME%&quot;\lib\security\cacerts

http://stackoverflow.com/comment/36672615
type: QuestionComment
type: Comment
score: 2
has text: Can you share the code you have so far?
comment on: http://stackoverflow.com/q/23833923

http://stackoverflow.com/comment/54014089
score: 0
type: QuestionComment
has text: I am stuck in the same issue can you help me out ,
type: Comment
comment on: http://stackoverflow.com/q/23873324

http://stackoverflow.com/comment/36693091
comment on: http://stackoverflow.com/a/23844691
type: Comment
has text: Which is to say that you decided you do not care about the length? Also, this code assumes that the response is in the default character encoding of the OS. You should look at the Content-Type value in the header of the response to determine the character encoding. You can use http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/com/google/common/net/MediaType.html from guava to help parse out the charset attribute.
score: 1
type: AnswerComment

http://stackoverflow.com/q/23856550
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/23856755
tagged with: keyevent
upvote count: 0
has answer: http://stackoverflow.com/a/23856739
has comment: http://stackoverflow.com/comment/36716481
tagged with: java
tagged with: methods
type: Question
tagged with: class
answer count: 2
downvote count: 3
has title: How to make a method to presses a key?
has body: so basically i am using the Robot class to make a method in which a key is pressed and released. But I don't know how to get it so that it uses a variable to determine what key to press. here is what I have so far: void PressKey(String key) { try { Robot robot = new Robot(); robot.delay(200 + (int)(Math.random() * ((300 - 200) + 1))); robot.keyPress(KeyEvent.VK_H); } catch (AWTException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/36716313
favorite count: 0

http://stackoverflow.com/comment/36821749
type: QuestionComment
comment on: http://stackoverflow.com/q/23912035
score: 0
has text: ...not using an array? Sounds like a job for SQL/sqlite
type: Comment

odata
tag name: odata
tags question: http://stackoverflow.com/q/23802092
type: Tag
tags question: http://stackoverflow.com/q/23822532
tags question: http://stackoverflow.com/q/23784658

ubuntu
tags question: http://stackoverflow.com/q/23797941
tags question: http://stackoverflow.com/q/23925666
tags question: http://stackoverflow.com/q/23809213
tags question: http://stackoverflow.com/q/23800251
tags question: http://stackoverflow.com/q/23837163
tag name: ubuntu
tags question: http://stackoverflow.com/q/23846433
tags question: http://stackoverflow.com/q/23935921
type: Tag
tags question: http://stackoverflow.com/q/23828063

http://stackoverflow.com/comment/36754049
comment on: http://stackoverflow.com/a/23876691
score: 0
type: AnswerComment
type: Comment
has text: Note that you should prefer converting from hexadecimals to bytes first, then converting the bytes to binary *encoding* for viewing.

http://stackoverflow.com/q/23798824
has comment: http://stackoverflow.com/comment/36606117
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23798898
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/13894892
upvote count: 1
has answer: http://stackoverflow.com/a/23798874
type: Question
has comment: http://stackoverflow.com/comment/36606005
score: -1
answer count: 2
has body: How is an int value automatically converted into a String when we concatenate a String with an int? For example, consider this code: int i=5; String s="A"+i; The output is "A5". So, how was i converted into a String before it was concatenated with "A"?
has title: How int convert to string when String s="A"+5;
favorite count: 0

http://stackoverflow.com/q/23920613
tagged with: http-status-code-400
has comment: http://stackoverflow.com/comment/36838485
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23921072
accepted answer: http://stackoverflow.com/a/23921072
favorite count: 0
upvote count: 2
has title: Return a custom error message for 400 requests that don't hit the controller
tagged with: spring
has comment: http://stackoverflow.com/comment/36839399
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: I need to be able to return a custom error message for requests that are Bad Requests, but don't hit a controller (ex. Having bad JSON). Does anyone have any idea how to go about this? I tried the @ExceptionHandler annotation to no avail. Any help would be appreciated.

http://stackoverflow.com/comment/75729456
score: 0
type: AnswerComment
type: Comment
has text: thats the point, `setxkbmap` will allow it to work, here it did not also without it!
comment on: http://stackoverflow.com/a/23953634

http://stackoverflow.com/comment/36709498
type: QuestionComment
comment on: http://stackoverflow.com/q/23852798
type: Comment
has text: @okaram: I understand inOrder(root) is a BinaryNode taken as the argument.I wrote inOrder(5) just so that I can explain it easily
score: 0

http://stackoverflow.com/q/23910489
type: Question
linked to: http://stackoverflow.com/q/5019162
has comment: http://stackoverflow.com/comment/36838534
has body: I have a controller: @Controller @RequestMapping("/player") public class PlayerController extends AbstractController { @RequestMapping(value = "/doSomething", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) @ResponseBody public int doSomeThing(@RequestBody SomeDTO someDTO , HttpServletRequest request) throws IOException { this.playerService.doSomething( someDTO ); return SERVER_OK; } // Tons of similar methods here } I would like to create a filter that will intercept all the calls to this controller and will have access to the @RequestBody Object object that each of these methods receives. I would like to manipulate this @RequestBody object. Is that possible?
upvote count: 3
tagged with: filter
has comment: http://stackoverflow.com/comment/36820827
downvote count: 0
has comment: http://stackoverflow.com/comment/51150444
favorite count: 0
has comment: http://stackoverflow.com/comment/36818790
linked to: http://stackoverflow.com/q/19825946
has comment: http://stackoverflow.com/comment/36820100
answer count: 0
has comment: http://stackoverflow.com/comment/36819194
has title: Spring MVC - adding a filter to a controller with the request body available for manipulation
has comment: http://stackoverflow.com/comment/36822466
has comment: http://stackoverflow.com/comment/36819293
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36819042
tagged with: spring
has comment: http://stackoverflow.com/comment/36819648
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36818975
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36819088
has comment: http://stackoverflow.com/comment/36818911
has comment: http://stackoverflow.com/comment/36818747

http://stackoverflow.com/q/23848548
has comment: http://stackoverflow.com/comment/36706760
has comment: http://stackoverflow.com/comment/36701029
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36701057
tagged with: java
has answer: http://stackoverflow.com/a/23848710
type: Question
tagged with: servlets
has title: parse String to Date on servlet (EJB3, Jboss)
has comment: http://stackoverflow.com/comment/36701322
score: 0
accepted answer: http://stackoverflow.com/a/23848710
has comment: http://stackoverflow.com/comment/36701017
answer count: 1
has comment: http://stackoverflow.com/comment/36701768
has comment: http://stackoverflow.com/comment/36700927
has body: First of all, please forgive my poor english. I want to search like SendDate on my feedback form, but it don't work, it said it can't parse string to date. Here is my code: 1.Session bean: public Group3KSC.Feedback[] searchLikeSendDateFeedback(Date senddate) { try { Query query = em.createQuery("SELECT f FROM Feedback f WHERE f.sendDate LIKE :sendDate"); query.setParameter("sendDate", "%" + senddate + "%"); List list = query.getResultList(); Feedback[] result = new Feedback[list.size()]; list.toArray(result); return result; } catch (Exception e) { e.printStackTrace(); } return null; } Search form: &lt;form action="../AdminSearchSendDateServlet" method="post"&gt; &lt;div&gt; Search &lt;input type="text" name="dbSearch" class="text-input datepicker"/&gt; &lt;p class="button"&gt; &lt;input type="submit" value="Search" name ="action"/&gt; &lt;/p&gt; &lt;/div&gt; &lt;/form&gt; AdminSearchSendDateServlet (The Problem is here, when I declare searchsenddate) HttpSession session = request.getSession(); String action = request.getParameter("action"); Context ctx = new InitialContext(); AdminSessionBeanLocal local = (AdminSessionBeanLocal) ctx.lookup("AdminSessionBeanLocalJNDI"); if (action.equals("Search")) { SimpleDateFormat fBirth = new SimpleDateFormat("MM/dd/yyyy"); Date searchsenddate = fBirth.parse(request.getParameter("dbSearch").trim()); Feedback[] u = local.searchLikeSendDateFeedback(searchsenddate); session.setAttribute("Username", u); response.sendRedirect("Admin/FeedbackList.jsp"); } ex: this record in database is:2014-05-25 00:00:00.000, when I search it in search form with date picker, it will input 05/25/2014, and when I'm click search button, it show those error java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date Thanks for your help
has comment: http://stackoverflow.com/comment/36701072
has comment: http://stackoverflow.com/comment/36700881

http://stackoverflow.com/comment/36700977
score: 0
type: QuestionComment
type: Comment
has text: @XSen yeah i just noticed except i'm unsure of how to call the paint method in this case since i'm not really sending anything to G
comment on: http://stackoverflow.com/q/23826992

http://stackoverflow.com/q/23862551
upvote count: 0
has comment: http://stackoverflow.com/comment/36728214
has answer: http://stackoverflow.com/a/23862593
has comment: http://stackoverflow.com/comment/36728131
has body: I'm trying to build a simple app in the android adt that merely selects one of 5 choices when the screen is tapped and prints it onto the screen. I don't even know if my code will work as I am brand new to java, but so far the only error left is on the line with public static final. Until this point it is just the default code. /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } public static final String TAG = MainActivity.class.getSimpleName(); if(GestureDetector.OnGestureListener){ String[] myStringArray = {"Option 1","Option 2","Option 3", "Option 4", "Option 5"}; Random rand = new Random(); int n = rand.nextInt(4) + 1; Log.d(TAG, myStringArray[n]); } }}
has title: Syntax error token ";", { expected
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -2
has comment: http://stackoverflow.com/comment/36731096
tagged with: java
downvote count: 2
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23862634

http://stackoverflow.com/q/23824674
has title: Not returning the correct output
has body: public Map&lt;Route, List&lt;Service&gt;&gt; getTimetable() { return timetable; } public void loadFile() { JFileChooser fileChooser = new JFileChooser(); int status = fileChooser.showOpenDialog(null); if (status == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); try { filePath= selectedFile.getPath(); fileName.setText(selectedFile.getName()); this.timetable = tr.read(filePath); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Problem accessing file "+ selectedFile.getAbsolutePath(), nameOfFile, JOptionPane.ERROR_MESSAGE); } catch (FormatException e) { JOptionPane.showMessageDialog(null, "Invalid file format", nameOfFile, JOptionPane.ERROR_MESSAGE); } } } The problem I'm having is that the timetable being returned in getTimetable is not returning anything, even though I have set it to be something in the loadFile method. Any suggestions would be greatly appreciated!
has comment: http://stackoverflow.com/comment/36655745
has comment: http://stackoverflow.com/comment/36655190
has answer: http://stackoverflow.com/a/23825720
tagged with: java
has comment: http://stackoverflow.com/comment/36655610
type: Question
answer count: 1
tagged with: variables
has comment: http://stackoverflow.com/comment/36655287
has comment: http://stackoverflow.com/comment/36655151
score: 0
tagged with: input
has comment: http://stackoverflow.com/comment/36655426
type: UnansweredQuestion

http://stackoverflow.com/comment/36802556
type: Comment
type: QuestionComment
has text: what is different? Do you have exactly the same amount of bytes? BTW why are you using buffered input and output?
comment on: http://stackoverflow.com/q/23901428
score: 0

http://stackoverflow.com/q/23806272
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/36619695
has answer: http://stackoverflow.com/a/23810424
has comment: http://stackoverflow.com/comment/36619630
favorite count: 0
has comment: http://stackoverflow.com/comment/36619576
has answer: http://stackoverflow.com/a/23806480
has comment: http://stackoverflow.com/comment/36619773
has title: How can I calclulate the diskspace of a remote machine using java?
has comment: http://stackoverflow.com/comment/36619518
has body: Can anyone suggest me how can I modify the below code which is currently calculating the free disk space(C:) of my local system(Windows OS) to calculate the free disk space (C:) of the remote machine(Windows OS) using java? import java.io.File; public class DiskMemory { public static void main(String[] args) { File file = new File("C:"); //total disk space in bytes. long totalSpace = file.getTotalSpace(); //unallocated free disk space in bytes. long usableSpace = file.getUsableSpace(); //unallocated free disk space available to current user. long freeSpace = file.getFreeSpace(); System.out.println(" ==Total Memory Allocation == "); System.out.println("Total size : " + totalSpace + " bytes"); System.out.println("Space free : " + usableSpace + " bytes"); System.out.println("Space free : " + freeSpace + " bytes"); System.out.println(" === mega bytes ==="); System.out.println("Total size : " + totalSpace /1024 /1024 + " mb"); System.out.println("Space free : " + usableSpace /1024 /1024 + " mb"); System.out.println("Space free : " + freeSpace /1024 /1024 + " mb"); } }
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36619551
upvote count: 3
has answer: http://stackoverflow.com/a/29525021
accepted answer: http://stackoverflow.com/a/23810424
downvote count: 1
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/29525021
has comment: http://stackoverflow.com/comment/36619540

http://stackoverflow.com/q/23837215
has answer: http://stackoverflow.com/a/23837468
answer count: 2
downvote count: 0
tagged with: deserialization
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/23837957
tagged with: lambda
tagged with: java-8
has title: Java 8 lambdas that access instance fields and methods can't be deserialized
has comment: http://stackoverflow.com/comment/36679438
has comment: http://stackoverflow.com/comment/36679124
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36680804
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23837957
score: 15
possible better answer: http://stackoverflow.com/a/23837468
has comment: http://stackoverflow.com/comment/36734865
has body: It seems to me it's a bug in the compiler or in the JVM, but maybe someone has a better explanation. The following code runs fine as is, but if I uncomment the second runnable initialization, that uses 'this' directly, it can't deserialize the object (in.readObject() throws an exception). public class TestClass implements Serializable { String msg = "HEY!"; SerializableRunnable runnable; public TestClass() { TestClass self = this; runnable = () -&gt; self.say(); // uses a local copy of 'this' // runnable = () -&gt; this.say(); // uses 'this' directly } public void say() { System.out.println(msg); } public static void main(String[] args) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (ObjectOutputStream out = new ObjectOutputStream(buffer)) { out.writeObject(new TestClass()); } try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()))) { TestClass s = (TestClass) in.readObject(); s.say(); } } } interface SerializableRunnable extends Runnable, Serializable { } This is the stacktrace for the root cause: java.lang.IllegalArgumentException: Invalid lambda deserialization at j8test.TestClass.$deserializeLambda$(TestClass.java:1) 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 java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:230) 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 java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputSt…
upvote count: 15
linked to: http://stackoverflow.com/q/27488567

http://stackoverflow.com/a/23803410
type: Answer
answers question: http://stackoverflow.com/q/23803297
has body: try using .setPreferredSize() to components
score: 0

http://stackoverflow.com/a/23920549
has comment: http://stackoverflow.com/comment/36840756
has body: The bitwise operations in python are the same as they are in C/Java (though python lacks the &gt;&gt;&gt; operation of Java as it is not needed; sign extension is always done, but even 0xFFFF_FFFF_FFFF_FFFF can be represented as a positive integer). As an added bonus, Python integers can be used positive for whatever size, unlike in Java, where there are signedness issues with bit-twiddling. Looking at the linked file, it seems that the value indeed should be an UUID, only that it is base64-encoded: Generates a universally unique identifier, i.e., a UUID. It encodes the 128 bit UUID in base 64, but rather than padding the encoding with two "=" characters, it prefixes the encoding with a single "_" character, to ensure that the result is a valid ID, i.e., an NCName In Python there is UUID class, and base64 encoding module; thus the whole identifier handling could be written in Python as import uuid import base64 gen_id = uuid.uuid1() # generate type 1 UUID id_bytes = gen_id.bytes # take its bytes encoded = base64.b64encode(id_bytes, b'-_') encoded = encoded.replace(b'=', b'') # remove the padding bytes result = '_' + encoded.decode('ascii') # result is a string with '_' prepended.
answers question: http://stackoverflow.com/q/23920431
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36839080
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23920431

http://stackoverflow.com/comment/36863655
comment on: http://stackoverflow.com/q/23931742
has text: Filling a bug, but it would be more helpful if your test case is as complete as possible. And, also, it has more credibility if this test case is done against one of the latest versions of Spring.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36616625
type: QuestionComment
score: 0
has text: This question shows no effort. Have you tried googling "_java command line arguments_"? This is basic stuff... and no, there is no need for a boolean.
comment on: http://stackoverflow.com/q/23804683
type: Comment

http://stackoverflow.com/comment/37480882
score: 0
comment on: http://stackoverflow.com/a/23808863
has text: @BlaiseDoughan result of d.getTextContent() is null
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23799403
tagged with: android
has title: Recording pcm file and playing it through Audiotrack crashing
score: 0
has answer: http://stackoverflow.com/a/23799709
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23799709
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25157821
possible better answer: http://stackoverflow.com/a/23799531
has answer: http://stackoverflow.com/a/23799531
answer count: 3
has body: i am recording a pcm file thorugh AudioRecorder and create a file in sdcard. when recording is done i play the same file with Audiotrack but it crash. in logcat it says "Invalid audio buffer size". also my file size on sdcard is 0.0kb ,which i didn't understand why. here is the code. ` public void startRecord() { File file = new File(Environment.getExternalStorageDirectory(), "test.pcm"); int sampleFreq = 11025; try { file.createNewFile(); OutputStream outputStream = new FileOutputStream(file); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( outputStream); DataOutputStream dataOutputStream = new DataOutputStream( bufferedOutputStream); int minBufferSize = AudioRecord.getMinBufferSize(sampleFreq, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); short[] audioData = new short[minBufferSize]; AudioRecord audioRecord = new AudioRecord( MediaRecorder.AudioSource.MIC, sampleFreq, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, minBufferSize); audioRecord.startRecording(); while (recording) { int numberOfShort = audioRecord.read(audioData, 0, minBufferSize); for (int i = 0; i &lt; numberOfShort; i++) { dataOutputStream.writeShort(audioData[i]); } } audioRecord.stop(); dataOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } public void PLaying(int explosion) { File file = new File(Environment.getExternalStorageDirectory(), "test.pcm"); int shortSizeInBytes = Short.SIZE / Byte.SIZE; int bufferSizeInBytes = (int) (file.length() / shortSizeInBytes); short[] audioData = new short[bufferSizeInBytes]; try { InputStream inputStream = new FileInputStream(file); BufferedInputStream bufferedInputStream = new BufferedInputStream( inputStream); DataInputStream dataInputStream = new DataInputStream( bufferedInputStream); int i = 0; while (dataInputStream.available() &gt; 0) { audioData[i] = dataInputStream.readShort(); i++; } dataInputStream.close(); int sampleFreq = explosion; AudioTrack audioTrac…

http://stackoverflow.com/comment/36780542
type: AnswerComment
score: 0
has text: Thanks- it seems that the program I'm working on was using an old version on the open-dis library, so that's why it wasn't there...
type: Comment
comment on: http://stackoverflow.com/a/23889989

http://stackoverflow.com/q/23798676
type: UnansweredQuestion
tagged with: jdbi
type: Question
tagged with: java
has body: How I can implement predefined mapper class of an class into the new mapper class of another class which have first class as object public class Class2Mapper implements ResultSetMapper&lt;Class2&gt; { public Class2 map(int index, ResultSet rs, StatementContext ctx) { Class2 myC2 = new Class2(); //Do something to Map myC2.class1Object with rs //Do some mapping with other variables of myC2 return myC2; } } Assuming that Class1Mapper is already defined.
has answer: http://stackoverflow.com/a/28076410
score: 0
has title: using pre defined mapper class in new mapper class jdbi sql fluent queries
tagged with: sql
answer count: 1

http://stackoverflow.com/a/23872230
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/66209737
type: Answer
has body: Add the table to the stage instead of the button and it should be fine. There is no need to add the button to the stage since you add the whole table. (regulary) stage.addActor(btnPlay); To stage.addActor(table);
upvote count: 1
answers question: http://stackoverflow.com/q/23872082

http://stackoverflow.com/a/23940462
has comment: http://stackoverflow.com/comment/36980256
has comment: http://stackoverflow.com/comment/36980086
has comment: http://stackoverflow.com/comment/36982165
has comment: http://stackoverflow.com/comment/37026704
downvote count: 0
has comment: http://stackoverflow.com/comment/36982702
type: Answer
answers question: http://stackoverflow.com/q/23940179
score: 2
has comment: http://stackoverflow.com/comment/36984689
upvote count: 2
has comment: http://stackoverflow.com/comment/36984593
has body: Simply define final ImageView variable linked to the view you want to fill with the Bitmap: //inside some method e.g. onCreate() final ImageView imageView = (ImageView) findViewById(R.id.myPrettyImage); new AsyncTask&lt;String, Void, Bitmap&gt;() { @Override protected Bitmap doInBackground(String... params) { /* here's your code */ } @Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); imageView.setImageBitmap(bitmap); } }.execute(/*your params*/); Or you can create ImageView field in your AsyncTask extended task: private class ExtendedAsyncTask extends AsyncTask&lt;String, Void, Bitmap&gt; { private ImageView[] views; public void ExtendedAsyncTask(ImageView[] views) { this.views = views; } @Override protected Bitmap doInBackground(String... params) { /* your code here */ } @Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); for (ImageView view: views) { view.setImageBitmap(bitmap); } } } and use it: ExtendedAsyncTask aTask = new ExtendedAsyncTask(new ImageView[]{myImageView1, myImageView2, myImageView3}); aTask.execute(/*some params*/);

http://stackoverflow.com/comment/66209737
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23872230
has text: I can't believe I forgot the `stage.addActor(table);`
score: 0

http://stackoverflow.com/comment/36835402
type: QuestionComment
comment on: http://stackoverflow.com/q/23918836
type: Comment
has text: you can use gps tracker class to get current lat-long
score: 0

http://stackoverflow.com/comment/36606022
type: AnswerComment
score: 0
has text: Does the requirement state to use a different thread for each ball?
type: Comment
comment on: http://stackoverflow.com/a/23798583

http://stackoverflow.com/q/23922542
has comment: http://stackoverflow.com/comment/36842083
has comment: http://stackoverflow.com/comment/36842091
has title: Switching a greaterthan/lessthan
has comment: http://stackoverflow.com/comment/36842197
has comment: http://stackoverflow.com/comment/36842128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36842137
has comment: http://stackoverflow.com/comment/36842238
tagged with: performance
has comment: http://stackoverflow.com/comment/36842295
tagged with: java
has comment: http://stackoverflow.com/comment/36842081
has answer: http://stackoverflow.com/a/23922653
linked to: http://stackoverflow.com/q/22543708
tagged with: methods
has comment: http://stackoverflow.com/comment/36842366
has comment: http://stackoverflow.com/comment/36842044
type: Question
score: 0
tagged with: for-loop
has body: I am working on compacting some code, right now I have 4 methods that all do almost the exact same thing except the for loops are modeled a bit differently. I'm passing int's up, down, right, and left as parameters to this compact method, which coincides with the 4 methods I used to have. By passing 1 for one of the parameters and 0 for the rest, I am able to do different this in a single loop, I'm just having trouble with switching a &lt; or > sign. This is the line of code I'm trying to work with: for (int i = (right*3)+(up*3); i &lt;= (left*3)+(down*3); i= i + (left) + (down) - (up) - (right)) { Everything works except I need to switch the i &lt;= (left... part to i &gt;= (left... if right == 1, is there a way in Java to do this in for for loop? If this isn't possible I could make 2 different for loops, I just don't like having almost identical code being repeated. Thanks! Edit: Here are the 4 methods: public boolean moveRight() { boolean didMove = false; for (int a = 0; a &lt;= 3; a++) { for (int i = 3; i &gt;= 0; i--) { for (int j = 0; j &lt; 4; j++) { if (i != 3) { if (valueArray[i + 1][j] == 0 &amp;&amp; valueArray[i][j] != 0) { valueArray[i + 1][j] = valueArray[i][j]; valueArray[i][j] = 0; didMove = true; button[i][j].setSize(80, 80); } else if (valueArray[i + 1][j] == valueArray[i][j] &amp;&amp; valueArray[i][j] != 0) { valueArray[i + 1][j] = valueArray[i][j] * 2; Score += valueArray[i][j] * 2; valueArray[i][j] = 0; didMove = true; button[i][j].setSize(80, 80); } } } } } return didMove; } public boolean moveLeft() { boolean didMove = false; for (int a = 0; a &lt;= 3; a++) { for (int i = 0; i &lt;= 3; i++) { for (int j = 0; j &lt; 4; j++) { if (i != 0) { if (valueArray[i - 1][j] == 0 &amp;&amp; valueArray[i][j] != 0) { valueArray[i - 1][j] = valueArray[i][j]; valueArray[i][j] = 0; didMove = true; button[i][j].setSize(80, 80); } else if (valueArray[i - 1][j] == valueArray[i][j] &amp;&amp; valueArray[i][j] != 0) { valueArray[i - 1][j] = valueArray[i][j] * 2; S…
answer count: 1

http://stackoverflow.com/q/23872559
has answer: http://stackoverflow.com/a/23872661
answer count: 5
tagged with: multithreading
has answer: http://stackoverflow.com/a/23873115
has comment: http://stackoverflow.com/comment/36747059
has comment: http://stackoverflow.com/comment/36746256
has answer: http://stackoverflow.com/a/23872582
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36746148
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23872638
possible better answer: http://stackoverflow.com/a/23872582
accepted answer: http://stackoverflow.com/a/23872661
downvote count: 1
type: Question
has title: Write and read an ArrayList in 2 different Threads
has answer: http://stackoverflow.com/a/23872617
tagged with: arraylist
has body: I am currently working on a little project for school which is a TowerDefense game. When initializing the game, it starts a Thread that calculates everything. After starting that Thread, my code jumps into a loop, that loops my graphics code. I think that it is using 2 Threads then. One thread is for calculating and the other one is the "standard" Thread, that is used when you open the program itself. Now I wanted to add Projectiles to my Towers. For that I need to add a new Projectile Object to my Entity ArrayList. and whenever I try to do so it says Exception in thread "main" java.util.ConcurrentModificationException and points to the line where my graphicsloop is, that tries to loop my Entity Array. That makes sense, because my graphicsloop tries to read while my Projectiles are added to this Array. I tried to work with "synchronized" and I think I know how to use it and what it is for, but Im not that sure where I would use it in my code. I try to solve this problem since yesterday and couldnt find anything on the Internet how to solve it. Also Im not sure what piece of Code helps you, if you didnt understand exactly how my program works and what the problem is so if you need anything, feel free to ask. Would be awesome, if someone could help me solving this problem and I already want to thank you, if you are still reading edit: I think these are the important pieces of code: World update method: private void updateRunning() { waveTimer(); for (Entity e : entities) { if (e.isMonster() &amp;&amp; !block) { e.toMonster().move(); if (e.toMonster().getHealth() &lt;= 0) entities.remove(e); } else if (e.isTower()) { e.toTower().setTarget(e.toTower().findTarget()); e.toTower().shoot(); } else if (e.isProjectile()) { e.toProjectile().update(); } } } Renderer loop method: private void updateRunning() { cam.update(); for (Entity ent : world.getEntities()) { ent.draw(); } cursor.update(); cursor.draw(); // Must always be on bottom draw-methods, to be drawed // on top of //…
has comment: http://stackoverflow.com/comment/36746426
score: 2
has comment: http://stackoverflow.com/comment/36746766
linked to: http://stackoverflow.com/q/1386275
favorite count: 0

http://stackoverflow.com/a/23787259
downvote count: 0
has body: As far as the question is concerned: your usage of ReentrantReadWriteLock is correct. With regard to your problem: I think you need to look toward the transaction isolation level in effect (and possibly adjust it). Hope this helps... Isolation levels explanation in another SO thread: what is difference between non-repeatable read and phantom read? Java tutorial chapter on isolation levels: http://docs.oracle.com/javase/tutorial/jdbc/basics/transactions.html#transactions_data_integrity
has comment: http://stackoverflow.com/comment/36596979
has comment: http://stackoverflow.com/comment/36588994
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36586714
accepted answer of: http://stackoverflow.com/q/23786130
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23786130
has comment: http://stackoverflow.com/comment/36590567

http://stackoverflow.com/q/23845438
has answer: http://stackoverflow.com/a/23854174
tagged with: port
has body: I am working for my network class at a chatroom application, in java, and i have encountered some issues with the connection. The main problem is that I can connect my client to the server, however when I'm trying to use my external ip is not working.So i browsed the web and i found that I have to port forward from my router in order to accept the connection from an external ip. I've done that, but I didn't work. After I searched for an answer I found that the connection somehow is blocked, probably, by a firewall(in my case I have the windows firewall, my av firewall- COMODO IS, and my router's firewall).I disable all of them, in normal mode, but same result. The last thing that I've tried was to boot in safe mode and it worked.Now my question is: Is there some third party software that cause this, my firewall from the COMODO can be the problem or something else? I'm using : Windows 7 Professional SP1 ASUS Router RT-N53 COMODO AV 2013 Internet Security As for the connection I'm using port 4444 and my IP address is dynamic. Thank you for any help you can provide in this situation.
has title: Connection time out - port 4444 (java Application)
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23854174
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: chatroom
possible better answer: http://stackoverflow.com/a/23845575
has answer: http://stackoverflow.com/a/23845575
tagged with: blocked

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/23780564
tags question: http://stackoverflow.com/q/23811138
tags question: http://stackoverflow.com/q/23792742
tags question: http://stackoverflow.com/q/23924373
tags question: http://stackoverflow.com/q/23860755
tags question: http://stackoverflow.com/q/23914892
type: Tag
tags question: http://stackoverflow.com/q/23848372
tags question: http://stackoverflow.com/q/23791883
tags question: http://stackoverflow.com/q/23934675
tags question: http://stackoverflow.com/q/23915129
tags question: http://stackoverflow.com/q/23837704
tags question: http://stackoverflow.com/q/23792441
tags question: http://stackoverflow.com/q/23830105
tags question: http://stackoverflow.com/q/23922959
tags question: http://stackoverflow.com/q/23836533
tags question: http://stackoverflow.com/q/23816019
tags question: http://stackoverflow.com/q/23813820
tags question: http://stackoverflow.com/q/23937789

http://stackoverflow.com/comment/36574774
score: 0
has text: I think "idk" => "I don't know" :).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23782052

http://stackoverflow.com/comment/36842622
comment on: http://stackoverflow.com/q/23878509
score: 0
has text: It seems it doesn't connect.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36819580
comment on: http://stackoverflow.com/a/23910646
type: Comment
has text: You want to change by clicking JRadioButton or a JButton? Also try to create a MCVE and put it in your question for quick answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36829017
type: Comment
comment on: http://stackoverflow.com/q/23915838
score: 0
type: QuestionComment
has text: @Gliptal wrong, `Thread.sleep(230000);` was tried. Read the code first.

http://stackoverflow.com/comment/36890449
has text: Thank you for your comments. Exchange api is the same as used here: http://www.aaronheld.com/post/reading-exchange-mail-with-java EmailMessage class microsoft.exchange.webservices.data.EmailMessage
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23936220
type: Comment

http://stackoverflow.com/comment/36842137
has text: Could you provide some background for what you are doing? Maybe there is a more or less complete different solution to this. EDIT: Readability of code is a very important thing in coding (in my opinion)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23922542

http://stackoverflow.com/comment/36716046
comment on: http://stackoverflow.com/q/23856148
has text: @Rogue Can you look at the edited question. I stated my problem little more clearly now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23862760
favorite count: 0
tagged with: post-redirect-get
has body: My struts version is 2.3.15.3 In my current struts2 project, all post requests do not redirect to get requests So I will get resubmit alert when I click the back button if I use https and chrome How to use minimum effort to change them to keep using post request, but use get redirect to show the JSP? Can I just modify the struts.xml? Or, is it possible to prevent the alert without PRG? this is my current code struts.xml: /WEB-INF/jsp/PostForm.jsp /WEB-INF/jsp/showGet.jsp PostAction.java: public class PostAction extends ActionSupport{ @Override public String execute() throws Exception { Map para = ActionContext.getContext().getParameters(); if(para.get("post")==null) { return "gotoform"; } else { return "success"; } } } PostForm.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> showGet.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> Display here New showGet.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Display here, Post value= <%= request.getParameter("post") %> new PostAction.java: package test; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import java.util.Map; public class PostAction extends ActionSupport{ private String post; @Override public String execute() throws Exception { Map para = ActionContext.getContext().getParameters(); System.out.print("post = "+post); if(para.get("post")==null) { return "gotoform"; } else { return "success"; } } public String getPost() { return post; } public void setPost(String post) { this.post = post; } } new 2 showGet.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Display here , <s:property value="post"/>, ${post}, <%= post %>, <%= getPost() %>
type: AnsweredQuestion
has title: How to change post request to get redirect with minimum code changes in struts2?
downvote count: 0
has answer: http://stackoverflow.com/a/23863744
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23863744
tagged with: https
type: Question
tagged with: jsp
tagged with: struts2
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36845887
score: 0
type: Comment
type: QuestionComment
has text: Not exactly, @Dennis. The question you mention is more theoretic, and it doesn't explain why casting twice works, but casting once doesn't.
comment on: http://stackoverflow.com/q/23924304

http://stackoverflow.com/comment/36723407
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23860046
has text: In runThrough(): What is footSteps and where do you get count from?

http://stackoverflow.com/a/23812494
has comment: http://stackoverflow.com/comment/36631850
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23812386
has comment: http://stackoverflow.com/comment/36631863
accepted answer of: http://stackoverflow.com/q/23812386
has body: I have a recommendation for you , rather than using Thread.sleep() try looking into Java Timer class . It would simplify your task of scheduling job every x hours. It will save you the effort to compute the amount of time to sleep to schedule the next task. This class lets you focus on the Business logic and takes care of the job of scheduling your task.
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36784106
comment on: http://stackoverflow.com/q/23892222
score: 0
has text: You should not, because that would kill the very purpose of Java
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23933403
answers question: http://stackoverflow.com/q/23933265
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36861925
has comment: http://stackoverflow.com/comment/36862275
has comment: http://stackoverflow.com/comment/36862044
has body: I don't know Java well enough to know if this is right, but it compiles as C#, and does something. c = (char)((byte)((int.Parse(thisElement) &amp; 0xFF00) &gt;&gt; 8));

http://stackoverflow.com/comment/36774537
has text: This is definitely not a `Javafx` problem and I am not experienced with Apache FOP, so may be you must wait for someone to help :)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23885962
type: Comment

http://stackoverflow.com/comment/36838324
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23920046
has text: That being said, the reasoning also applies to any thread reading those non-volatile variables without having a `synchronized` block before reading (even if not in the `@PostConstruct` method).
type: AnswerComment

http://stackoverflow.com/comment/36767520
type: AnswerComment
has text: And after doing what you suggested, it gives an error [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
comment on: http://stackoverflow.com/a/23883660
type: Comment
score: 0

http://stackoverflow.com/a/23910228
score: 0
has body: When you instantiate an object of class StammdataEditFGB, you are already passing the type information to the super class. So, when you call theFGBClass.getClass().getSuperClass(), you will get a AbstractFieldGroupBind class that handles Cinema objects.
has comment: http://stackoverflow.com/comment/36825018
type: Answer
has comment: http://stackoverflow.com/comment/36819786
answers question: http://stackoverflow.com/q/23907615

http://stackoverflow.com/a/23830716
type: Answer
upvote count: 1
has body: A frame can only handle one component by default. Create a JPanel and add it to the JFrame, then specify a layout for your JPanel and start adding components to it, instead of the frame
answers question: http://stackoverflow.com/q/23830587
downvote count: 0
score: 1

http://stackoverflow.com/comment/99308284
comment on: http://stackoverflow.com/a/23867243
type: AnswerComment
score: 0
type: Comment
has text: Hibernate/JPA isn't able to automatically create a value for your non-id-properties. The @ GeneratedValue annotation is only used in conjunction with @Id to create auto-numbering

http://stackoverflow.com/comment/36678693
has text: @CyberneticTwerkGuruOrc, that is a nonconstructive comment.
comment on: http://stackoverflow.com/q/23836980
type: Comment
type: QuestionComment
score: 0

math
tags question: http://stackoverflow.com/q/23833111
type: Tag
tags question: http://stackoverflow.com/q/23815320
tags question: http://stackoverflow.com/q/23883922
tags question: http://stackoverflow.com/q/23937825
tags question: http://stackoverflow.com/q/23829404
tags question: http://stackoverflow.com/q/23821833
tags question: http://stackoverflow.com/q/23901542
tags question: http://stackoverflow.com/q/23879042
tags question: http://stackoverflow.com/q/23803243
tags question: http://stackoverflow.com/q/23837850
tag name: math
tags question: http://stackoverflow.com/q/23901519

javassist
tags question: http://stackoverflow.com/q/23839945
type: Tag
tags question: http://stackoverflow.com/q/23827311
tag name: javassist

http://stackoverflow.com/comment/36821245
score: 0
type: Comment
has text: Thank you, that looks great. Will test it right away, but it seems that it is just what I need...
comment on: http://stackoverflow.com/a/23911149
type: AnswerComment

http://stackoverflow.com/a/23867662
score: 1
upvote count: 1
type: Answer
has body: because the asynchronous AsyncTask you can not call a method and obtain the return value; you could use a AsyncTask on your inline code and get on postExecute your JSON object: new AsyncTask&lt;String, String, JSONObject&gt;(){ @Override protected Void doInBackground(String... params) { //... } @Override protected void onPostExecute(JSONObject result) { // ... } }.execute(...);
answers question: http://stackoverflow.com/q/23867381
downvote count: 0

http://stackoverflow.com/a/23941802
answers question: http://stackoverflow.com/q/23936152
type: Answer
has body: Based on the example, I would say that instead of var data = (byte array returned from servlet) PDFJS.getDocument(data).then(function(pdf) {}); I think you should use: PDFJS.getDocument(servlet_url).then(function(pdf) { // you can now use *pdf* here }); A servlet that returns a PDF file should be no different to the client than a PDF file on the server, and the example uses PDFJS.getDocument('helloworld.pdf').then(... so this function obviously takes a URL.
score: 1
upvote count: 1
downvote count: 0

interface
tags question: http://stackoverflow.com/q/23900735
tags question: http://stackoverflow.com/q/23850331
tag name: interface
tags question: http://stackoverflow.com/q/23917156
tags question: http://stackoverflow.com/q/23811904
tags question: http://stackoverflow.com/q/23784348
tags question: http://stackoverflow.com/q/23918577
tags question: http://stackoverflow.com/q/23883750
tags question: http://stackoverflow.com/q/23830105
tags question: http://stackoverflow.com/q/23811479
type: Tag
tags question: http://stackoverflow.com/q/23873257
tags question: http://stackoverflow.com/q/23871675
tags question: http://stackoverflow.com/q/23810509
tags question: http://stackoverflow.com/q/23929947
tags question: http://stackoverflow.com/q/23836415
tags question: http://stackoverflow.com/q/23819269
tags question: http://stackoverflow.com/q/23842156
tags question: http://stackoverflow.com/q/23840887
tags question: http://stackoverflow.com/q/23879227
tags question: http://stackoverflow.com/q/23781398
tags question: http://stackoverflow.com/q/23886848

http://stackoverflow.com/q/23788369
tagged with: arraylist
has answer: http://stackoverflow.com/a/23789009
tagged with: android
tagged with: onclicklistener
has answer: http://stackoverflow.com/a/23789062
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has title: How do I set the OnClickListener to Open a New Activity (or Page) for an ArrayList with an Adapter?
type: Question
possible better answer: http://stackoverflow.com/a/23789062
answer count: 2
has body: I am trying to get each item in the array to open a page after a person clicks on them. I have searched all over, but nothing works and it seems nothing answers my specific answer. Here's my code: package com.projectexe; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.SimpleAdapter; public class MainActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate ( savedInstanceState ) ; ArrayList&lt;Map&lt;String, String&gt;&gt; list = buildData(); String[] from = { "article", "description" }; int[] to = { android.R.id.text1, android.R.id.text2 }; SimpleAdapter adapter = new SimpleAdapter(this, list, android.R.layout.simple_list_item_2, from, to); setListAdapter(adapter); } private ArrayList&lt;Map&lt;String, String&gt;&gt; buildData() { ArrayList&lt;Map&lt;String, String&gt;&gt; list = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); list.add(putData("Article 1", "Description 1: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nunc tellus, laoreet eu felis quis, hendrerit tincidunt turpis. Donec semper consequat erat, vel ornare odio tempus sed. Mauris sollicitudin libero dui, nec dignissim dolor tincidunt sit amet. Duis gravida lorem sed vestibulum vulputate. Etiam varius scelerisque vehicula.")); list.add(putData("Article 2", "Description 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nunc tellus, laoreet eu felis quis, hendrerit tincidunt turpis. Donec semper consequat erat, vel ornare odio tempus sed. Mauris sollicitudin libero dui, nec dignissim dolor tincidunt sit amet. Duis gravida lorem sed vestibulum vulputate. Etiam varius scelerisque vehicula.")); list.add(putData("Article 3", "Description 3: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nunc tellus, laoreet eu …
accepted answer: http://stackoverflow.com/a/23789009
upvote count: 0
tagged with: adapter
favorite count: 0

http://stackoverflow.com/a/23808599
upvote count: 3
answers question: http://stackoverflow.com/q/23808474
has body: Use JSONObject and JSONArray int id = new JSONArray(my_json_string).getJSONObject(0).getJSONObject("customer").getInteger("id"); More informations on JSON in java here : http://www.json.org/java/
downvote count: 0
type: Answer
score: 3

websphere
tags question: http://stackoverflow.com/q/23835508
tags question: http://stackoverflow.com/q/23926124
tags question: http://stackoverflow.com/q/23879696
tags question: http://stackoverflow.com/q/23855860
tags question: http://stackoverflow.com/q/23806925
tags question: http://stackoverflow.com/q/23882128
tags question: http://stackoverflow.com/q/23812642
tags question: http://stackoverflow.com/q/23779451
tag name: websphere
type: Tag
tags question: http://stackoverflow.com/q/23884268
tags question: http://stackoverflow.com/q/23840297
tags question: http://stackoverflow.com/q/23915505

http://stackoverflow.com/comment/36723243
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23859921
has text: Yesssss, you are right. It was y mistake. Thanks very much.
type: AnswerComment

http://stackoverflow.com/q/23897984
tagged with: java
has body: I am using Eclipse Kepler, and i have installed Spring IDE and STS but when i created Spring MVC Template project i have got errors, then i went to Maven Update options but i have got error. I don't know why. Please, help! Errors: Error during build of project [firstSpring] Errors occurred during the build. Errors running builder 'Faceted Project Validation Builder' on project 'firstSpring'. Could not initialize class org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants Errors running builder 'Validation' on project 'firstSpring'. org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants An internal error occurred during: "J2EE Component Mapping Update". org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
tagged with: eclipse
has answer: http://stackoverflow.com/a/25993116
has comment: http://stackoverflow.com/comment/40704429
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/36807514
score: 7
favorite count: 0
has title: Creating Spring MVC app
has answer: http://stackoverflow.com/a/24305483
answer count: 2
tagged with: maven
has comment: http://stackoverflow.com/comment/40701379
upvote count: 7
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36836499

http://stackoverflow.com/a/23823866
accepted answer of: http://stackoverflow.com/q/23816769
type: Answer
has body: Technically, nothing speaks against recursively calling run() from within itself. Nevertheless, I'd suggest to move the code into a Runnable that's then run by the thread as it is bad design to subclass Thread and override run to implement a task: public class MyTask implements Runnable { public void run() { // ... run(); // recursive call // ... } } // somewhere else: Thread thread = new Thread(new MyTask()); thread.start(); // or even better: ExecutorService executor = Executors.newSingleThreadExecutor(); executor.execute(new MyTask());
score: 0
answers question: http://stackoverflow.com/q/23816769
type: AcceptedAnswer

http://stackoverflow.com/a/23794292
score: 8
answers question: http://stackoverflow.com/q/23794186
downvote count: 0
upvote count: 8
type: Answer
has body: Foo::getBar corresponds to a function that takes a Foo (the target object) and returns a String. The interface Function&lt;Foo, String&gt; can be used to represent such a function. On the other hand, Foo::setBar corresponds to a function that takes two arguments, a Foo (the target object) and a String (the first parameter). The matching interface is BiConsumer&lt;Foo, String&gt;. That means you need an overload for BiConsumer: &lt;T, U&gt; void capture(BiConsumer&lt;T, U&gt; setter) { // ... }

http://stackoverflow.com/comment/36665940
type: QuestionComment
comment on: http://stackoverflow.com/q/23830434
score: 0
has text: File not found, IntakeSystem Exception in thread "main" java.lang.NullPointerException at IntakeSystem.collectSystem(IntakeSystem.java:37) at IntakeSystem.<init>(IntakeSystem.java:21) at IntakeSystem.main(IntakeSystem.java:70)
type: Comment

http://stackoverflow.com/comment/36859979
type: AnswerComment
comment on: http://stackoverflow.com/a/23932216
type: Comment
score: 2
has text: You have to write this function once and then just call it. Why does a call to `stream(...)` clutter your code?

http://stackoverflow.com/comment/36758681
type: Comment
has text: Ok. Please update your question with full Poem class, I'll verify the getter and setter methods.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23878658

http://stackoverflow.com/a/23938234
score: 0
has comment: http://stackoverflow.com/comment/36871238
has body: It is funny, is almost the same solution that I proposed in your last question. Solving your problem with GQuery it should be easy, something like: //add TextBox and Button to the DOM GQuery.$(button).click(new Function() { public void f() { GQuery.$(textBox).click(); }}); //if you want to test if the click event has been fired GQuery.$(textBox).click(new Function() { public void f() { Window.alert("Text Box clicked"); }}); I have not tested personally the code, so if you have any error or doubt, just let me know :)
answers question: http://stackoverflow.com/q/23937798
has comment: http://stackoverflow.com/comment/36881354
has comment: http://stackoverflow.com/comment/36883537
type: Answer
has comment: http://stackoverflow.com/comment/36871107
has comment: http://stackoverflow.com/comment/36871436

http://stackoverflow.com/q/23922447
has comment: http://stackoverflow.com/comment/36842318
has answer: http://stackoverflow.com/a/23922621
possible better answer: http://stackoverflow.com/a/23922627
upvote count: 1
has answer: http://stackoverflow.com/a/23922627
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36841971
has title: My program shows Out Of Memory Error : java heap space
has body: I've written a program in Java that stores a list of pictures, similar to Gallery in smart Phones and i end up with OutOfMemoryError : java heap space. here is my code where i get an OutOfMemoryError... public void showImages(){ // imageList is an array of path of pictures for(int i=0; i&lt;imageList.length; i++){ ImageIcon icon = new ImageIcon(imageList[i]); JLabel label = new JLabel(); label.setIcon(icon); panel.add(label); //problem is here // I have made a JFrame and added a JPanel which has GridLayout // MY Problem Is.. // When i try to add images in the panel, // then my program show 'Out Of Memory Error : java head space' // for each and every picture } }
type: Question
accepted answer: http://stackoverflow.com/a/23922621
score: -2
has comment: http://stackoverflow.com/comment/36841827
answer count: 2
has comment: http://stackoverflow.com/comment/36841953
has comment: http://stackoverflow.com/comment/36841841
favorite count: 0

http://stackoverflow.com/q/23796960
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23797251
has title: Is there a way to use ScheduledExecutorService with ExecutorCompletionService?
type: Question
answer count: 2
upvote count: 6
tagged with: completion-service
favorite count: 0
possible better answer: http://stackoverflow.com/a/23797470
tagged with: multithreading
score: 6
has answer: http://stackoverflow.com/a/23797470
accepted answer: http://stackoverflow.com/a/23797251
has body: I'm trying to use ExecutorCompletionService and ScheduledExecutorService together. What I need to do is schedule disparate activities that each have "delays before execution" and then "reschedule them" (which different delays) based upon the result of the last run." The problem that I have is that I cannot use ExcecutorCompletionService submit with a "delay" I tried the following, but it blocks forever... Obviously I'm missing a fundamental issue in the Java Language. Is there anyway to schedule tasks to the ScheduledExecutorService such that the CompletionService "knows about it"? public class Bar { private ScheduledExecutorService scheduledExecutor; private Future&lt;Status&gt; action1Future; private Future&lt;Status&gt; action2Future; private ExecutorCompletionService&lt;Status&gt; pool; private long delay1 = 10; private long delay2 = 20; private long delay3 = 30; public void start() { scheduledExecutor = Executors.newScheduledThreadPool(3); Action1 a1 = new ActionOne(); // Action1 implements Callable&lt;Status&gt; Action2 a2 = new ActionTwo(); // Action2 implements Callable&lt;Status&gt; pool = new ExecutorCompletionService&lt;Status&gt;(scheduledExecutor); action1Future = scheduledExecutor.schedule(a1, delay1, TimeUnit.SECONDS); action2Future = scheduledExecutor.schedule(a2, delay1, TimeUnit.SECONDS); monitorAndRestart(); } private void monitorAndRestart() { boolean isDone=false; do { try { // THIS IS WHERE IT BLOCKS. Future&lt;Status&gt; processedItem = pool.get(); if (processedItem == action1Future) { if (processedItem.get() == Status.GOOD) { action1Future = scheduledExecutor.schedule(new ActionOne(), delay1, TimeUnit.SECONDS); } else { action1Future = scheduledExecutor.schedule(new ActionOne(), delay2, TimeUnit.SECONDS); } } else if (processedItem == action2Future) { if (processedItem.get() == Status.GOOD) { action1Future = scheduledExecutor.schedule(new ActionOne(), delay2, TimeUnit.SECONDS); } else { action1Future = scheduledExecutor.schedule(new ActionOne…

http://stackoverflow.com/a/23888560
upvote count: 2
has comment: http://stackoverflow.com/comment/36779328
has body: Like you can see on the SonarQube documentation, we strongly advise you to first run mvn clean install and then mvn sonar:sonar separately - otherwise you can have some side effects. However, if you want to have all this in a single run, this is a Maven-related question. You just have to bind the "sonar" goal to the "install" phase in your POM, with something like: ... org.codehaus.mojo sonar-maven-plugin install sonar ...
downvote count: 0
has comment: http://stackoverflow.com/comment/46461493
has comment: http://stackoverflow.com/comment/36777150
has comment: http://stackoverflow.com/comment/36801891
answers question: http://stackoverflow.com/q/23887035
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36809001

http://stackoverflow.com/comment/36653072
comment on: http://stackoverflow.com/q/23823071
has text: Please Help Me To Solve This.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/49816191
downvote count: 1
has body: In Cloudera issues you must check the ecryption types in CM -> Administration -> Security -> Kerberos -> Kerberos configuration. the encryptions types are the same that Kerberos Mit KDC in /etc/krb5.conf First all, stop all services and services managment too. then redeploy all keytabs.
score: -1
type: Answer
answers question: http://stackoverflow.com/q/23867628
upvote count: 0

http://stackoverflow.com/comment/36662683
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23828692
type: AnswerComment
has text: `".#+."` doesn't match ANY of the three example Strings in the question.

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

http://stackoverflow.com/comment/36574399
comment on: http://stackoverflow.com/a/23782007
type: AnswerComment
score: 0
type: Comment
has text: Just wondering, would rewriting the `invokeAll()` method in the Java API (as well as other methods which might be missing the wildcard) to include the wildcard break any existing code? Because that seems like a rather egregious error... Unless there's some design issue that I'm not aware of.

http://stackoverflow.com/q/23794317
answer count: 1
has answer: http://stackoverflow.com/a/23794403
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
linked to: http://stackoverflow.com/q/18645050
accepted answer: http://stackoverflow.com/a/23794403
type: AnsweredQuestion
has body: Why is IACircle constructor not called? This is how I load the Json .. BufferedReader br = new BufferedReader(in); LevelDefinition ld = new Gson().fromJson(br, LevelDefinition.class); Json string .. { "iaCircles": [ { "x": -32.0, "y": -5.0, "angle": 0.0, "radius": 2.5, "density": 0.0, "friction": 0.0, "restitution": 1.0, "textureSelection": "CIRCLE", "inflictsDamage": true, "fixedRotation":true }, { "x": 55.0, "y": -5.0, "angle": 0.0, "radius": 2.5, "density": 0.0, "friction": 0.0, "restitution": 1.0, "textureSelection": "CIRCLE", "inflictsDamage": true, "fixedRotation":true } ] } Java class parsed into .. public class LevelDefinition { private Vector&lt;IACircle&gt; iaCircles; } IACircle definition .. public class IACircle { public IACircle ( float x, float y, float angle, float radius, float density, float friction, float restitution, String textureSelection, boolean inflictsDamage, boolean fixedRotation) { System.out.println("constructor called, circle"); } }
type: Question
score: 0
has title: Object constructor not called when parsed from json string

singleton
tags question: http://stackoverflow.com/q/23843934
type: Tag
tags question: http://stackoverflow.com/q/23898350
tags question: http://stackoverflow.com/q/23805016
tags question: http://stackoverflow.com/q/23805470
tag name: singleton

http://stackoverflow.com/comment/36728941
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23863040
has text: Not clear what you are asking. If you want read-only value then why dont you remove the setValue method?

http://stackoverflow.com/q/23866413
has answer: http://stackoverflow.com/a/29849807
has comment: http://stackoverflow.com/comment/36734909
tagged with: git
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/57987234
has comment: http://stackoverflow.com/comment/36735438
has title: Eclipse: Some or all projects can not be imported because they already exist in the workspace
tagged with: eclipse
has answer: http://stackoverflow.com/a/23866769
accepted answer: http://stackoverflow.com/a/23866769
has comment: http://stackoverflow.com/comment/36735012
possible better answer: http://stackoverflow.com/a/29849807
has answer: http://stackoverflow.com/a/35852150
has comment: http://stackoverflow.com/comment/36734948
score: 4
has body: I'm sorry, I know that question is asked quite often. But non of the scenarios suits my problem. I'm using Eclipse (in Win7) with Git. Within a Git-branch I created a new project. Then I switched back on the master-branch. There the project is not in the workspace. But when I want to add it, I get the following error: Some or all projects can not be imported because they already exist in the workspace My problem is, that the project is NOT in the workspace - as seen in Eclipse. But sure, it's on the hard disk, because it's part of my Git repository. So I can't delete it there. According to other posts, I removed it from this folder: C:\Development\workspace.metadata.plugins\org.eclipse.core.resources.projects But still I can't re-add it to the Eclipse workspace. Any idea?
favorite count: 0
has answer: http://stackoverflow.com/a/50421259
upvote count: 4
downvote count: 0
answer count: 5

http://stackoverflow.com/q/23859460
has answer: http://stackoverflow.com/a/23859725
favorite count: 0
has body: I'm using JPA with Hibernate as a JPA provider. I cannot figure out how to configure my entities to apply a hibernate filter to a One-to-Many association. I have a Master with a collection of Details. Here are my entity definitions: @Entity public class Master extends Base { private List&lt;Detail&gt; details; @OneToMany @OrderColumn @JoinTable(name = "master_details") @Filter(name = "notDeleted") // @Where(clause = "deleted = 'false'") public List&lt;Detail&gt; getDetails() { return details; } public void setDetails(List&lt;Detail&gt; details) { this.details = details; } } @Entity @FilterDef(name = "notDeleted", defaultCondition = "deleted = false") public class Detail extends Base { private Boolean deleted = false; public Boolean getDeleted() { return deleted; } public void setDeleted(Boolean deleted) { this.deleted = deleted; } } The Base is nothing special but a simple MappedSuperClass: @MappedSuperclass public class Base { private Long id; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId() { return id; } public void setId(Long id) { this.id = id; } } When loading a Master by entityManager.find(Master.class, mid), the filter should prvent all Details from loading but I checked the sql queries generated by hibernate (by show_sql=true) and no where clause is added when loading details of the master !!! A sample query generated by hibernate is: select details0_.Master_id as Master1_6_1_, details0_.details_id as details2_1_, details0_.details_ORDER as details3_1_, detail1_.id as id7_0_, detail1_.deleted as deleted7_0_, from master_details details0_ inner join Detail detail1_ on details0_.details_id=detail1_.id where details0_.Master_id=? After some search there was some hints that "loading by id will not use filters, use queries" so I tried the following but no gain :( entityManager.createQuery("from Master where id=" + mid).getSingleResult(); But just if the @Where above getDetails is uncommented (instead of @Filter), its clause is added to…
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23859725
type: Question
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/52075709
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: one-to-many
tagged with: hibernate-mapping
has title: Hibernate @Filter does not work in JPA?

http://stackoverflow.com/comment/36846735
type: Comment
type: QuestionComment
has text: Sorry, my bad. I have edited the question.
score: 0
comment on: http://stackoverflow.com/q/23902218

http://stackoverflow.com/q/23843552
has comment: http://stackoverflow.com/comment/36711590
has comment: http://stackoverflow.com/comment/36709817
score: 0
has comment: http://stackoverflow.com/comment/36709926
tagged with: client-server
answer count: 2
has comment: http://stackoverflow.com/comment/36709350
has comment: http://stackoverflow.com/comment/36710848
tagged with: httpclient
has comment: http://stackoverflow.com/comment/36710249
has comment: http://stackoverflow.com/comment/36711944
has body: My application generates a UDID and sends it to the server side. However, on the server side the $_POST variable is empty. My php code is working as i have tried it with test data. There is something wrong with the Android code but i cannot figure it out. I am running the app on the emulator. SecondAct.java -- public class SecondAct extends Activity { private String android_id; public String getUDID(){ android_id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID); return android_id; } public void PostServer(View view){ ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if(networkInfo != null &amp;&amp; networkInfo.isConnected()){ //send data new PostHttp(getUDID()).execute(); } else{ //display error } } PostHttp.java -- public class PostHttp extends AsyncTask&lt;Void,Integer,Void&gt; { private String id = null; PostHttp(String s){ id = s; } protected Void doInBackground(Void... params) { // TODO Auto-generated method stub //Create the HTTP Post HttpParams httpParameters = new BasicHttpParams(); //Setup timeouts -- for later HttpClient httpclient = new DefaultHttpClient(httpParameters); HttpPost httppost = new HttpPost(webphp); try{ ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("id",id)); nameValuePairs.add(new BasicNameValuePair("time",time)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); String result = EntityUtils.toString(resEntity); System.out.println(result); } catch (Exception e){ e.printStackTrace(); } return null; } Geo.php -- &lt;? mysql_connect($host, $username, $password); mysql_select_db($database) or die("Unable to connect to database"); $query = "INSERT INTO UDID (Time, UDID) VALUES (".$_POST['time'].", ".$_POST['id'].");"; $re…
possible better answer: http://stackoverflow.com/a/23843613
tagged with: android
has comment: http://stackoverflow.com/comment/36703887
has comment: http://stackoverflow.com/comment/36711880
has title: Post Data from Android (simulator) - implementation problems
has comment: http://stackoverflow.com/comment/36711658
accepted answer: http://stackoverflow.com/a/23858479
has comment: http://stackoverflow.com/comment/36710334
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36712012
tagged with: java
has comment: http://stackoverflow.com/comment/36703097
has comment: http://stackoverflow.com/comment/36711798
has answer: http://stackoverflow.com/a/23858479
type: Question
has comment: http://stackoverflow.com/comment/36711626
has answer: http://stackoverflow.com/a/23843613
has comment: http://stackoverflow.com/comment/36711717

http://stackoverflow.com/comment/36760253
type: QuestionComment
type: Comment
has text: @AnubianNoob - I wouldn't have gone as far, but I tend to try perhaps a little too hard to get the OP to actually do some work.
comment on: http://stackoverflow.com/q/23879656
score: 0

http://stackoverflow.com/a/23846674
accepted answer of: http://stackoverflow.com/q/23845288
upvote count: 2
type: AcceptedAnswer
has body: The JAR containing org.netbeans.lib.awtextra.AbsoluteLayout() may be found in the NetBeans distribution. On Mac OS X, for example, it's here: NetBeans 7.4.app/Contents/Resources/NetBeans/java/modules/ext/AbsoluteLayout.jar $ jar tf NetBeans\ 7.4.app/Contents/Resources/NetBeans/java/modules/ext/AbsoluteLayout.jar META-INF/ META-INF/MANIFEST.MF org/ org/netbeans/ org/netbeans/lib/ org/netbeans/lib/awtextra/ org/netbeans/lib/awtextra/AbsoluteConstraints.class org/netbeans/lib/awtextra/AbsoluteLayout.class As an aside, now may a good time to remove the dependency by using a suitable layout.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23845288

http://stackoverflow.com/q/23786792
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36583220
tagged with: push
has answer: http://stackoverflow.com/a/23787005
has answer: http://stackoverflow.com/a/23786908
linked to: http://stackoverflow.com/q/2872222
answer count: 2
has body: I want to know why the push method in Stack has a return type? I checked Oracles documentation, but only the return type is mentioned. Can anyone tell me why the return type is required?
has title: Why does Java Stack.push give a return type even though I don't need it?
favorite count: 0
type: UnansweredQuestion
score: 3
tagged with: stack
tagged with: java
downvote count: 1

http://stackoverflow.com/q/23810199
accepted answer: http://stackoverflow.com/a/23811353
has comment: http://stackoverflow.com/comment/36627381
upvote count: 1
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36627496
type: Question
downvote count: 0
answer count: 1
has body: I need to modify public immutable field (with val qualifier) in an existing object imported from a scala library which I can not modify through source code. How can it be done with reflection functionality? There are ways to modify final field in java, so there should be one for scala as well, but I'm not sure about it. final class Example(src : String) { lazy val internal = src } The internal field is AnyRef if it matters. P.S. I understand that I'm craving for desperate measure.
has answer: http://stackoverflow.com/a/23811353
has comment: http://stackoverflow.com/comment/36629569
favorite count: 0
has comment: http://stackoverflow.com/comment/36627323
has title: Modify immutable scala class field via reflection
tagged with: scala

http://stackoverflow.com/q/23932857
accepted answer: http://stackoverflow.com/a/23932912
tagged with: tomcat
score: 0
has title: web app on machine (on local computer works correctly)
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23932912
upvote count: 1
linked to: http://stackoverflow.com/q/34588
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I have an error: Exception in thread "TCPSelector" java.lang.NoClassDefFoundError: org/eclipse/net4j/channel/ChannelException at org.eclipse.net4j.internal.tcp.TCPAcceptor.createConnector(TCPAcceptor.java:218) at org.eclipse.net4j.internal.tcp.TCPAcceptor.handleAccept(TCPAcceptor.java:188) at org.eclipse.net4j.internal.tcp.TCPSelector.handleSelection(TCPSelector.java:230) at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.java:179) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.eclipse.net4j.channel.ChannelException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) ... 5 more Exception in thread "TCPSelector" java.lang.ExceptionInInitializerError at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:51) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487) at org.eclipse.internal.net4j.buffer.Buffer.write(Buffer.java:306) at org.eclipse.net4j.internal.tcp.TCPConnector.handleWrite(TCPConnector.java:311) at org.eclipse.net4j.internal.tcp.TCPSelector.handleSelection(TCPSelector.java:264) at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.java:179) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Too many open files at sun.nio.ch.FileDispatcherImpl.init(Native Method) at sun.nio.ch.FileDispatcherImpl.&lt;clinit&gt;(FileDispatcherImpl.java:35) ... 9 more Exception in thread "TCPSelector" java.lang.NoClassDefFoundError: Could not initialize class sun.nio.ch.FileDispatcherImpl at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:51) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487) at org.eclipse.internal.net4j.buffer.Buffer.…
type: Question

http://stackoverflow.com/comment/36604226
type: QuestionComment
comment on: http://stackoverflow.com/q/23797816
has text: When you use the DBMS to execute the query you have same performance ?
type: Comment
score: 1

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

http://stackoverflow.com/q/23801912
has answer: http://stackoverflow.com/a/23801968
has comment: http://stackoverflow.com/comment/36611748
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36612200
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23802186
score: 1
has body: this one might sound trivial question but I am not able to arrive at a proper solution. Request for help. Problem : In my code, I get 2 events (one after the other) in a sequence. The sequence could be "event A" first then "event B" or vice versa. If my event sequence is AB then I need to take some action and similarly if my sequence is BA, then I need to take another action. However, I am finding it tough to determine the sequence and set a boolean value. One solution I have thought of is to use stack. Both these events will be pushed to stack. I will check if my stack size is 2, then I will pop the last value and see which event it is. If it is A, then i will add logic for BA and if it is B, then I will add logic for AB. Once it is done I will clear my stack. Is there a simpler way to do it? Please advice
tagged with: java
accepted answer: http://stackoverflow.com/a/23802186
has answer: http://stackoverflow.com/a/23802142
has title: Java - Determine event sequence - AB or BA
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36612140
tagged with: sequence
favorite count: 0
has comment: http://stackoverflow.com/comment/36611959
possible better answer: http://stackoverflow.com/a/23801968

http://stackoverflow.com/q/23816771
answer count: 1
tagged with: user-interface
downvote count: 0
tagged with: jmonkeyengine
favorite count: 0
has title: Custom controller with NiftyGUI
tagged with: nifty-gui
accepted answer: http://stackoverflow.com/a/23847018
has body: I have a custom button that switche image when clicked so I need to handle a mouseEvent click. But, it only react to keyEvent on the function "inputEvent(NiftyInputEvent inputEvent)"... I would have to pass a NiftyMousePrimaryClickedEvent but then, it would'nt implements the Controller class...Am I doing this right? Here my custom image button: public class ImageButtonControl implements Controller{ private Nifty nifty; private Screen screen; private Element img1; private Element img2; private Properties properties; private boolean isPressed = false; private ImageRenderer render1; private NiftyImage imageNifty1; private NiftyImage imageNifty2; private FocusHandler focusHandler; @Override public void bind( final Nifty nifty, final Screen screenParam, final Element element, final Properties parameter, final Attributes controlDefinitionAttributes) { this.nifty = nifty; this.screen = screenParam; this.properties = parameter; img1 = element.findElementByName("image-1"); img2 = element.findElementByName("image-2"); initImages(this.nifty, this.screen, properties.getProperty("img-1"),properties.getProperty("img-2")); //focusHandler = screenParam.getFocusHandler(); System.out.println("Initialisation completed.");} @Override public void init(Properties prprts, Attributes atrbts) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onStartScreen() { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onFocus(final boolean getFocus) { //super.onFocus(getFocus); System.out.println("---Clicked event focus---"); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public boolean inputEvent(NiftyInputEvent inputEvent) { System.out.println("---Clicked event focus---"); return false; } public voi…
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23847018

http://stackoverflow.com/comment/36664203
comment on: http://stackoverflow.com/q/23829601
has text: Ok, if others agree I shall move it there! :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23859475
tagged with: php
tagged with: regex
type: AnsweredQuestion
has title: Troubles using RegEx on PHP
tagged with: java
type: Question
score: 0
has body: I have a sip.conf file that contains data like that : #&lt;COMPTE [6007](template) fullname = ggg username = ggg secret = nana COMPTE&gt;# #&lt;COMPTE [6008](template) fullname = dada username = dada secret = dada COMPTE&gt;# I have created a method using java : Matcher matcher = Pattern.compile("(?m)^#&lt;COMPTE.*?COMPTE&gt;#",Pattern.MULTILINE | Pattern.DOTALL).matcher(chaine); while (matcher.find()) { comptes=matcher.group(); } I want something like that in PHP I have tried many things but it doesn't seems to work, any help ?
answer count: 1
has answer: http://stackoverflow.com/a/23859679
accepted answer: http://stackoverflow.com/a/23859679

http://stackoverflow.com/comment/36649537
type: AnswerComment
type: Comment
has text: I editted my question. The validUnsentAddress() method is from SendFailedException Class
score: 0
comment on: http://stackoverflow.com/a/23820881

http://stackoverflow.com/comment/36647553
has text: This was a great answer. But I was allowed to chose only one accepted answer. But well explained. Thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23820386

http://stackoverflow.com/comment/36705456
has text: Please share your spring context XML
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23849850

http://stackoverflow.com/a/23880744
downvote count: 1
answers question: http://stackoverflow.com/q/23880493
has body: Check this out void getNum() { for (int i =0; i&lt; 3; i++) { phone[i] = (p[i] + code[0]) % 10; } for (int i =3; i&lt; 6; i++) { phone[i] = (p[i] + code[1]) % 10; } for (int i =6; i&lt; p.length; i++) { phone[i] = (p[i] + code[2]) % 10; } }
has comment: http://stackoverflow.com/comment/36762093
has comment: http://stackoverflow.com/comment/36762268
score: -1
has comment: http://stackoverflow.com/comment/36762103
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36773134
type: Answer
has comment: http://stackoverflow.com/comment/36762143
accepted answer of: http://stackoverflow.com/q/23880493

http://stackoverflow.com/comment/36764883
type: QuestionComment
comment on: http://stackoverflow.com/q/23882242
score: 0
has text: Ya i would get string everytime in same manner.
type: Comment

http://stackoverflow.com/q/23858413
tagged with: api
has title: HBase filtering non-empty strings
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23860102
tagged with: hbase
type: UnansweredQuestion
has body: I have an HBase table with 'a' and 'b' column families. Every row has at least one column in family 'a', but may not have any columns in family 'b'. How can I select only rows that do not contain columns in 'b' family? (I'm using HBase Java API)
tagged with: java
type: Question

swing
tags question: http://stackoverflow.com/q/23931266
tags question: http://stackoverflow.com/q/23794003
tags question: http://stackoverflow.com/q/23875277
tags question: http://stackoverflow.com/q/23905288
tags question: http://stackoverflow.com/q/23802642
tags question: http://stackoverflow.com/q/23821442
tags question: http://stackoverflow.com/q/23850296
tags question: http://stackoverflow.com/q/23923643
tags question: http://stackoverflow.com/q/23868293
tags question: http://stackoverflow.com/q/23909433
tags question: http://stackoverflow.com/q/23789257
tags question: http://stackoverflow.com/q/23819127
tags question: http://stackoverflow.com/q/23924553
tags question: http://stackoverflow.com/q/23856340
tags question: http://stackoverflow.com/q/23799158
tags question: http://stackoverflow.com/q/23839921
tags question: http://stackoverflow.com/q/23864345
tags question: http://stackoverflow.com/q/23924066
tags question: http://stackoverflow.com/q/23780963
tags question: http://stackoverflow.com/q/23860331
tags question: http://stackoverflow.com/q/23894839
tags question: http://stackoverflow.com/q/23857967
tags question: http://stackoverflow.com/q/23808962
tags question: http://stackoverflow.com/q/23825492
tags question: http://stackoverflow.com/q/23936433
tags question: http://stackoverflow.com/q/23856784
tags question: http://stackoverflow.com/q/23803297
tags question: http://stackoverflow.com/q/23837704
tags question: http://stackoverflow.com/q/23804388
tags question: http://stackoverflow.com/q/23900695
tags question: http://stackoverflow.com/q/23929249
tags question: http://stackoverflow.com/q/23861345
tags question: http://stackoverflow.com/q/23840473
tags question: http://stackoverflow.com/q/23854920
tags question: http://stackoverflow.com/q/23903219
tags question: http://stackoverflow.com/q/23858007
tags question: http://stackoverflow.com/q/23788776
tags question: http://stackoverflow.com/q/23819282
tags question: http://stackoverflow.com/q/23782008
tags question: http://stackoverflow.com/q/23909355
tags question: http://stackoverflow.com/q/23796986
tags question: http://stackoverflow.com/q/23806158
tags question: http://stackoverflow.com/q/23940400
tags question: http://stackoverflow.com/q/23881226
tags question: http://stackoverflow.com/q/23876411
tags question: http://stackoverflow.com/q/23856048
tags question: http://stackoverflow.com/q/23878889
tags question: http://stackoverflow.com/q/23875435
tags question: http://stackoverflow.com/q/23873613
tags question: http://stackoverflow.com/q/23848668
tags question: http://stackoverflow.com/q/23856818
tags question: http://stackoverflow.com/q/23901234
tags question: http://stackoverflow.com/q/23832109
tags question: http://stackoverflow.com/q/23904359
tags question: http://stackoverflow.com/q/23790830
tags question: http://stackoverflow.com/q/23848083
tags question: http://stackoverflow.com/q/23792433
tags question: http://stackoverflow.com/q/23902161
tags question: http://stackoverflow.com/q/23911836
tags question: http://stackoverflow.com/q/23821529
tags question: http://stackoverflow.com/q/23902449
tags question: http://stackoverflow.com/q/23792823
tags question: http://stackoverflow.com/q/23871041
tags question: http://stackoverflow.com/q/23851049
tags question: http://stackoverflow.com/q/23795033
tags question: http://stackoverflow.com/q/23798778
tags question: http://stackoverflow.com/q/23866825
tags question: http://stackoverflow.com/q/23819196
tags question: http://stackoverflow.com/q/23792441
tags question: http://stackoverflow.com/q/23837504
tags question: http://stackoverflow.com/q/23937349
tags question: http://stackoverflow.com/q/23806378
tags question: http://stackoverflow.com/q/23881651
tags question: http://stackoverflow.com/q/23847066
tags question: http://stackoverflow.com/q/23883050
tags question: http://stackoverflow.com/q/23805885
tags question: http://stackoverflow.com/q/23782548
tags question: http://stackoverflow.com/q/23802312
tags question: http://stackoverflow.com/q/23826707
tags question: http://stackoverflow.com/q/23830105

http://stackoverflow.com/a/23899462
has comment: http://stackoverflow.com/comment/36799143
has comment: http://stackoverflow.com/comment/36798965
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/23899328
type: Answer
answers question: http://stackoverflow.com/q/23899328
has body: public enum ScreenOrientation { LANDSCAPE_FIXED("LANDSCAPE_FIXED", 0); // other values private final String s; private final int i; private ScreenOrientation(String s, int i) { this.s = s; this.i = i; } // getters for s and i @Override public String toString() { return this.getS(); } public static ScreenOrientation fromS(String s) { for( ScreenOrientation so : values()) if(so.getS().equalsIgnoreCase(s)) { return so; } throw new IllegalArgumentException(); } } Not sure what s and i equate to so give them more meaningful names. Also, override toString method as suggested in Javadocs: http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html#name()

http://stackoverflow.com/comment/37508149
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23810517
has text: Please also try to properly indent your code, so all text (such as `package name...` and the last `}` at the bottom of your question are in a nice, neat code block. Otherwise it is difficult for other users to easily read your code.
score: 0

http://stackoverflow.com/comment/36609007
type: Comment
has text: Thank you, retainAll is what I'm looking for.
comment on: http://stackoverflow.com/a/23800284
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36770927
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23884973
has text: Ya it has. I have tried it in my code.

http://stackoverflow.com/comment/36761245
type: Comment
comment on: http://stackoverflow.com/a/23859759
type: AnswerComment
score: 0
has text: A global boolean variable could be used (false by default). When the server returns the result it can be set according to it and a function with boolean parameter could be called which does your remaining work.

http://stackoverflow.com/comment/36852403
score: 0
has text: are you asking about jdk releases or jre releases?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23928190

http://stackoverflow.com/comment/36797081
type: AnswerComment
has text: @Lurk21 What if you avoid the wildcard and just go with a basic parameter of `Shape`?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23898577

http://stackoverflow.com/comment/36738761
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23868330
score: 1
has text: Can you post your config file ?

http://stackoverflow.com/comment/36752157
has text: Point taken. I actually found a broken crypto scheme once where pure RSA was used (problem one) and the two keys were used the wrong way around. Bouncy Castle let's you do that and then quietly changes the padding, which in this case meant no randomization on encryption.
comment on: http://stackoverflow.com/a/23875538
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23867726
has answer: http://stackoverflow.com/a/23867965
tagged with: package-managers
has body: I have several buttons on my view, each of which that opens other applications. Calendar, Clock, Calculator etc etc. I am using the following code to get a list of apps and then I can select which one to run - final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final List pkgAppsList = getActivity().getPackageManager().queryIntentActivities( mainIntent, 0); startActivity(mainIntent); So I have this method set up for my Calendar button and my Clock button. I have chosen the clock app for my clock button and I have set it as default. But when I click on the Calendar button to choose, it automatically opens the clock app. I've tried this with other buttons, it wont let me choose, instead it opens the clock app, how can I set it up in a different way where I can select the clock app for clock and calendar for calendar? I have previously asked a question about this and I got an answers and used that method which was above, there is also no tutorials i can find about this either. Thanks for reading.
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
downvote count: 1
has title: Problems with intents
tagged with: java
type: Question
upvote count: 0
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/36737468
tagged with: class

http://stackoverflow.com/q/23871486
downvote count: 0
has body: I have the following format on my testNG tests: @Test(alwaysRun = true, dependsOnMethods = "testStep_1", description = "Enter the names, and verify that they are appearing correctly ") public void testStep_2() throws Exception{ } Is there a way to implement something that could read all test descriptions, and by that generating a test documentation. I tried to somehow include ITestNGMethod getDescription() to a afterInvocation(IInvokedMethod method, ITestResult testResult) so after each method is run, the description is returned, but with no success. Has anyone tried something similar?
answer count: 6
has title: Retrieving @Test description form testNG tests
score: 12
has answer: http://stackoverflow.com/a/36710863
has answer: http://stackoverflow.com/a/23871782
has answer: http://stackoverflow.com/a/35259585
favorite count: 0
tagged with: testng
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46885402
tagged with: java
has answer: http://stackoverflow.com/a/43938493
type: Question
tagged with: automation
upvote count: 12
has answer: http://stackoverflow.com/a/40994997

http://stackoverflow.com/comment/63679200
score: 0
comment on: http://stackoverflow.com/a/23905597
type: AnswerComment
has text: true, I have not handled the inverse case.
type: Comment

http://stackoverflow.com/q/23888598
tagged with: java
accepted answer: http://stackoverflow.com/a/45351620
has body: I saw this post http://cs.jsu.edu/wordpress/?p=498 and I tried using mathjax in offline I just want to include this code in my html w.loadDataWithBaseURL("http://bar/", " " +" " +" " +" ","text/html","utf-8",""); i tried many times but didn't work. i tried this html " I am not good at html help me please
has comment: http://stackoverflow.com/comment/36854248
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26974902
possible better answer: http://stackoverflow.com/a/26974902
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/45351620
has title: How to use Mathjax in android, offline
type: Question
tagged with: mathjax
type: AnsweredQuestion

http://stackoverflow.com/q/23923696
type: UnansweredQuestion
type: Question
score: 14
has answer: http://stackoverflow.com/a/26095729
has body: Eclipse was smart about this; IntelliJ not yet. Of course if a function is unused (and untested, I guess I should feel bad for that - even if it's just returning a simple variable, or implementing someone else's interface) but public, it may be used elsewhere. Looking under Inspections and searching for "unused," I don't see visibility settings. Does this granularity exist?
tagged with: java
tagged with: warnings
has title: Turn off unused code warning for public functions in IntelliJ
has answer: http://stackoverflow.com/a/79538292
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/23924251
favorite count: 0
tagged with: inspection
tagged with: visibility
answer count: 4
has answer: http://stackoverflow.com/a/48730152
upvote count: 14

http://stackoverflow.com/a/23793138
downvote count: 0
has body: If the server is linux or unix usually need an X server running to AWT work. It's ussually to start a virtual X server in linux with the command $ Xvfb :99 And then, you must start the java server with the DISPLAY environment variable export DISPLAY=:99
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23792976
answers question: http://stackoverflow.com/q/23792976

http://stackoverflow.com/q/23780821
has comment: http://stackoverflow.com/comment/36572350
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23780989
has answer: http://stackoverflow.com/a/23781040
accepted answer: http://stackoverflow.com/a/23781040
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23780989
has body: Hello guys i need your help here is my code public class act_numTria { public static void main(String[] args) { int z = 9; for(int x = 1; x &lt;= 4; x++) { for(int y = 4; y &gt;= x; y--) { System.out.print(z); z--; } System.out.print("\n"); } } } the output is: 9876 543 21 0 but it should be like this 6789 345 12 0
has title: java-Printing Reversed Triangle containing numbers 9-0

http://stackoverflow.com/comment/36841565
comment on: http://stackoverflow.com/q/23922238
score: 3
has text: As an aside, see [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) for the correct way to compare `String` contents.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23841550
has body: For instance: Dividing by 2 int med = lo + (hi - lo) / 2; Bitwise right shift int med = lo + hi &gt;&gt;&gt; 1; I'm wondering, is there any particular advantage to using a bitwise operation instead of dividing by 2? Does using a bitwise operation offer a more efficient or reliable calculation? I'm mostly wondering because java.util.Arrays uses the bitwise shift when performing a binary search.
has comment: http://stackoverflow.com/comment/36688108
score: 2
linked to: http://stackoverflow.com/q/1168451
has comment: http://stackoverflow.com/comment/36687852
tagged with: java
duplicate of: http://stackoverflow.com/q/1168451
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23841583
has title: Is there an advantage to using a bitwise operation opposed to dividing by 2 to find the median of an array?
upvote count: 3
has answer: http://stackoverflow.com/a/23843354
answer count: 3
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23841596
type: UnansweredQuestion
tagged with: bit-manipulation
duplicate of: http://stackoverflow.com/q/23534087

http://stackoverflow.com/q/23865909
has title: How should I go about saving/restoring progressBar?
type: AnsweredQuestion
tagged with: android-progressbar
has comment: http://stackoverflow.com/comment/36734557
score: 0
tagged with: java
tagged with: sharedpreferences
type: Question
has comment: http://stackoverflow.com/comment/36734075
answer count: 1
has answer: http://stackoverflow.com/a/23866242
has comment: http://stackoverflow.com/comment/36734103
has body: My app is mainly a timer that counts down from 20 hours. I am wondering which method I should use for saving the information necessary for resuming the app with the timer showing the correct value. I don't know if I should use savedInstanceState or SharedPreferences? My plan of action is to: 1. create a TimeStamp on the "Timer Start" button 2. save the TimeStamp variable with either the savedInstanceState or SharedPreferences 3. When app is closed and re-opened, get the TimeStamp variable 4. change progressBar status to display the correct remaining time based on the TimeStamp instead of restarting the progressBar from 0.
accepted answer: http://stackoverflow.com/a/23866242
tagged with: android

http://stackoverflow.com/q/23916211
has answer: http://stackoverflow.com/a/23919491
has comment: http://stackoverflow.com/comment/36830735
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36833278
score: 0
has body: I have 3 maven modules. One is the parent grouping the other 2 modules. All project folders are on the same root level. Though the deployment is not working. What's wrong with the following configuration? project-parent/pom.xml project-commons/pom.xml project-web/pom.xml parent-pom: de.myproject project-parent pom ../project-web web-pom: de.myproject project-parent 1.0.0 ../project-parent/pom.xml Result: [ERROR] The project de.myproject:project-parent:1.0.0 has 1 error [ERROR] Child module \project-parent\..\project-web\pom.xml of \project-parent\pom.xml does not exist The project structure: svn/project-commons/trunk/pom.xml svn/project-web/trunk/pom.xml svn/project-parent/pom.xml
answer count: 1
has comment: http://stackoverflow.com/comment/36830816
has comment: http://stackoverflow.com/comment/36835005
accepted answer: http://stackoverflow.com/a/23919491
has comment: http://stackoverflow.com/comment/36829777
tagged with: maven
has comment: http://stackoverflow.com/comment/36836032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36835761
has comment: http://stackoverflow.com/comment/36834953
tagged with: java
has comment: http://stackoverflow.com/comment/36834972
type: Question
has comment: http://stackoverflow.com/comment/36835117
has comment: http://stackoverflow.com/comment/36831010
has comment: http://stackoverflow.com/comment/36835970
has title: How to deploy a maven parent module with flat module hierarchy?

http://stackoverflow.com/a/23911871
type: Answer
has comment: http://stackoverflow.com/comment/123378808
has comment: http://stackoverflow.com/comment/115559191
accepted answer of: http://stackoverflow.com/q/23910858
answers question: http://stackoverflow.com/q/23910858
has comment: http://stackoverflow.com/comment/36824734
has comment: http://stackoverflow.com/comment/36823280
score: 27
has comment: http://stackoverflow.com/comment/61434384
upvote count: 27
has body: You can pass parameters in the way you described like this: from("direct:myRoute") .setHeader("someHeader", simple("some header value")) .to("bean:myBean?method=beanMethod(${header.someHeader})") More info, including other methods for bean binding can be found here http://camel.apache.org/bean-binding.html
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/95237623

http://stackoverflow.com/q/23790805
has title: android button.getWidth() returns value 0
tagged with: android
linked to: http://stackoverflow.com/q/2827079
has body: I'm dynamically creating buttons and I want to place them randomly on the screen. In order to do that, I'm substracting the width of the button from the screen's width. The thing is, the function button.getWidth() always return 0. I saw in other posts that people recommended using @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); placeButtonsOnScreen(); } But even when I'm using it, it doesn't work. private void placeButtonsOnScreen() { Random r = new Random(); LinearLayout layout = (LinearLayout) findViewById(R.id.ordered_buttons_layout); for (int i = 0; i &lt; NUMBER_OF_BUTTONS; i++) { Button hiddenButton = buttonsArr[i]; // Get random horizontal margin for the button LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); horizontalMargin = r .nextInt(SCREEN_WIDTH - hiddenButton.getWidth()); layoutParams.setMargins(horizontalMargin, 50, 0, 0); // Add the button to the screen layout.addView(hiddenButton, layoutParams); Log.d("button width",String.valueOf(hiddenButton.getWidth())); } } Any ideas how can I position the buttons on the screen minus their width? Cos right now they get cut off from intersection with the right side of the screen.
score: 0
has answer: http://stackoverflow.com/a/23790854
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23790911
has comment: http://stackoverflow.com/comment/36591371
tagged with: java
has comment: http://stackoverflow.com/comment/36590937
answer count: 2
tagged with: button

http://stackoverflow.com/q/23913889
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23914138
has comment: http://stackoverflow.com/comment/36829060
score: 4
accepted answer: http://stackoverflow.com/a/23914138
upvote count: 4
has title: How to integrate the generated lexer/parser from Antlr4 into my java project
answer count: 1
downvote count: 0
tagged with: parsing
favorite count: 0
tagged with: antlr4
has body: please bear with me I'm not a coding expert. I built a grammar in ANTLR4 using ANTRWorks 2. I tested the grammar with various teststrings and it works fine within there. Now what I'm having trouble with is using the generated lexer and parser in my own code. As code generation target I'm using Java. Here is the code I'm trying: String s = "query(std::map .find(x) == y): bla"; ANTLRInputStream input = new ANTLRInputStream(s); TokenStream tokens = new CommonTokenStream(new pqlcLexer(input)); pqlcParser parser = new pqlcParser(tokens); ParseTree tree = parser.query(); System.out.println(tree.toStringTree()); The Output of that is just "query", which is my starting rule. I would expect something like the output from ANTLRworks: "(query (quant_expr query ( (match std::map . find ( (cm x) ) == (cm (numeral 256))) ) : (query (qexpr bla))))" Here is the tree visually: http://puu.sh/94Nlx/00dc35bb05.png Which methods do I have to call to get the proper syntax tree as output? Here is the generated Parser for reference: http://pastebin.com/Lb34TyRW and the grammar: // Lexer //Schlüsselwörter EXISTS: 'exists'; REDUCE: 'reduce'; QUERY: 'query'; INT: 'int'; DOUBLE: 'double'; CONST: 'const'; STDVECTOR: 'std::vector'; STDMAP: 'std::map'; STDSET: 'std::set'; INTEGER_LITERAL : (DIGIT)+ ; fragment DIGIT: '0'..'9'; DOUBLE_LITERAL : DIGIT '.' DIGIT+; LPAREN : '('; RPAREN : ')'; LBRACK : '['; RBRACK : ']'; DOT : '.'; EQUAL : '=='; LE : '&lt;='; GE : '&gt;='; GT : '&gt;'; LT : '&lt;'; ADD : '+'; MUL : '*'; AND : '&amp;&amp;'; COLON : ':'; IDENTIFIER : JavaLetter JavaLetterOrDigit*; fragment JavaLetter : [a-zA-Z$_]; // these are the "java letters" below 0xFF fragment JavaLetterOrDigit : [a-zA-Z0-9$_]; // these are the "java letters or digits" below 0xFF WS : [ \t\r\n\u000C]+ -&gt; skip ; COMMENT : '/*' .*? '*/' -&gt; skip ; LINE_COMMENT : '//' ~[\r\n]* -&gt; skip ; // Parser //start_rule: query; query : quant_expr | qexpr+ | IDENTIFIER // order IDENTIFIER and qexpr+? | numeral //| c_expr T…
type: AnsweredQuestion

http://stackoverflow.com/comment/36629966
has text: You still need to save the "command" as a variable in the Action as demonstrated by Sergiy.
comment on: http://stackoverflow.com/a/23811426
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23905244
has comment: http://stackoverflow.com/comment/36809838
answer count: 5
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36809419
linked to: http://stackoverflow.com/q/7732259
linked to: http://stackoverflow.com/q/3840356
tagged with: serialization
score: 3
favorite count: 0
has title: Test if a class is serializable
type: Question
has body: What I need to do is having a unit test that checks whether a given class MyClass is serializable. But I can't only check that the class implements Serializable: all the attributes of the class (and the attributes of the attributes etc.) have to implement Serializable. Also, a solution like creating an instance of MyClass and try to serialize and deserialize it is not satisfactory: if someone adds an attribute and does not update the unit test, the unit test won't test the new attribute. One solution would probably be to use reflection recursively to test whether the classes of all the attributes implement Serializable, but that seems really heavy. Isn't there a better solution? Thanks.
has answer: http://stackoverflow.com/a/40621977
has answer: http://stackoverflow.com/a/64497543
has answer: http://stackoverflow.com/a/47678987
tagged with: unit-testing
has answer: http://stackoverflow.com/a/23905418
has comment: http://stackoverflow.com/comment/36809563
has comment: http://stackoverflow.com/comment/36809319
upvote count: 3
has answer: http://stackoverflow.com/a/55479051
tagged with: java

http://stackoverflow.com/comment/67502565
score: 6
comment on: http://stackoverflow.com/a/37628325
has text: @jkerak Go with whatever one seems simplest to you to implement. If all the implementations seem to be greek to you, go with the one with the coolest name. This has worked out well for me.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25612775
downvote count: 0
has comment: http://stackoverflow.com/comment/43180528
type: Answer
has body: This is currently possible to solve but only in a pretty hackie way, but let me first explain a few things: When you write a lambda, the compiler inserts a dynamic invoke instruction pointing to the LambdaMetafactory and a private static synthetic method with the body of the lambda. The synthetic method and the method handle in the constant pool both contain the generic type (if the lambda uses the type or is explicit as in your examples). Now at runtime the LambdaMetaFactory is called and a class is generated using ASM that implements the functional interface and the body of the method then calls the private static method with any arguments passed. It is then injected into the original class using Unsafe.defineAnonymousClass (see John Rose post) so it can access the private members etc. Unfortunately the generated Class does not store the generic signatures (it could) so you can't use the usual reflection methods that allow you to get around erasure For a normal Class you could inspect the bytecode using Class.getResource(ClassName + ".class") but for anonymous classes defined using Unsafe you are out of luck. However you can make the LambdaMetaFactory dump them out with the JVM argument: java -Djdk.internal.lambda.dumpProxyClasses=/some/folder By looking at the dumped class file (using javap -p -s -v), one can see that it does indeed call the static method. But the problem remains how to get the bytecode from within Java itself. This unfortunately is where it gets hackie: Using reflection we can call Class.getConstantPool and then access the MethodRefInfo to get the type descriptors. We can then use ASM to parse this and return the argument types. Putting it all together: Method getConstantPool = Class.class.getDeclaredMethod("getConstantPool"); getConstantPool.setAccessible(true); ConstantPool constantPool = (ConstantPool) getConstantPool.invoke(lambda.getClass()); String[] methodRefInfo = constantPool.getMemberRefInfoAt(constantPool.size() - 2); int argumentInde…
score: 14
has comment: http://stackoverflow.com/comment/47657457
has comment: http://stackoverflow.com/comment/40058193
has comment: http://stackoverflow.com/comment/63013799
upvote count: 14
answers question: http://stackoverflow.com/q/23863716
has comment: http://stackoverflow.com/comment/105494637

http://stackoverflow.com/a/23930253
has body: Since Collections.sort() sorts the original list and doesn't give you a copy, no. You'd have to take a copy of the list prior to sorting. An alternative would be to create a list of tuples - the original value and its index, and sort using a comparator comparing on the value alone e.g. test.add(new Pair(1, 1.0)); test.add(new Pair(2, 1.2)); Collections.sort(test, new PairComparator()); // this sorts on the 2nd value of each Pair etc. That would give you a list of tuples with the original position index recorded.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23930221
downvote count: 0

http://stackoverflow.com/comment/36582062
score: 0
type: Comment
has text: this will be recursive? "if (Files.isDirectory(child))" addTree(child, all);
comment on: http://stackoverflow.com/a/23785267
type: AnswerComment

http://stackoverflow.com/comment/38117711
type: AnswerComment
comment on: http://stackoverflow.com/a/23995535
type: Comment
score: 0
has text: I appreciate your help @Holger. I'm sorry I'm not going to be able to use it. (Actually, I would still like to know the answer to the `ClassLoader` question, if you don't mind.)

http://stackoverflow.com/q/23902576
upvote count: 5
type: AnsweredQuestion
tagged with: dropwizard
downvote count: 0
possible better answer: http://stackoverflow.com/a/39813335
has answer: http://stackoverflow.com/a/23964083
has answer: http://stackoverflow.com/a/39813335
favorite count: 0
type: Question
has title: Prefered way to redirect http connection to https in Dropwizard
answer count: 2
score: 5
tagged with: http-redirect
linked to: http://stackoverflow.com/q/20709386
tagged with: java
accepted answer: http://stackoverflow.com/a/23964083
tagged with: https
has body: I'd like to redirect incoming http connections to https in Dropwizard, preferably togglable in a config file (e.g. with a YAML file, like other connection attributes). [I've seen this question, and I'm reasonably certain that it's not a solution] A solution I've found in several places involves hooking in a Filter that checks the schema, and if it finds "http", calls sendRedirect with a modified URL. This involves hardcoding the behavior to make this always happen though. If I extend the HttpConnectorFactory, it seems like I could add configuration in the YAML for whether I want the redirection to happen. However, it's unclear to me how complicated it will be to add an attribute without breaking other code. This seems like a common task; is there a standard, "preferred" way to do this? I would have expected Dropwizard to have elegant built-in support, like Jetty does, but I can't find it.

http://stackoverflow.com/comment/36708687
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23852526
has text: Your last paragraph implies that you have some constraints that rule out certain possibilities, but nothing in your question indicates what those constraints might be. I find it hard to see how `mypackage.X.class.getName()` would serve your purposes (aside from causing the class to be loaded at runtime) yet `"mypackage.X"` would not.

http://stackoverflow.com/comment/36753497
comment on: http://stackoverflow.com/q/23876405
score: 0
has text: I'm only calling it once!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23895852
tagged with: android
has answer: http://stackoverflow.com/a/23895909
downvote count: 4
has comment: http://stackoverflow.com/comment/36791364
has comment: http://stackoverflow.com/comment/36791355
upvote count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/36791445
has comment: http://stackoverflow.com/comment/36791358
type: Question
tagged with: java
has title: Android app with onClickListener not working
answer count: 1
has body: When I run the app in android emulator, it crashes. Does anybody know, what's wrong in this code? import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public abstract class MyActivity extends Activity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button pl_button = (Button) findViewById(R.id.play_button); pl_button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); } }
favorite count: 0

http://stackoverflow.com/comment/36733867
comment on: http://stackoverflow.com/a/23851393
type: AnswerComment
score: 0
type: Comment
has text: I can only suggest that you read the documentation of system calls before you use them. I don't see a need for any of this. Runtime.exec() already exists.

http://stackoverflow.com/a/23900892
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The only reason to use static with the above code is because you set the title from a static context. Instead, you could not take a value for the application title in the constructor and simply create a updateTitle method which updates the frame's title, for example import java.awt.event.*; import javax.swing.*; public class MyAppEv extends JFrame implements ActionListener { private int h = 0, g = 0; JButton b1 = new JButton("Real"); JButton b2 = new JButton("Barcelona"); public MyAppEv() { updateTitle(); b1.addActionListener(this); b2.addActionListener(this); JPanel myPanel = new JPanel(); myPanel.add(b1); myPanel.add(b2); setContentPane(myPanel); } public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == b1) { ++g; updateTitle(); } else if (source == b2) { ++h; updateTitle(); } } protected void updateTitle() { setTitle("Real Madrid " + g + ":" + h + " Barcelona"); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } MyAppEv app = new MyAppEv(); WindowListener L = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; app.addWindowListener(L); app.setBounds(300, 200, 350, 250); app.setVisible(true); } }); } } In fact, I would avoid the use of static for what you are trying to achieve, as this would have ramifications if you have more the one instance of the frame per JVM If you want to supply a title and update it, you could override the setTitle method and append you additional content, for example... import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MyAppEv extends JFrame implements ActionListener { private int h = 0, g = 0; private String realTitle; JButton b1 = new JButton("Real"); JButton b2 = new JButton("Barcelon…
answers question: http://stackoverflow.com/q/23900820

http://stackoverflow.com/q/23901683
possible better answer: http://stackoverflow.com/a/23901716
tagged with: java
answer count: 3
has title: Reducing amount of code to add images
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23901705
score: 1
accepted answer: http://stackoverflow.com/a/23901705
has body: Trying to add 26 images to a game i am making. Right now i have 26 lines that im trying to shorten. this is what i have done so far. for(int i = 0; i &lt; 27; i++) { ImageIcon breifCase + i = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("img/case" + i + ".png"))); } all i want to do is increase the end number on the variable name each name and also increase the number at the end of the image name. its says i cannot converted to int. Cant think of how else i can go about this.
has answer: http://stackoverflow.com/a/23901716
upvote count: 1
has answer: http://stackoverflow.com/a/23901708

http://stackoverflow.com/q/23892520
has title: Quartz 2.2.X and Spring 4 integration
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: quartz-scheduler
tagged with: spring
tagged with: integration
has comment: http://stackoverflow.com/comment/36794375
score: 3
has body: I try to integrate Quartz scheduler with Spring Framweork 4, but I have following problem: ... 27 more Caused by: org.postgresql.util.PSQLException: ERROR: relation "qrtz_triggers" does not exist Position: 15 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:1761) at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1531) ... 38 more Obviously quartz ignore my quartz.properties file, placed in classpath, where is defined jobStore RAM. Does anyone have an idea, why is Quartz always tries create database tables? quartz.properties org.quartz.scheduler.instanceName=MyScheduler org.quartz.threadPool.threadCount=2 org.quartz.threadPool.threadPriority=1 org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore applicationContext-scheduling.xml <?xml version="1.0" encoding="UTF-8"?> Spring Framework 4.0.5, Quartz 2.2.1, Apache Tomcat 7
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/a/23832110
has comment: http://stackoverflow.com/comment/36669220
has comment: http://stackoverflow.com/comment/36671906
has comment: http://stackoverflow.com/comment/36669325
has body: How about this: public enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2, ENUM_VALUE_3, } // All enums taken. private static final Set&lt;MyEnum&gt; taken = EnumSet.noneOf(MyEnum.class); enum MyOtherEnum { OTHER_ENUM_VALUE_1(MyEnum.ENUM_VALUE_3), OTHER_ENUM_VALUE_2(MyEnum.ENUM_VALUE_1), OTHER_ENUM_VALUE_3(MyEnum.ENUM_VALUE_2), OTHER_ENUM_VALUE_4(MyEnum.ENUM_VALUE_2); private MyEnum pair; MyOtherEnum(MyEnum pair) { if (taken.contains(pair)) { throw new IllegalArgumentException("Cannot pair the same MyEnum with two other enums! " + this); } taken.add(pair); this.pair = pair; } } public void test() { System.out.println("Hello: " + MyOtherEnum.OTHER_ENUM_VALUE_4); }
downvote count: 0
has comment: http://stackoverflow.com/comment/36671261
answers question: http://stackoverflow.com/q/23831903
has comment: http://stackoverflow.com/comment/36670632
has comment: http://stackoverflow.com/comment/36669173
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36671197
upvote count: 1

http://stackoverflow.com/q/23869778
linked to: http://stackoverflow.com/q/2445297
tagged with: mouse
tagged with: fest
has body: I want to make junit test for an application, with graphics editor like functionality. I.e. user can drag and drop mouse smoothly in GUI. It seems not usefull to write coordinate movements programmatically. Is it possible to have some macro recording, to capture user guestures and then use them for testing?
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23870878
has title: GUI testing library with user actions recording?
score: 0
answer count: 1
tagged with: junit
tagged with: awtrobot

http://stackoverflow.com/comment/36760505
has text: What `regex`es have you tried thus far?
comment on: http://stackoverflow.com/q/23879863
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36651219
has text: @Jens, check updated post. `BaseActivity.java` is old file means I have removed 'SherlockFragmentActivity'.
comment on: http://stackoverflow.com/q/23822507
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36644875
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23819196
score: 4
has text: There are plenty of examples on SO, for [example](http://stackoverflow.com/questions/23815472/how-to-animate-rectangle-in-jpanel/23817255#23817255) (scroll to the bottom). You should also have a look at [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/) and [2D Graphics](http://docs.oracle.com/javase/tutorial/2d/) and [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) and [How to Use Swing Timers](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) for details about how it is achieved

http://stackoverflow.com/a/23860535
has comment: http://stackoverflow.com/comment/36724588
has comment: http://stackoverflow.com/comment/36724427
answers question: http://stackoverflow.com/q/23859523
score: 0
type: Answer
has body: Usually you don't do it this way. You may create a Loader while it's still connecting or parsing and onec it's done you process your stuff in onPostExecute. There you can disable the loaders view and execute or run your new activity/fragment.
has comment: http://stackoverflow.com/comment/36724441

http://stackoverflow.com/comment/36659961
type: Comment
has text: Why `char c = a[i];`?
comment on: http://stackoverflow.com/a/23827180
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36631313
type: AnswerComment
score: 0
type: Comment
has text: @user3660263 ok, checked the code and fixed it. Please check.
comment on: http://stackoverflow.com/a/23790353

http://stackoverflow.com/a/23899364
downvote count: 0
has comment: http://stackoverflow.com/comment/36798702
has comment: http://stackoverflow.com/comment/36798774
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23899144
has comment: http://stackoverflow.com/comment/36799530
answers question: http://stackoverflow.com/q/23899144
score: 2
has body: So what is the best way to solve this? Use a retained fragment to manage your SSH connection. By "retained fragment", I mean one on which you have called setRetainInstance(true). That fragment will not be destroyed and recreated on the configuration change. Instead, it will be "retained" and handed directly to the new activity instance, and so anything it holds onto is similarly retained. It is safest if this fragment is one without a UI, added via a FragmentTransaction, though done carefully, you can add this behavior to an existing dynamic fragment. You can read more about this in the online documentation.
type: AcceptedAnswer

http://stackoverflow.com/q/23883922
tagged with: rectangles
tagged with: math
linked to: http://stackoverflow.com/q/5345031
linked to: http://stackoverflow.com/q/21787743
has comment: http://stackoverflow.com/comment/36768092
has comment: http://stackoverflow.com/comment/36768096
possible better answer: http://stackoverflow.com/a/23883990
score: 0
answer count: 2
duplicate of: http://stackoverflow.com/q/5345031
tagged with: point
has answer: http://stackoverflow.com/a/23888138
favorite count: 0
accepted answer: http://stackoverflow.com/a/23888138
has body: I want to find the point in between four points or not. Please help me, is there any algorithm?? I want to write in java program. Thanks, Nitin
has title: how to find point coordinate in between four point cordinate(Rectancle)
tagged with: java
upvote count: 1
downvote count: 1
tagged with: coordinates
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23883990

http://stackoverflow.com/comment/36596004
type: AnswerComment
type: Comment
score: 0
has text: could this be done all in one line? `Desktop.getDesktop().open(new File("somefile.txt"));`
comment on: http://stackoverflow.com/a/23791797

http://stackoverflow.com/comment/36842835
has text: First, thanks for commenting. The z is setting the z vector's distortion, you are right. But how can I set the x and z **coordinates**?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23922555
type: Comment

http://stackoverflow.com/q/23920090
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36837364
linked to: http://stackoverflow.com/q/14990960
type: Question
has comment: http://stackoverflow.com/comment/36837682
downvote count: 0
has comment: http://stackoverflow.com/comment/36838751
has comment: http://stackoverflow.com/comment/36838882
has answer: http://stackoverflow.com/a/29011730
answer count: 1
has title: Configuring Timezone in web.xml Java Web Application
has comment: http://stackoverflow.com/comment/36838503
has comment: http://stackoverflow.com/comment/36837388
favorite count: 0
type: UnansweredQuestion
has body: I'm working with JSF 2.0 + Primefaces + Tomcat + Maven + JPA, and in my web.xml I have this piece of code: javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE true With this I hope that value of "convertDateTime" should show normally, but in database I have this: "04/01/2014 15:10" and in application show this: "04/01/2014 03:10". How can I fix it ? EDIT 1: If I use in this way, then everything works: <f:convertDateTime timeZone="America/Sao_Paulo" pattern="dd/MM/yyyy HH:mm:ss"/> But I want to avoid change all my tags to insert "timeZone='America/Sao_Paulo'". Is there another way? SOLUTION The solution is more easy than I imagine. I just changed the "hh:mm:ss" pattern to "HH:mm:ss". The "hh" lowercase was the problem because this just show 12H and not 24H.
tagged with: jsf
tagged with: primefaces

http://stackoverflow.com/q/23787811
has answer: http://stackoverflow.com/a/23793105
has comment: http://stackoverflow.com/comment/36585624
has title: NullPointerException findViewByID of a EditText inside a fragment from his parent activity
has comment: http://stackoverflow.com/comment/36585584
tagged with: nullpointerexception
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/36585378
has comment: http://stackoverflow.com/comment/36585275
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/36585032
has answer: http://stackoverflow.com/a/23790159
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36585781
tagged with: navigation-drawer
has comment: http://stackoverflow.com/comment/36585421
has comment: http://stackoverflow.com/comment/36585138
tagged with: android-fragments
tagged with: java
linked to: http://stackoverflow.com/q/8041206
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23788055
has body: I have a problem here, I'm getting a NullPointerException when I try to set text inside an EditText placed in my layout_fragment.xml. I'm using findViewById(R.id.TextView) on the fragment parent Activity in onCreate(). The activity has drawer navigation implemented and the layout_fragment.xml belongs to a the first displayed fragment of it. Navigation.class EditText edt_nome; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.navigation); Intent intent = getIntent(); edt_nome = (EditText)findViewById(R.id.home_nome); edt_nome.setText("someText"); } The code is not much and its simplified because of a confidentiality agreement.
has comment: http://stackoverflow.com/comment/36585757
linked to: http://stackoverflow.com/q/39907625
linked to: http://stackoverflow.com/q/6355787
has comment: http://stackoverflow.com/comment/36585130

http://stackoverflow.com/q/23939270
has title: JVM Heap Allocation
score: 0
linked to: http://stackoverflow.com/q/3776041
tagged with: memory-management
has answer: http://stackoverflow.com/a/23968486
has answer: http://stackoverflow.com/a/23939352
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23939352
tagged with: java
type: Question
answer count: 2
has body: In our project we use Tomcat 7 server and we need to increase our Heap size up to 6 gb. Some processes in our project uses this memory.After our processes finished we apply garbage collection in our code. We follow memory allocation using Java VisualVM. There is a problem. When our processes finished, used heap size decreases but Heap size that JVM provide (6gb) doesn't decrease so our local computers have some difficulties to handle new processes.So my question is, is there a way to decrease Heap size to used heap size level? How can we manage that. I hope i can ask my situation clearly. Thanks in advice.
accepted answer: http://stackoverflow.com/a/23968486

http://stackoverflow.com/a/23783545
type: Answer
has comment: http://stackoverflow.com/comment/36585353
score: 2
accepted answer of: http://stackoverflow.com/q/23783204
answers question: http://stackoverflow.com/q/23783204
downvote count: 0
has body: If you don't specify the view name the behavior will be exactly same as if you specify a @RequestMapping method with a void return type: Quoting Spring framework docs: http://docs.spring.io/spring/docs/4.0.0.RELEASE/spring-framework-reference/htmlsingle/#mvc-ann-return-types void if the method handles the response itself (by writing the response content directly, declaring an argument of type ServletResponse / HttpServletResponse for that purpose) or if the view name is supposed to be implicitly determined through a RequestToViewNameTranslator (not declaring a response argument in the handler method signature). i.e A component called RequestToViewNameTranslator tries to figure out the view name based on the request path. Here are some samples from the javadoc of RequestToViewNameTranslator: http://test:8080/gamecast/display.html -&gt; display http://test:8080/gamecast/displayShoppingCart.html -&gt; displayShoppingCart http://test:8080/gamecast/admin/index.html -&gt; admin/index The same logic will apply in your case, /testView will translate to testView view name
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36592848
has comment: http://stackoverflow.com/comment/36606730
upvote count: 2

http://stackoverflow.com/comment/79875543
comment on: http://stackoverflow.com/q/23866709
has text: What's the Hibernate version?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23894791
tagged with: search
has title: How to implement search like in Android Studio?
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36789678
tagged with: string
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23895113
accepted answer: http://stackoverflow.com/a/23895113
has body: This is the functionality I want to achieve: a search result has to contain the search key, even if there are some letters missing in between. So, for example, if a user wants to search for noodles and accidentally misspells it and types in nooles, the correct search result still pops up. Here are some other examples: I think I need to break the search key down into combinations of two halves. Then show results that contain both halves of the key. Has someone done something like this? What if I break it into three or four parts? What if i break it into one-character strings and the only requirement is for the result to contain all the letters the search key contains?
type: Question
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/23870833
answers question: http://stackoverflow.com/q/23870626
has body: Try and follow these steps: Open browser (Chrome, Firefox, Opera, ... and never IE) Go to address bar and type www.google.com and press Enter Key In search type How to set text to textview android Click on one of the results and go thru it If not enough info, then go to another result Go to step 5 until you find answer Go to step 2 for How to CRUD sqlite android Enlightenment
type: Answer
score: 0

http://stackoverflow.com/comment/36760233
has text: You do know how to find the [documentation for String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), right??
comment on: http://stackoverflow.com/q/23879656
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/23915838
has comment: http://stackoverflow.com/comment/36829452
has comment: http://stackoverflow.com/comment/36829651
has comment: http://stackoverflow.com/comment/36830073
type: Question
has comment: http://stackoverflow.com/comment/36830859
has comment: http://stackoverflow.com/comment/36829059
tagged with: java
has comment: http://stackoverflow.com/comment/36829479
has answer: http://stackoverflow.com/a/23916079
tagged with: sleep
has body: Firstly, yes I'm calling this from a web browser. It's quite a long piece of code but I've tried shortening it as much as possible. Basically, I need to wait let's say 1 second for every iteration in the loop. Tried pretty much everything (.sleep() etc.) but it just doesn't seem to be pausing. The reason why I need to do this is because the SimpleSocketClient is calling a socket which has a low limit per second allowed. @Override public String execute(HttpServletRequest request, HttpServletResponse response) { String forwardToJsp = null; HttpSession session = request.getSession(); String allUrls = request.getParameter("domains"); ArrayList domainList = new ArrayList&lt;String&gt;(); Scanner sc = new Scanner(allUrls); while (sc.hasNextLine()) { String line = sc.nextLine(); domainList.add(line); // process the line } sc.close(); String pageHtml = null; String domain = ""; String status = ""; String registrant = ""; String dates = ""; String tag = ""; String email = ""; ArrayList domains = new ArrayList&lt;Domain&gt;(); Domain theDomain; String ipAddress = request.getHeader("X-FORWARDED-FOR"); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); } for (int i = 0; i &lt; domainList.size(); i++) { //NEED TO WAIT 1 SECOND HERE / ANYWHERE IN LOOP String singleDomain = domainList.get(i).toString(); SimpleSocketClient tester = new SimpleSocketClient(singleDomain,ipAddress); pageHtml = tester.getResult(); try { String whoIs2 = ipAddress + " " + ipAddress + " " + singleDomain + "\r\n"; byte[] data = whoIs2.getBytes(); //details of each domain //domain name domain = singleDomain; //status status = "FTR"; //registrant registrant = "N/A"; //dates dates = "N/A"; //tag tag = "N/A"; //email email = "N/A"; } } catch (Exception e) { Logger.getLogger("ip is " + ipAddress + bulkWhoIsCommand.class.getName()).log(Level.SEVERE, null, e); forwardToJsp = "index.jsp"; return forwardToJsp; } //single one theDomain = new Domain(domain,status,registrant,dates,tag,email); //now add to ar…
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36829017
has comment: http://stackoverflow.com/comment/36829413
has comment: http://stackoverflow.com/comment/36829308
has comment: http://stackoverflow.com/comment/36828928
has comment: http://stackoverflow.com/comment/36829530
has title: Is it even possible to make this loop wait a few seconds each time?
has comment: http://stackoverflow.com/comment/36830448
has comment: http://stackoverflow.com/comment/36828984
has comment: http://stackoverflow.com/comment/36829256
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36831343

http://stackoverflow.com/q/23843701
tagged with: java
has title: Android class not found NoClassDefFoundError
type: Question
tagged with: classnotfound
has comment: http://stackoverflow.com/comment/36691312
score: 0
tagged with: android-logcat
tagged with: android
type: UnansweredQuestion
has body: I need your help to resolve a class problem. When I run my virtual device, and when I click on button to call a method, that doesn't work. I tryed with different libraries like itext and justformPDF (last one is java libraries). I indicated it in build path but I have a mistake ... The class is not found :( Thanks for your help :) You can see the logcat here : www.aclebpokerclub.com/Application/LogCat.png
has comment: http://stackoverflow.com/comment/36691341
has comment: http://stackoverflow.com/comment/36695640
answer count: 0

http://stackoverflow.com/comment/36647107
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23800190
has text: What do you mean FlexyPool is not finalized yet? We use it in production systems. The idle_test_period requires connections to be idle for that much before being physically closed. It's not related to a Tx timeout value.

http://stackoverflow.com/q/23824930
favorite count: 0
has answer: http://stackoverflow.com/a/23825528
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23825504
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/23826410
has body: How to form the RegEx of user name string in Java? Rules in Exercise : Only 3 - 10 characters. Only 'a'-'z', 'A'-'Z', '1'-'9', '_' and '.' are allowed. '_' and '.' can only be appeared 0 to 2 times. "abc_._" = false "abc..." = false "abc__" = true "abc.." = true "abc_." = true If I do not use Regex, it will be easier. Without considering '1'-'9', I have tried the following RegEx but they are not workable. String username_regex = "[a-zA-Z||[_||.]{0,2}]{3,10}"; String username_regex = "[a-zA-Z]{3,10}||[_||.]{0,2}"; My function : public static boolean isUserNameCorrect(String user_name) { String username_regex = "[a-zA-Z||[_]{0,2}]{3,10}"; boolean isMatch = user_name.matches(username_regex); return isMatch; } What RegEx should I use?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36655843
has comment: http://stackoverflow.com/comment/36655658
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36655671
downvote count: 0
has comment: http://stackoverflow.com/comment/36655665
has answer: http://stackoverflow.com/a/23825170
has title: Regular Expression (RegEx) for User Name in Java

http://stackoverflow.com/q/23917235
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/23921140
has title: Decrypt database before Hibernate creates new one in Spring application
tagged with: derby
score: 0
answer count: 1
has body: I have Spring application which use Derby embedded database and Hibernate as ORM. In order to protect it, I have developed encryption mechanism, which pack entire database into one file and encrypt it. After application start there should be dialog, where user can type password and start decryption of database, but after start Spring launch Hibernate which creates new database and do not wait for decryption of old one. Is there any way how to wait for decryption and then resume application initialization?
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/36706689
has text: If it's a String it already is a Java object. Did you want to be any more specific than that?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23851132
type: QuestionComment

http://stackoverflow.com/q/23856908
has comment: http://stackoverflow.com/comment/36717469
linked to: http://stackoverflow.com/q/17861986
has comment: http://stackoverflow.com/comment/36717285
linked to: http://stackoverflow.com/q/6634525
answer count: 0
has comment: http://stackoverflow.com/comment/38670989
score: 1
tagged with: java
tagged with: stack-trace
upvote count: 1
type: Question
has body: I recently moved some code to a library project. Since then, when a crash happens in that library, the stack trace of the crash report doesn't show the line number in the library's code - Unknown Source is shown instead. The problem is quite obvious - hard to fix an NPE if I don't know in where it happened. Example: java.lang.NullPointerException at library.SomeClass2.b(Unknown Source) at library.SomeClass1.a(Unknown Source) at android.app.SomeClass.a(SomeClass.java:239) ... * Note that the library project is a regular Java project - referenced from the Android project (No hanky-panky - simple eclipse java project dependency).
has comment: http://stackoverflow.com/comment/36717079
has comment: http://stackoverflow.com/comment/36811876
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38894515
has title: Lline numbers missing in google play crash stack trace
has comment: http://stackoverflow.com/comment/36717401
has comment: http://stackoverflow.com/comment/38885232
has comment: http://stackoverflow.com/comment/36773093
has comment: http://stackoverflow.com/comment/38874445
downvote count: 0
has comment: http://stackoverflow.com/comment/38887696
favorite count: 0
has comment: http://stackoverflow.com/comment/38685992
type: UnansweredQuestion
tagged with: google-play
tagged with: android

http://stackoverflow.com/comment/37374176
type: QuestionComment
has text: Narrowed the question down!
comment on: http://stackoverflow.com/q/23854257
score: 0
type: Comment

http://stackoverflow.com/comment/36601632
comment on: http://stackoverflow.com/a/23796380
type: AnswerComment
score: 0
has text: @BoratSagdiyev Is the getter named `getDog` and the setter named `setDog`?
type: Comment

http://stackoverflow.com/a/41842007
has comment: http://stackoverflow.com/comment/77244477
has body: In my case, all the compile statements has somehow arranged in a single line. separating them in individual lines has fixed the issue.
downvote count: 0
has comment: http://stackoverflow.com/comment/75698786
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/81963795
score: 8
answers question: http://stackoverflow.com/q/23796404

http://stackoverflow.com/q/23780700
tagged with: swing
tagged with: tablecellrenderer
type: Question
has comment: http://stackoverflow.com/comment/36573325
tagged with: jbutton
has comment: http://stackoverflow.com/comment/36572379
linked to: http://stackoverflow.com/q/5555938
linked to: http://stackoverflow.com/q/7350445
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36572866
has body: So basically the requirement is to fetch results from database based on the search query. Results are displayed in JTable. The results should have 5 columns. The 4 columns contain values fetched from database. The 5th column is supposed to have buttons . When the button is clicked a popup should appear. Now the search functionality is working fine. I'm getting an error when I need to display a buttons in 5th column. I googled and found out that it can be done by TablCellRenderer. I've also incorporated the code for the same in my code referring this link Now, I get the error as Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at r_search_2$JTableButtonRenderer.getTableCellRendererComponent(r_search_2.java:193) which lies in this block:- else { button.setForeground(table.getForeground()); button.setBackground(UIManager.getColor("Button.background")); } If I remove this block from my code the search query runs fine but buttons are not displayed in the 5th column. So where lies the error and how should I correct that ? Thanks ! import java.awt.*; import java.awt.event.*; import java.io.File; import java.sql.*; import java.util.Vector; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellRenderer; public class r_search_2 extends JFrame implements ActionListener { JFrame frame1; JLabel l0, l1, l2; JComboBox c1; JButton b1; Connection con; ResultSet rs, rs1; Statement st, st1; PreparedStatement pst; String ids; static JTable table = new JTable(new JTableModel()); //…
has comment: http://stackoverflow.com/comment/36571879
score: -1
tagged with: jtable
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23781558
accepted answer: http://stackoverflow.com/a/23781558
has comment: http://stackoverflow.com/comment/36572094
possible better answer: http://stackoverflow.com/a/23781128
has title: buttons not getting displayed in Jtable when values are fetched from database
has answer: http://stackoverflow.com/a/23781128
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36572001
has comment: http://stackoverflow.com/comment/36572947
has comment: http://stackoverflow.com/comment/36572061
tagged with: java

http://stackoverflow.com/a/23790875
type: Answer
has comment: http://stackoverflow.com/comment/36618920
has comment: http://stackoverflow.com/comment/36618988
score: 2
has body: Your class under test is most likely using Logback incorrectly. Instead of declaring the logger field as being of type ch.qos.logback.classic.Logger, it should be the interface type org.slf4j.Logger, which is implemented by the final Logback logger class. That way, you avoid the issue since there is no final class to be mocked or injected.
downvote count: 0
has comment: http://stackoverflow.com/comment/36628116
has comment: http://stackoverflow.com/comment/36591176
upvote count: 2
answers question: http://stackoverflow.com/q/23783282

http://stackoverflow.com/comment/36613733
has text: Thanks. I have one question. When should we set the boolean hasOtherArrived value? My initial value would be false. Then when I encounter event A, I will check if "hasotherArrived" is set to false, then I will set it to true (Indicates sequence is AB). Now when i get event B, I will check if "hasotherArrived" is set to false but as it is true what action do i need to take? Did I miss anything here? Please advice
type: AnswerComment
comment on: http://stackoverflow.com/a/23802186
type: Comment
score: 0

http://stackoverflow.com/q/23889279
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: jersey-client
tagged with: java
has body: I have a rest method which takes two parameters one map parameter, and the other is a String variable @POST public returnValue postMethod( Map&lt;String,String&gt; anotherMap, @QueryParam("name") String name ) {} It is easy to pass each parameter by itself where the map parameter can be passed using XML as follow : ClientResponse response = service .type(MediaType.APPLICATION_XML) .accept(MediaType.APPLICATION_XML) .post(ClientResponse.class, map).getEntity(ClientResponse.class). and the QueryParam can be passed as usual : service.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE) .accept(MediaType.APPLICATION_JSON_TYPE) .post(ClientResponse.class, f) where f is a Form , the question is : how can we pass both parameter together from the same Java client ?
type: Question
answer count: 1
tagged with: jersey-2.0
score: 0
tagged with: rest
has title: java rest client for mixed parameter forms
has answer: http://stackoverflow.com/a/23997098

http://stackoverflow.com/a/23810194
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23810026
answers question: http://stackoverflow.com/q/23810026
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You are missing the result view name. i.e. JSP file name like this &lt;result name="success"&gt; /HelloWorld.jsp &lt;/result&gt; What will the framework do when the result is success or failure if you have not specified the view name it should render to the client &lt;result name="success"&gt;&lt;/result&gt; // You are missing the JSP name here

http://stackoverflow.com/comment/36672909
has text: take a look at this: http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23834049

http://stackoverflow.com/comment/36718059
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23856741
has text: yes, and if you move it to ROOT then use `/Testservlet`.

http://stackoverflow.com/q/23850056
type: Question
tagged with: java
score: 0
answer count: 1
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/23850092
has title: Amazon AWS Services - Managing/Hosting Java (JAR) Applications
has body: Is there any kind of services that can host/manage Java (JAR) applications? If it was a Web Application, then I can use Elastic Beanstalk or OpsWork. However, my question is that how about Java Applications? For example a simple chat room client/server relationship. Where the server will automatically launch, and will scale accordingly. It is possible to use AutoScale instances, and then use a new image when I need to redeploy. However, this will stop all the instances. Is there an Amazon service that can support "seamless updating of application" for Java Applications, for example Elastic Beanstalk with rolling updates? Thanks
type: UnansweredQuestion

http://stackoverflow.com/comment/36831324
has text: could be that GetTime() is the wrong method. Try other one have no possibility to check it out.
comment on: http://stackoverflow.com/a/23916079
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23808130
downvote count: 0
has body: A delete is Cassandra is accomplished by writing a new row known as a tombstone. The tombstone will ensure that the row is not returned in any queries (one the tombstone has reached full consistency on all nodes). The row is actually removed from the SSTables when the following are satisfied: Compaction occurs The tombstone record is older than gc_grace_seconds for the table (default is 10 days) Inserting a row with a key that already exists will not cause an error since the data structure in Cassandra behaves much like a Java Map. "putting" a rows with the same key will just overwrite the column values from your insert, and succeed. The best way to determine if the row has been delete is to query for the row and ensure it is not returned in the query. I'm not sure which client you are using, but with C* 2.0 you should use the DataStax Java Driver (current release is 2.0.2).
upvote count: 6
has comment: http://stackoverflow.com/comment/36629342
type: Answer
score: 6
answers question: http://stackoverflow.com/q/23804873
has comment: http://stackoverflow.com/comment/36632855

http://stackoverflow.com/q/23786226
score: 0
tagged with: url
tagged with: jsp
has comment: http://stackoverflow.com/comment/36609842
tagged with: javabeans
has comment: http://stackoverflow.com/comment/36617674
has comment: http://stackoverflow.com/comment/36587609
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36593737
type: Question
has title: Use images in Java Beans
has body: I try to create a PDF with iText within my JSP-Application and want to insert an image. The file is located in my webapp-directory under: http://localhost:8087/Buran/Symbols/Logos/dobi1.jpg It's no problem to use it in html or jsp-files but within the bean it just does not work. To get the correct path by trial and error I created a test-file to see from which directory I had to start. Unfortunately that's not really what I expected it to be: ./apache-tomcat-7.0.41/bin/testfile.test I got a recommendation to use: private final String dobiurl = "/Buran/Symbols/Logos/dobi1.jpg"; URLConnection connection; /**/ try { connection = new URL(dobiurl).openConnection(); } catch (IOException ex) { Logger.getLogger(Etikette.class.getName()).log(Level.SEVERE, null, ex); } But just cause errors...

http://stackoverflow.com/comment/36726351
type: QuestionComment
comment on: http://stackoverflow.com/q/23861345
score: 0
has text: It is set to resize as false. My example contains "mainframe.setResizable(false);" Also, what kind of examples in this situation?
type: Comment

http://stackoverflow.com/comment/36614407
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23802735
has text: What are values of success and message after first execution?
type: Comment

http://stackoverflow.com/comment/36621984
comment on: http://stackoverflow.com/q/23806727
has text: What is it that you support, `application/json` or `application/x-www-form-urlencoded` you cannot have both. Also post your getter/setter methods.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36643623
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23818533
has text: Ohh ok I understand it now. Thanks for the clarity guys!
type: AnswerComment

http://stackoverflow.com/comment/36779563
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23889948
has text: IntelliJ does not show any error if I add `\u` in a comment, I think is a Eclipse compiler issue
type: Comment

http://stackoverflow.com/comment/36860767
has text: Exactly, LinkedLists are good for traversing, adding or removing anywhere because you just have to change two pointers(reference in Java) but If you want to go to a specific location you have go one by one.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23931935
score: 0

http://stackoverflow.com/q/23923631
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23924258
score: 1
possible better answer: http://stackoverflow.com/a/23923667
tagged with: java
has answer: http://stackoverflow.com/a/23925732
upvote count: 1
has answer: http://stackoverflow.com/a/23923667
type: Question
has body: Runtime.getRuntime().totalMemory() I imagine this is the amount of memory I am currently using - the amount of allocated memory. More objects, more memory, yes? Runtime.getRuntime().freeMemory() And this would be, huh, the amount of not-allocated memory I can use? Therefore, the TOTAL amount of memory available to my program should be totalMemory() + freeMemory()? The naming convention doesn't help me much. But then, what is this Runtime.getRuntime().maxMemory() exactly?
answer count: 3
accepted answer: http://stackoverflow.com/a/23925732
downvote count: 0
favorite count: 0
has title: What do the memory methods in the Runtime class mean?
has comment: http://stackoverflow.com/comment/36845378

http://stackoverflow.com/a/23783060
downvote count: 0
type: Answer
has body: This may solve your problem @ResponseBody @RequestMapping("/createform") public ModalAndView createform(Model uiModel, HttpServletRequest request) { //some other codes return new ModalAndView("Form"); }
answers question: http://stackoverflow.com/q/23782996
upvote count: 1
score: 1

http://stackoverflow.com/a/23845866
has comment: http://stackoverflow.com/comment/36695460
has comment: http://stackoverflow.com/comment/36696522
has comment: http://stackoverflow.com/comment/36696317
answers question: http://stackoverflow.com/q/23845789
has body: Two things to check: Are you sure that your mysql server is configurated to listend on MY_REMOTE_DESKTOP_IP ? Are you sure that your firewall (iptable...) allows connexion on MY_REMOTE_DESKTOP_IP on tpc port 3306 ?
score: 0
type: Answer

http://stackoverflow.com/comment/36579163
has text: Does it throw an exception? If so; what message do you get? You say, "It hangs" If you were to inspect the request through Fiddler, what do you see?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23784616

http://stackoverflow.com/a/23843011
has body: You have to encrypt it first and then encode it with base64 and send it via net. Otherwise the encryption creates (pseuro)random data and some parts of that might not be properly encoded for transfer via web and will inevitably get corrupted. The same applies if you want to compress your data. You do the compression before encrypting them because after the encryption it will be much harder for the algorithm to compress seemingly random data. Generally the thing you send to a web service should be base64 encoded as a last step/alteration.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23842969
answers question: http://stackoverflow.com/q/23842969

http://stackoverflow.com/a/23790250
downvote count: 0
answers question: http://stackoverflow.com/q/23790173
has body: This is a really bad idea, because what happens when there are critical resources open, like e.g. a file? It won't be closed: while (keepRunning) { openFile(); // gets stopped here closeFile(); } This can of course happen with other things as well, OS processes, network sockets, anything. You see why this is a bad idea? You should instead redesign the code in the loop to check for the condition more often and break and cleanup if the condition doesn't hold true anymore. while (keepRunning) { openFile(); doLongOperation(); if (!keepRunning) { closeFile(); break; // or return } doAnotherLongOperation(); closeFile(); } This way, you don't lose the safety, while being able to stop it faster. You might not actually use precious resources, but in any case you should tell us more details so we can give a more precise answer.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36773198
comment on: http://stackoverflow.com/a/23826459
score: 0
type: AnswerComment
has text: what about the other question? Are you currently recording the data and just need to be able to synch everything together, or are you in need of a way to record the data at a successful I/O rate? I get that you have 4 cards, but want to know whether or not they are writing the data to storage quickly enough for your data I/O.
type: Comment

http://stackoverflow.com/a/23830719
has body: You will need some sort of container to put both of the components in. You could use a JPanel, in which case your code would look like: JPanel panel = new JPanel(); panel.add(new elevator(0,0)); panel.add(new elevator(505,50)); frame.add(panel); For both of them to take up the same area (and for the JPanel to fill up all the space it can), you could pass in a GridLayout to the JPanel constructor: JPanel panel = new JPanel(new GridLayout(2, 1)); // 2 rows, 1 column or JPanel panel = new JPanel(new GridLayout(1, 2)); // 1 row, 2 columns
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23830587
downvote count: 0

http://stackoverflow.com/a/23812327
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/53964499
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23807445
has body: IntelliJ and Android Studio have the ability to take string parameters and treat the strings as being in another language. For example, if you have a method that takes a string that's HTML, if you tell the IDE about it, it can give you syntax highlighting and content assist with the HTML in that string. I think you've inadvertently set this string as being treated as Java, and it's giving you the Java syntax errors on it. You need to un-set that setting. Select the text, bring up the Search Action feature (on Mac it's ⌘ shift a). In the search box that comes up, search for Un-inject Language/Reference, as shown in the screenshot below:
answers question: http://stackoverflow.com/q/23807445

http://stackoverflow.com/comment/36591926
score: 0
has text: So I use desktop api. I haven't had any issues cross-platform. You can't specify the application opening your text file though. Edit: so I looked and it has some problems across different linux environments. Do you need to handle so many edge cases?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23791301

http://stackoverflow.com/q/23938312
accepted answer: http://stackoverflow.com/a/28504429
score: 5
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44052189
tagged with: java
possible better answer: http://stackoverflow.com/a/28429478
has answer: http://stackoverflow.com/a/36949565
has answer: http://stackoverflow.com/a/28429478
type: Question
upvote count: 5
has answer: http://stackoverflow.com/a/28504429
has title: How to determin the final position or angle of a rotated Image
has body: I have an ImageView of a Wheel that is spinning on Fling. How can I detect the final position of the wheel when the rotation is complete? basically , similar to a wheel of fortune wheel, result depends on where the wheel stopped Is there a way to detect when the fling/rotation is finished , then get the final angle? I want to associate this angle with one of the 4 quadrants in the circle and set a result from that. Thanks, some of my code below //////////////////////////Gesture Detect ///////////////// private class MyWheelOnTouchListener implements OnTouchListener { private double startAngle; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: rotateAnim(); // test // reset the touched quadrants for (int i = 0; i &lt; quadrantTouched.length; i++) { quadrantTouched[i] = false; } allowRotating = false; startAngle = getAngle(event.getX(), event.getY()); break; case MotionEvent.ACTION_MOVE: double currentAngle = getAngle(event.getX(), event.getY()); rotateDialer((float) (startAngle - currentAngle)); startAngle = currentAngle; break; case MotionEvent.ACTION_UP: allowRotating = true; break; } // set the touched quadrant to true quadrantTouched[getQuadrant(event.getX() - (wheelWidth / 2), wheelHeight - event.getY() - (wheelHeight / 2))] = true; wheeldetector.onTouchEvent(event); return true; } } /** * Simple implementation of a {@link SimpleOnGestureListener} for detecting a fling event. */ private class MyWheelGestureDetector extends SimpleOnGestureListener { private double endAngle; @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // get the quadrant of the start and the end of the fling int q1 = getQuadrant(e1.getX() - (wheelWidth / 2), wheelHeight - e1.getY() - (wheelHeight / 2)); int q2 = getQuadrant(e2.getX() - (wheelWidth / 2), wheelHeight - e2.getY() - (wheelHeight / 2)); // the inversed rotations if ((q1 == 2 &amp;&amp; q2 == 2 &amp;&amp; Math.…
answer count: 3
has comment: http://stackoverflow.com/comment/45237968
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36700251
comment on: http://stackoverflow.com/q/23848248
score: 0
type: Comment
type: QuestionComment
has text: Did you try inserting a ';' there? After '}'. Because if there OnClickListener weren't anonymous type, it'd be like that: private OnClickListener answerL = new OnclickListener(); And you have private OnClickListener answerL = new OnclickListener(){...}//nothing here

http://stackoverflow.com/comment/37037648
type: AnswerComment
has text: Hey I actually solved it. The answer is posted. Thank you so much for all the help. If you hadn't helped me eliminate all the possible issue I would never have looked in the function I did.
type: Comment
comment on: http://stackoverflow.com/a/23925541
score: 0

http://stackoverflow.com/comment/36577651
has text: you are right.. see my edited question..still there is doubt.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23782579
type: QuestionComment

http://stackoverflow.com/q/23829182
tagged with: guice
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24305918
type: AnsweredQuestion
has body: I'm trying to combine the Guice functionalities of child injectors with Multibinders. For example: public class Test { public static void main(String[] args) { Guice.createInjector(new FirstModule(), new SecondModule()); // works perfectly, returns set with 2 elements Guice.createInjector(new FirstModule()).createChildInjector(new SecondModule()); // fails: A binding to java.util.Set&lt;Test$MyInterface&gt; was already configured at Test$FirstModule.configure(Test.java:15). } private static class FirstModule extends AbstractModule { @Override protected void configure() { Multibinder.newSetBinder(binder(), MyInterface.class).addBinding().to(FirstImplementation.class); } } private static class SecondModule extends AbstractModule { @Override protected void configure() { Multibinder.newSetBinder(binder(), MyInterface.class).addBinding().to(SecondImplementation.class); } } private static interface MyInterface {} private static class FirstImplementation implements MyInterface {} private static class SecondImplementation implements MyInterface {} } Is it possible to have a child injector add to a multibinding somehow?
type: Question
accepted answer: http://stackoverflow.com/a/24305918
upvote count: 5
tagged with: java
has title: Adding to Multibinder in child injector
score: 5

http://stackoverflow.com/q/23931009
tagged with: calendar
type: Question
tagged with: primefaces
tagged with: java
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/12506679
has title: Set value of input field in relation to calendar input
tagged with: binding
accepted answer: http://stackoverflow.com/a/23932116
has body: I´m using Primefaces, I have an input field whose value must be generated in relation to an input date, the problem is that the date can be selected by clicking on the calendar or typing, if done in the first way everything works correctly but if done by writing, the value of UIInput in the backing bean is null. I dont know why the binding attribute is not working right or what i´m doing wrong. &lt;p:calendar id="fechaContable" value="#{movimientoBean.movimientoCab.fechaContable}" pattern="dd/MM/yyyy" binding="#{movimientoBean.fecha}" required="true" requiredMessage="Se necesita fechaContable"&gt; &lt;p:ajax event="dateSelect" oncomplete="document.getElementById('anadirForm:numeroAsiento').focus()"/&gt; &lt;/p:calendar&gt; &lt;p:inputText id="numeroAsiento" binding="#{movimientoBean.numeroAsiento}" value="#{movimientoBean.movimientoCab.numeroAsiento}" required="false"&gt; &lt;f:ajax event="focus" render=":anadirForm:numeroAsiento" listener="#{movimientoBean.numAsiento}"/&gt; &lt;/p:inputText&gt; The backing bean @ManagedBean @ViewScoped public class MovimientoBean implements Serializable{ ...... private transient UIInput numeroAsiento; private transient UIInput fecha; ...... public void numAsiento(){ ..... try { Date date = dateFormat.parse(fecha.getValue().toString()); fechaContable = sdf.format(date); }catch (ParseException e){ } } When dateSelect is invoked, the value of UIInput fecha is right, but when the date is written it is null. Sorry for possible grammar or spelling mistakes EDIT(Solution): Here is the code working in case someone needs it, thanks to Laabidi Raissi for his help and the information: &lt;p:calendar id="fechaContable" value="#{movimientoBean.movimientoCab.fechaContable}" pattern="dd/MM/yyyy" required="true" requiredMessage="Se necesita fechaContable"&gt; &lt;p:ajax event="dateSelect" update=":anadirForm:numeroAsiento" listener="#{movimientoBean.numAsiento}" oncomplete="document.getElementById('anadirForm:numeroAsiento').focus()"/&gt; &lt;p:aj…
type: AnsweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/23932116

http://stackoverflow.com/a/23927997
type: Answer
has comment: http://stackoverflow.com/comment/36857580
has comment: http://stackoverflow.com/comment/36856820
has comment: http://stackoverflow.com/comment/36858081
has comment: http://stackoverflow.com/comment/36857891
has comment: http://stackoverflow.com/comment/36858392
has comment: http://stackoverflow.com/comment/36855884
has comment: http://stackoverflow.com/comment/36857991
has comment: http://stackoverflow.com/comment/36857438
has comment: http://stackoverflow.com/comment/36857077
score: 0
has comment: http://stackoverflow.com/comment/36854868
has comment: http://stackoverflow.com/comment/36857684
has body: The code you are using to switch the control to popup is wrong. Refer below thread to know how to switch the control to new window. How can selenium web driver get to know when the new window has opened and then resume its execution See this blog post to know more about popup handling. EDIT-I String mwh=driver.getWindowHandle(); &lt;&lt;&lt;&lt;&lt;&lt; Click on Button which leads to open a new window &gt;&gt;&gt;&gt;&gt; Set s=driver.getWindowHandles(); //this method will gives you the handles of all opened windows Iterator ite=s.iterator(); while(ite.hasNext()) { String popupHandle=ite.next().toString(); if(!popupHandle.contains(mwh)) { driver.switchTo().window(popupHandle); //**here you can perform operation in pop-up window** //After finished your operation in pop-up just select the main window again driver.switchTo().window(mwh); } }
has comment: http://stackoverflow.com/comment/36858253
answers question: http://stackoverflow.com/q/23912649

http://stackoverflow.com/comment/36605383
has text: try `ProcessBuilder pb = new ProcessBuilder("./i");`
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23798030

http://stackoverflow.com/comment/51171514
score: 2
has text: This code did not work for me. I had to change the configuration to `new OAEPParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT)`
type: AnswerComment
comment on: http://stackoverflow.com/a/23853610
type: Comment

http://stackoverflow.com/q/23850296
tagged with: java
has body: I want to ask what function or another have to write so that every time I pressed the Start button (function:addbutton), the other button to exit (function:addButton2) to change its title to how many times I press the start? class DroppingFrame extends JFrame { public DroppingFrame() { int clicked=0; String b="a"; setSize(1400, 700); setTitle("Dropping"); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = getContentPane(); canvas = new JPanel(); contentPane.add(canvas, "Center"); JPanel p = new JPanel(); addButton(p, "Drop ball", clicked, new ActionListener() { public void actionPerformed(ActionEvent evt) { //addButton.setText(String.valueOf(++clicked)); Ball b = new Ball(canvas); // if(b== new Ball(canvas)){ // clicked++; // } b.start(); } }); addButton2(p, b, clicked, new ActionListener() { public void actionPerformed(ActionEvent evt) { canvas.setVisible(false); System.exit(0); } }); contentPane.add(p, "South"); } public void addButton(Container c, String title, int i, ActionListener a) { //i++; //title = Integer.toString(i); JButton b = new JButton(title); c.add(b); b.addActionListener(a); } public void addButton2(Container c, String title, int i, ActionListener a ) { i++; title = Integer.toString(i); JButton b = new JButton(title); c.add(b); b.addActionListener(a); } private JPanel canvas; }
type: Question
accepted answer: http://stackoverflow.com/a/23850617
has comment: http://stackoverflow.com/comment/36704405
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/23850522
has answer: http://stackoverflow.com/a/23850527
has comment: http://stackoverflow.com/comment/36704584
answer count: 3
possible better answer: http://stackoverflow.com/a/23850522
favorite count: 0
has comment: http://stackoverflow.com/comment/36704691
has comment: http://stackoverflow.com/comment/36704795
has comment: http://stackoverflow.com/comment/36704822
downvote count: 2
tagged with: swing
tagged with: jbutton
has title: Counting click on button
type: AnsweredQuestion
tagged with: actionlistener
has answer: http://stackoverflow.com/a/23850617

http://stackoverflow.com/comment/36875568
comment on: http://stackoverflow.com/q/23940718
score: 1
type: QuestionComment
type: Comment
has text: Post a [sscce](http://sscce.org).

http://stackoverflow.com/comment/36759788
score: 0
type: AnswerComment
has text: You can't setup a custom broker without the above line in my answer. And also if you edit your answer write the new lines at the end of your question don't just change it. Thanks
type: Comment
comment on: http://stackoverflow.com/a/23865605

http://stackoverflow.com/comment/36604244
has text: Add the execution plan for the query please
score: 2
comment on: http://stackoverflow.com/q/23797816
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23890414
answer count: 2
score: 0
tagged with: gwt-syncproxy
has title: GWT-SyncProxy for android : No remoteService in the classpath
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24654946
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/36780722
has answer: http://stackoverflow.com/a/29408567
tagged with: classpath
type: Question
has body: In android client consuming my LoginService remote service, in order to connect user to the application. I use gwt-syncproxy librairie to acces to my remote interface. And the following warning occured: RpcPolicyFinder:No RemoteService in the classpath followed by : java.io.FileNotFoundException: http:// localhost: . . . /. . ./application/application.nocache.js Is there someone who had experienced this type of trouble ?

http://stackoverflow.com/comment/36593616
comment on: http://stackoverflow.com/a/23790235
type: AnswerComment
type: Comment
score: 1
has text: I chose your "check at key points" suggestion and it turned to be not that bad - I had only about 6 of them. Thx

http://stackoverflow.com/comment/36729832
score: 0
has text: because by This i can delete only single record in table where in my case i have thousand of record in cashReceipt Table which are associated with particular purchaser.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23863084

http://stackoverflow.com/q/23882057
score: 0
answer count: 1
has title: Getting "java.lang.reflect.InvocationTargetException" error while trying to use 'protoc-1.0M4.jar'
has body: I want to generate a protobuf mechanism for use in small embedded application. I downloaded 'protoc-1.0M4.jar' from protobuf website, and trying to compile using java, my 'test.proto' file to generate C code. Here is the command I used and error I got: Command : $ java -jar protoc-1.0M4.jar test.proto Exception : Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.parseInt(Integer.java:527) at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.getMaximumSerializedSize(EmbeddedCGenerator.java:491) at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.compileHeader(EmbeddedCGenerator.java:307) at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.doGenerate(EmbeddedCGenerator.java:113) at edu.tum.cs.ccts.protobuf.embedded.Protoc.main(Protoc.java:126) ... 5 more Can anyone suggest some guidelines please.
has comment: http://stackoverflow.com/comment/36765950
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/36765683
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23882757
accepted answer: http://stackoverflow.com/a/23882757
has comment: http://stackoverflow.com/comment/36764530
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36765216

http://stackoverflow.com/a/23814894
upvote count: 0
has comment: http://stackoverflow.com/comment/36636912
has comment: http://stackoverflow.com/comment/36636581
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/36636675
answers question: http://stackoverflow.com/q/23814063
type: Answer
has body: This is not a correct approach, but it works! List&lt;String&gt; obj1 = new ArrayList&lt;&gt;(); List&lt;Integer&gt; obj2 = new ArrayList&lt;&gt;(); Object o = new Integer(7); try{ obj1.add((String) o); System.out.println("This is a list of integer!"); }catch(ClassCastException ex){ System.out.println("This is not a integer list!"); }

http://stackoverflow.com/q/23842896
linked to: http://stackoverflow.com/q/1625234
favorite count: 0
duplicate of: http://stackoverflow.com/q/1625234
upvote count: 2
has answer: http://stackoverflow.com/a/23842911
downvote count: 2
tagged with: filewriter
has title: Making a new line in a file
possible better answer: http://stackoverflow.com/a/23842913
has answer: http://stackoverflow.com/a/23842913
has body: Im trying to write a text to file, but it overwrites whats inside, can somebody explain how to check if the text exists and then put a new line and write? Here is the code I am working with: try { if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.newLine(); bw.write(petName); bw.close(); System.out.println("Done!"); } catch (IOException exc) { System.out.println(exc); } Thank you for any kind of help.
type: AnsweredQuestion
tagged with: bufferedwriter
accepted answer: http://stackoverflow.com/a/23842911
tagged with: java
type: Question
score: 0
answer count: 2

http://stackoverflow.com/q/23842610
duplicate of: http://stackoverflow.com/q/10517389
tagged with: android
linked to: http://stackoverflow.com/q/10517389
downvote count: 1
linked to: http://stackoverflow.com/q/2533410
has body: How can I use drawable folder in Android Project for different images and icons for different devices? e.g drawable-hdpi ? drawable-ldpi ? drawable-mdpi ? drawable-xhdpi ? drawable-xxhdpi ? and What size of images should be placed in particular folder?
has answer: http://stackoverflow.com/a/23842646
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/36689440
type: UnansweredQuestion
tagged with: drawable
has title: How to use drawable folder in android for Images or icons?
has comment: http://stackoverflow.com/comment/36689441
tagged with: java
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/23842690
answer count: 2
tagged with: icons
score: -1

http://stackoverflow.com/a/23936645
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23869061
has body: Thanks people. I was able to resolve this issue by using JsonIdentityInfo on my classes (both parent and child) along with a plugin called jackson-datatype-hibernate through which I enabled a feature called FORCE_LAZY_LOADING If it helps anyone, below is the code for both the above configurations: Create a class as below to enable jackson-datatype-hibernate public class HibernateAwareObjectMapper extends ObjectMapper { public HibernateAwareObjectMapper() { Hibernate4Module hbm = new Hibernate4Module(); hbm.enable(Hibernate4Module.Feature.FORCE_LAZY_LOADING); registerModule(hbm); } } Tell Spring to use the above ObjectMapper than the default provided by Jackson: &lt;mvc:annotation-driven&gt; &lt;mvc:message-converters&gt; &lt;!-- Use the HibernateAware mapper instead of the default --&gt; &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"&gt; &lt;property name="objectMapper"&gt; &lt;bean class="com.adwitiya.o2plus.utilities.HibernateAwareObjectMapper" /&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/mvc:message-converters&gt; &lt;/mvc:annotation-driven&gt; As for the JsonIdentityInfo, below is the code. Notice the use of JsonIgnoreProperties (I've used this mainly for all the sets as it creates a recursive big tree and I wanted to avoid that) @Entity @Table(name = "o2_branch", catalog = "o2plus" ) @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "id") @JsonIgnoreProperties(value = {"active", "modifiedBy", "modifiedTimestamp", "members", "staff"}) public class Branch implements java.io.Serializable { private Long id; private Address address; private String name; private String contactNumber; private Integer capacity; private String manager; private boolean active; private String modifiedBy; private Date modifiedTimestamp; private Set&lt;Member&gt; members = new HashSet&lt;Member&gt;(0); private Set&lt;Staff&gt; staff = new HashSet&lt;Staff&gt;(0); Hope it helps more people.
answers question: http://stackoverflow.com/q/23869061
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/q/23787722
has comment: http://stackoverflow.com/comment/36585076
has title: replace string between xml elements with variable name spaces
type: Question
has comment: http://stackoverflow.com/comment/36584955
has comment: http://stackoverflow.com/comment/36585078
has comment: http://stackoverflow.com/comment/36585025
has comment: http://stackoverflow.com/comment/36585031
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/36585814
answer count: 2
has comment: http://stackoverflow.com/comment/36585004
upvote count: 0
has answer: http://stackoverflow.com/a/23788135
has comment: http://stackoverflow.com/comment/36585142
has comment: http://stackoverflow.com/comment/36585502
favorite count: 0
has body: Using Java, String and replaceAll I have to replace values of elements that may come with different name spaces: from &lt;tns:p&gt;to be replaced&lt;/tns:p&gt; &lt;sss:p&gt;to be replaced&lt;/sss:p&gt; to &lt;tns:p&gt;replaced&lt;/tns:p&gt; &lt;sss:p&gt;replaced&lt;/sss:p&gt; Could you please, help to find regular expression for this replace? P.S. The elements may appear more than once in a given string: &lt;tns:p&gt;to be replaced&lt;/tns:p&gt; &lt;tns:w&gt;not to be replaced&lt;/tns:w&gt; &lt;tns:p&gt;to be replaced&lt;/tns:p&gt; I have a problem with variable name spaces in front of elements. Without them I'd do like this: str.replaceAll("(?&lt;=&lt;p&gt;)(.*?)(?=&lt;/p)", "replacement")
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23788297
score: -3
tagged with: regex
has comment: http://stackoverflow.com/comment/36584929
has comment: http://stackoverflow.com/comment/36586051
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36584892
has comment: http://stackoverflow.com/comment/36585265

http://stackoverflow.com/comment/37442700
score: 0
comment on: http://stackoverflow.com/q/23910989
type: Comment
type: QuestionComment
has text: Would you want it to filter out words like "Hi2", as in, words without spaces between the numbers. And do you still want to keep normal words like "Hi". So if you were to have "Hi, I'm po 3 A39DF a10", you'd just want either "Hi, I'm po A39DF" or just "A39DF". Could you give us a full sample of what you'd expect to get from an input string?

http://stackoverflow.com/comment/36837030
has text: no first time i login in facewbook then i tgry to show image
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23917798

http://stackoverflow.com/a/23782343
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Firstly, it is highly unlikely that the JIT compiler is optimizing away the if statement. If it did, that would be a compiler bug. A far more likely explanation is that the if body is not being executed because the condition is never true; i.e. jobs queue (or whatever) is always empty ... according to isEmpty(). "If I add System.out.println("not interrupted"); right before the if everything works and the console always outputs "not interrupted"" That could be due to other things. For instance, doing some I/O within the loop could mean that some other thread gets a chance to put something onto the queue. "The loop is necessary because the thread is run in an ExecutorService and I want to be able to stop its execution." Actually, that is not necessary. There are much better ways to do this. For example. Change jobs or messages or whatever to be some class that implements BlockingQueue. (For example, ArrayBlockingQueue will give you a bounded queue, if that is what you need. Get rid of the loop. Get rid of the isEmpty test. Replace the remove(0) with a call to take(). The take() call will block until either it succeeds in removing somethinf from the queue ... or the current thread is interrupted. In the latter case, InterruptedException will be thrown. This is likely to be both more reliable and LOTS more efficient than polling the interrupted flag and the queue in a tight loop.
has comment: http://stackoverflow.com/comment/36575412
answers question: http://stackoverflow.com/q/23781578
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36575788
accepted answer of: http://stackoverflow.com/q/23781578

http://stackoverflow.com/q/23865190
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
favorite count: 0
has title: Font not embedding in webview
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/html
tagged with: css
answer count: 0
has body: I am building an android application where I have a webview, I'm trying to embed a font in it that is placed in the assets folder called mylotus.ttf. The font is not being embeded at all. Any help ? webView.requestDisallowInterceptTouchEvent(true); try { details_v=decipher(key, detailss_value); }catch(Exception ex) {} yourHtml = " " + " " + " " + " " + " "+keyword+" " + " "+detailss_value+" " + " "; webView.loadDataWithBaseURL(null, yourHtml, "text/html", "UTF-8", null);

http://stackoverflow.com/comment/36792565
has text: Note that you don't have to use self at all to reference ivars.
type: Comment
comment on: http://stackoverflow.com/q/23896432
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36652576
has text: Finally, nice answer.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23823291

http://stackoverflow.com/comment/36681805
type: Comment
type: QuestionComment
has text: What *is* the 'string attached to the hold variable'? Why *aren't* you closing the writer on null, and why aren't you closing the socket?
comment on: http://stackoverflow.com/q/23837630
score: 0

http://stackoverflow.com/q/23815538
has comment: http://stackoverflow.com/comment/36778747
type: Question
has title: SOAP client, dynamically changing server, unexplained error
score: 0
tagged with: wsdl
has body: I'm trying to implement a SOAP client that access many servers. However, the servers don't use identical WSDL. They differ in the binding name and service name, such as: namespace="http://www.standards.org/" &lt;wsdl:service name="vendorA_ep"&gt; &lt;wsdl:port name="vendorA_svc_pt" binding="tns:InventoryBinding"&gt; &lt;soap:address location="http://vendorA.com/InventoryService/inventory_ep"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; and namespace="http://www.standards.org/WSDL/" &lt;wsdl:service name="vendorB_InvSvc"&gt; &lt;wsdl:port name="vendorB_InvSvcBinding" binding="tns:InventorySvcBinding"&gt; &lt;soap:address location="http://vendorB.com/InventoryService/customerInventory.svc"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; Per various suggestions, I've used the WSDL of vendorA to create a client through JAX-WS, then modified it to use a locally-based WSDL: public VendorA_Service() { URL url = VendorA_Service.class.getResource("/META-INF/wsdl/standards.wsdl"); QName service = new QName("http://www.standards.org", "vendorA_ep"); super(url, service); } (yes, the META-INF works, as long as it is hidden within the WEB-INF/classes directory) I then call it in my client: InventoryService_Service endPoint = new InventoryService_Service(); InventoryService inventoryService = endPoint.getInventoryServiceBinding(); Reply reply = inventoryService.getInventoryLevels(request); All is well. Now I want to switch to data from vendorB: InventoryService_Service endPoint = new InventoryService_Service(); InventoryService inventoryService = endPoint.getInventoryServiceBinding(); BindingProvider bp = (BindingProvider) inventoryService; // Below is the trouble line! bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://vendorB.com/InventoryService/customerInventory.svc"); Reply reply = inventoryService.getInventoryLevels(request); At executing getInventoryLevels() I'm treated to this error message: javax.xml.ws.soap.SOAPFaultException: The &lt;from&gt; v…
type: UnansweredQuestion
tagged with: soap
has comment: http://stackoverflow.com/comment/36657713
tagged with: soap-client
answer count: 0
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/a/23834784
score: 1
upvote count: 1
has body: You have to import UserSession Class in to jsp, using import directive. Syntax for Import page directive is: you can even import multiple classes using one directive by separating them with comma You can go through this article: http://docs.oracle.com/cd/A87860_01/doc/java.817/a83726/genlovw3.htm
downvote count: 0
answers question: http://stackoverflow.com/q/23834485
type: Answer

http://stackoverflow.com/comment/40122915
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25669379
score: 0
has text: Add more details. Maybe I can get the bounty too.

jpa-2.1
tags question: http://stackoverflow.com/q/23874988
type: Tag
tag name: jpa-2.1

http://stackoverflow.com/q/23782914
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36576301
has body: I am using these statements to load java program properties at runtime. public static void Init(String confFile) { try { prop.load(new FileInputStream(confFile)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Same class has the following method for reading properties public static String GetProperty(String key) { return prop.getProperty(key); } My question is, if I call Init and GetProperty simultaneously without the synchronized block will it cause a problem? I read this java Properties . here it says that the getProperty method is thread safe. yes, I know this, because I have been using it with multiple threads, but now while one thread is loading new properties and others are calling the getProperty method I think it can cause problems
downvote count: 0
has comment: http://stackoverflow.com/comment/36577879
upvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/36576400
tagged with: synchronization
favorite count: 0
has title: Making load and getproeprty methods of java.util.Properties thread safe
tagged with: multithreading
has answer: http://stackoverflow.com/a/23783111
accepted answer: http://stackoverflow.com/a/23783111
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/23871512
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36746222
has comment: http://stackoverflow.com/comment/36744940
has body: please to compare, you should using second parameter for GridLayout, then setVgap() will works (frame.setLayout(new GridLayout(6, 0, 5, 5));), here is only zero value, Window is reserved word in Java for awt.Window, don't to use this Object name as class name import java.awt.Color; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class MyWindow { private static final long serialVersionUID = 1L; private JPanel menupanel = new JPanel(); private JFrame frame = new JFrame("Image Application"); public MyWindow() { // Menu JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("Options"); JButton button = new JButton("Reset"); // Buttons menupanel.add(new JButton("Allign Left")); menupanel.add(new JButton("Allign Center")); menupanel.add(new JButton("Allign Right")); // Picture JPanel p1 = new JPanel(); p1.setBackground(Color.RED); // 2x JLabels and ComboBoxes to get the preferred dimensions JPanel p2 = new JPanel(); p2.setBackground(Color.ORANGE); JLabel b2 = new JLabel("Width: "); p2.add(b2); JTextField box1 = new JTextField(25); p2.add(box1); JPanel p3 = new JPanel(); p3.setBackground(Color.BLUE); JLabel b3 = new JLabel("Height: "); JTextField box2 = new JTextField(25); p3.add(b3); p3.add(box2); // Resize Button JPanel p4 = new JPanel(); p4.setBackground(Color.MAGENTA); JButton b4 = new JButton("Resize"); // Adding Components to their panels p4.add(b4); menu.add(button); menubar.add(menu); // add all of the panels to JFrame frame.setLayout(new GridLayout(6, 0, 5, 5)); frame.add(menupanel); frame.add(p1); frame.add(p2); frame.add(p3); frame.add(p4); frame.setJMenuBar(menubar); frame.pack(); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String args[]) { SwingUtilit…
upvote count: 3
answers question: http://stackoverflow.com/q/23871041
has comment: http://stackoverflow.com/comment/36745418
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23871041

http://stackoverflow.com/q/23918961
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has body: I've implemented search functionality as explained in http://developer.android.com/guide/topics/search/search-dialog.html. This works fine on Android 2.3.5 with the hardware search button. Now I wonder how I could integrate a software search button. I added a button in the ActionBar but now I wonder how you can show a dialog for inputting the query as with the dialog showing up after pressing the hardware button.
accepted answer: http://stackoverflow.com/a/23919018
answer count: 1
downvote count: 0
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/23919018
has title: Hardware and Software Search button in Android

http://stackoverflow.com/comment/36651572
type: QuestionComment
comment on: http://stackoverflow.com/q/23799450
has text: Sample Output: I am getting output like that below only, but I am not getting value from Java session object. In java I used HttpSession object for storing the value. connect.sid : { "connect.sid": "BpNoHmwPCjcVoki2XzYMfROW" }
score: 0
type: Comment

http://stackoverflow.com/q/23827474
tagged with: jframe
has title: JFrame check boxes interaction
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23827610
type: Question
has comment: http://stackoverflow.com/comment/36660318
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/23827610
has body: I would like to ask you something about JFrame and I think that I am wrong somewhere because this is happening: I have placed on my Window Form 2 checkboxes (DocumentCheckBox and FilescheckBox). Here is the code final JCheckBox DocumentCheckBox = new JCheckBox("Document"); ProduceDataDropDown.disable(); DocumentCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { FilecheckBox.setSelected(false); } }); DocumentCheckBox.setFont(new Font("Times New Roman", Font.PLAIN, 14)); DocumentCheckBox.setBounds(184, 131, 123, 23); contentPane.add(DocumentCheckBox); final JCheckBox FilecheckBox = new JCheckBox("File"); FilecheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DocumentCheckBox.setSelected(false); } }); FilecheckBox.setFont(new Font("Times New Roman", Font.PLAIN, 14)); FilecheckBox.setBounds(184, 157, 123, 23); contentPane.add(FilecheckBox); What is the wrong here? ..... the second one works but the first one cannot find the FilecheckBox - it says that the class doesn't exist. In short because the FilecheckBox is below than the DocumentCheckBox, it cannot be recognised. On the other hand DocumentCheckBox is recognised at the second part because it is above and eclipse can recognise it. Is there any way to fix this ??? What I want is when I tick one checkbox other one is deselected. Thanks in advance.

http://stackoverflow.com/a/23830803
type: Answer
answers question: http://stackoverflow.com/q/23830640
has body: First off, know that Dijkstra's algorithm is for weighted graphs traditionally. It could still work with unit edges (all weight 1) but it may not be your most efficient solution. Either way, whichever algorithm you use, you will need to treat your grid as a graph. To do this, make a set of edges. If there are no restrictions beyond "no diagonals" then your edges will be the connection between each point and its neighbors above, below, and next to it. You can then operate on the graph by iterating over the edges and points on the graph.
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/23932647
has body: There is no way for the constructor of a subclass to handle an exception thrown by its superclass constructor. The only thing you can do is to declare the subclass constructor as throwing the same (checked) exceptions as the super class constructor declares; e.g. B() throws Exception { System.out.println ("Executing class B constructor"); } That means that you cannot get the "Executing class B constructor" message to be printed if A() throws an exception. If you think about it, this is a good thing. If you were able to catch the exception from super(...) in the subclass constructor, you would have to deal with an object that may not have been fully initialized. That is likely to be problematic. Alternatively, if you do want to deal with the exceptions coming out of the superclass constructor, then hide the subclass constructor (i.e. make it private) and instead use a factory method to create the subclass instances. That method can handle exceptions that emanate from the super or subclass constructor. But note that unless the constructor does something vile (e.g. smuggling this out via the exception), you still won't see the reference to the partially initialized / broken object. I guess this is just an example, but it is worth pointing out that it is a bad idea to declare a method as throwing Exception (or Throwable). You should declare the method as throwing the actual exceptions that are thrown.
type: Answer
answers question: http://stackoverflow.com/q/23932442
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/36892424
comment on: http://stackoverflow.com/q/23875038
has text: @benzonico Your links refer to Maven, not Gradle, it seems. Are you saying the same principle must be applied for Gradle?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23826701
type: Answer
has comment: http://stackoverflow.com/comment/36663383
has comment: http://stackoverflow.com/comment/36662896
has body: Check what started metrics-meter-tick-thread* threads , either your webapp or some library. And stop the thread before you shutdown application. See Tomcat wiki link explains how it creates a memory leak. Also it explains how uncleaned ThreadLocal variables causes memory leaks. Threads spawned by webapps If a webapp creates a thread, by default its context classloader is set to the one of the parent thread (the thread that created the new thread). In a webapp, this parent thread is one of tomcat worker threads, whose context classloader is set to the webapp classloader when it executes webapp code. Furthermore, the spawned thread may be executing (or blocked in) some code that involves classes loaded by the webapp, thus preventing the webapp classloader from being collected. So, if the spawned thread is not properly terminated when the application is stopped, the webapp classloader will leak because of the strong reference held by the spawned thread.
score: 0
answers question: http://stackoverflow.com/q/23801992
has comment: http://stackoverflow.com/comment/36661011

myeclipse
tags question: http://stackoverflow.com/q/23912756
tag name: myeclipse
type: Tag

http://stackoverflow.com/comment/36805718
comment on: http://stackoverflow.com/a/23902803
type: Comment
type: AnswerComment
score: 0
has text: The problem with "wheels" like `mysql_real_escape_string()` is they're very fragile and prone to failure or error. Yes, if used correctly you can theoretically gain some slight speed improvements over using `PreparedStatement`, but that's a big if. `PreparedStatement` provides so much more robust behavior than any string escaping function ever could, that it's hardly even fair to compare them. Needing sanitized input is more than enough reason to merit `PreparedStatement` over manual escaping.

http://stackoverflow.com/q/23820896
favorite count: 0
has comment: http://stackoverflow.com/comment/36649109
has title: Timezones on Windows and Mac
tagged with: timezone
has comment: http://stackoverflow.com/comment/36648973
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36648118
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36649189
tagged with: java
has comment: http://stackoverflow.com/comment/36648196
tagged with: nstimezone
type: Question
has comment: http://stackoverflow.com/comment/36648179
has comment: http://stackoverflow.com/comment/36648131
linked to: http://stackoverflow.com/q/17348807
has comment: http://stackoverflow.com/comment/36649291
has body: I'm wondering what the easiest method would be to reconcile timezones between Windows and OSx? I've tried listing out all the time zones windows could support and trying to cross reference a list of what OSx could support. I'm going to be given an abbreviation (3 letters) for the timezone and I'll need to set the timezone accordingly. Is there an easy way to do this?
linked to: http://stackoverflow.com/q/808736
has comment: http://stackoverflow.com/comment/36649045
has answer: http://stackoverflow.com/a/23848148
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36649087

http://stackoverflow.com/q/23814045
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23814269
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has title: JSP -- Giving HTTP 500 on form process
has body: I am writing a small jsp file to parse and validate user input. The html form for testing is as follows: user name: password: Next is the JSP <%@ page import="java.io.*" %> Registration Complete <% out.write(request.getParameter("user")); out.write(request.getParameter("passwd")); %> Finally, my error: HTTP Status 500 - java.lang.NullPointerException -------------------------------------------------------------------------------- type Exception report message java.lang.NullPointerException description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) root cause java.lang.NullPointerException java.io.Writer.write(Unknown Source) org.apache.jsp.NewUser_jsp._jspService(NewUser_jsp.java:72) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs. -------------------------------------------------------------------------------- Apache Tomcat/7.0.47 I don't understand. what is null? I have attempted to change the method to …
has comment: http://stackoverflow.com/comment/36635104
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23814269
tagged with: jsp
has comment: http://stackoverflow.com/comment/36635273
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36639989
score: 0

http://stackoverflow.com/comment/36647155
has text: But the fall off from the solid to the clear could distort the coloring
comment on: http://stackoverflow.com/q/23820232
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23855974
type: Question
has body: The useless Layout Manager guy is back again, I just can't seem to get my head around these darn layouts and make them work the way I want. Anyway, I want to have a JFrame which has one large panel at the top (I call it a header) which runs from the left to right side of the frame at the north part of the frame, then four panels below it, two just below the header and two below those, and finally a "footer" panel, basically the same as the header panel, only at the south part of the frame. Like this: I had code which had the four middle panels working fine, but the header panel just messed everything up, and I have since been testing with the demo layout manager code for GridBagLayout, GridLayout again and BoxLayout. I can't getting any to work as I want. For the aware of you here, you will probably notice I've already had a question related to this, and if having two similar questions are not allowed, please make me aware and I will move this to my previous question and this can be closed. public Shop() { shopUI = new JFrame("Shop Menu"); shopUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); shopUI.setBounds(100, 100, 700, 500); shopUI.setResizable(false); allPanels = new JPanel(); headerPanel = new JPanel(); headerPanel.setLayout(new BorderLayout()); headerPanel.setBackground(Color.cyan); mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(2,2)); topLeft = new JPanel(); topLeft.setBackground(Color.pink); topRight = new JPanel(); topRight.setBackground(Color.black); bottomLeft = new JPanel(); bottomLeft.setBackground(Color.green); bottomRight = new JPanel(); bottomRight.setBackground(Color.blue); footerPanel = new JPanel(); footerPanel.setLayout(new BorderLayout()); footerPanel.setBackground(Color.magenta); mainPanel.add(topLeft); mainPanel.add(topRight); mainPanel.add(bottomLeft); mainPanel.add(bottomRight); allPanels.add(headerPanel, BorderLayout.NORTH); allPanels.add(footerPanel, BorderLayout.SOUTH); allPanels.add(mainPanel); shopUI.add(allPanels); sho…
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/23856409
has title: Multiple panels in JFrame
answer count: 1
has comment: http://stackoverflow.com/comment/36715282
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/36715487
has answer: http://stackoverflow.com/a/23856409
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/36715262
downvote count: 1
has comment: http://stackoverflow.com/comment/36715246

http://stackoverflow.com/a/23902445
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36804159
upvote count: 2
answers question: http://stackoverflow.com/q/23902382
has body: Two possible solutions: Draw to a BufferedImage using the Graphics object obtained from it via getGraphics(), and then draw the BufferedImage in your JPanel's paintComponent(Graphics g) method. Or Create an ArrayList&lt;Point&gt; place your mouse points into the List, and then in the JPanel's paintComponent(Graphics g) method, iterate through the List with a for loop, drawing all the points, or sometimes better -- lines that connect the contiguous points. Other important suggestions: Be sure that you're using the Swing library (JApplet, JPanel), not AWT (Applet, Panel, Canvas). You're better off avoiding applets if at all possible. Don't draw in a paint method but rather a JPanel's paintComponent(Graphics g) method. Don't forget to call the super's method first thing in your paintComponent(Graphics g) method override.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23902382
type: Answer

http://stackoverflow.com/q/23857692
tagged with: sensors
answer count: 1
has comment: http://stackoverflow.com/comment/36718834
tagged with: orientation
has answer: http://stackoverflow.com/a/23857960
has body: I'm working at a game, and the orientation is sensorLandscape. <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Now my game can flip when I rotate my phone. THe problem i have is that when the phone is flipped, the accelerometer value is also flipped.. How can I find out which android landscape orientation is ?
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2795833
type: Question
has title: Android - get the sensor landscape orientation
has comment: http://stackoverflow.com/comment/36718890
score: 0
accepted answer: http://stackoverflow.com/a/23857960
tagged with: android

http://stackoverflow.com/comment/36595087
has text: When you hover over `@string/app_name` in your manifest file, it should look like this, with your currently selected build variant selected: https://i.sstatic.net/8lJ5C.png
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23783593
score: 0

http://stackoverflow.com/a/23864105
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36732580
has comment: http://stackoverflow.com/comment/36732534
has comment: http://stackoverflow.com/comment/36732236
upvote count: 1
has body: Apart for the other answer you directly add ListItem click event like @Override public void onListItemClick(ListView l, View v, int position, long id) { Toast.makeText(getActivity(), PROBLEMS[(int) id],Toast.LENGTH_SHORT).show(); } For example go to DemonstrationofusingListFragmenttoshowalistofitemsfromacannedarray. android-custom-adapter-listview-with-listfragment-and-loadermanager-inside-fragmentactivity
score: 1
has comment: http://stackoverflow.com/comment/36732255
answers question: http://stackoverflow.com/q/23863965

http://stackoverflow.com/q/23819786
answer count: 1
has body: I have a multi-threaded client-server application that uses Vector&lt;String&gt; as a queue of messages to send. I need, however, to send a file using this application. In C++ I would not really worry, but in Java I'm a little confused when converting anything to string. Java has 2 byte characters. When you see Java string in HEX, it's usually like: 00XX 00XX 00XX 00XX Unless some Unicode characters are present. Java also uses Big endian. These facts make me unsure, whether - and eventually how - to add the file into the queue. Preferred format of the file would be: -- Headers -- 2 bytes Size of the block (excluding header, which means first four bytes) 2 bytes Data type (text message/file) -- End of headers -- 2 bytes Internal file ID (to avoid referring by filenames) 2 bytes Length of filename X bytes Filename X bytes Data You can see I'm already using 2 bytes for all numbers to avoid some horrible operations required when getting 2 numbers out of one char. But I have really no idea how to add the file data correctly. For numbers, I assume this would do: StringBuilder packetData = new StringBuilder(); packetData.append((char) packetSize); packetData.append((char) PacketType.BINARY.ordinal()); //Just convert enum constant to number But file is really a problem. If I have also described anything wrongly regarding the Java data types please correct me - I'm a beginner.
has comment: http://stackoverflow.com/comment/36646171
has comment: http://stackoverflow.com/comment/36646215
has comment: http://stackoverflow.com/comment/36646073
tagged with: sockets
linked to: http://stackoverflow.com/q/23290543
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36646099
has answer: http://stackoverflow.com/a/23819872
accepted answer: http://stackoverflow.com/a/23819872
tagged with: java
tagged with: file
type: Question
linked to: http://stackoverflow.com/q/9520911
score: 0
has title: Can I add a binary file to a String based server message queue?

http://stackoverflow.com/a/23882436
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23881999
score: 1
has body: Check that: JSONObject json = jParser.makeHttpRequest(URL, POST, params); From there How to httpPost() to covert httpGet()
downvote count: 0
has comment: http://stackoverflow.com/comment/36765410

http://stackoverflow.com/q/23779646
has comment: http://stackoverflow.com/comment/36570134
has comment: http://stackoverflow.com/comment/36570219
favorite count: 0
score: -1
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23779799
has answer: http://stackoverflow.com/a/23779799
accepted answer: http://stackoverflow.com/a/23779698
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36570221
downvote count: 3
has title: Can you replace Getter's and Setter's methods in java with something else?
has comment: http://stackoverflow.com/comment/36570144
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23779698
has body: is there a way to replace this methods (Getter's and Setter's) with another method or something else that do same work. I am asking that because of my study. public class Item { private String name; private int sellIn; private int quality; public Item(String name, int sellIn, int quality) { this.name = name; this.quality = quality; this.sellIn = sellIn; } public void setSellIn(int sellIn) { this.sellIn = sellIn; } public void setQuality(int quality) { this.quality = quality; } public String getName() { return name; } public int getSellIn() { return sellIn; } public int getQuality() { return quality; } } Thank a lot.

http://stackoverflow.com/q/23786170
tagged with: wicket
upvote count: 1
accepted answer: http://stackoverflow.com/a/23792566
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I have a DataView, whose html is something like this: Username First Name Last Name Username First Name Last Name My goal is to make the entire row clickable. I would use a Link component, but I can't - each element in the dataView is already an Item. Is there an easy way to append the kind of behavior that Link gets when it is not attached to an tag? I.e. the behavior where it generates the javascript to do the link functionality.
has title: Adding a click behavior to a non-anchor component without using the Link component
has answer: http://stackoverflow.com/a/23792566
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23906848
has body: No.. This is a bad practice. Suppose tomorrow org.apache.commons.lang3.StringUtils changes something (removes a method. Though it is unlikely, it can still happen with other classes especially with custom classes), imagine the impact it would have on your code. You are actually tightly coupling your methods with org.apache.commons.lang3.StringUtils.
has comment: http://stackoverflow.com/comment/36812320
type: Answer
has comment: http://stackoverflow.com/comment/36812446
downvote count: 2
answers question: http://stackoverflow.com/q/23906665
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/36812522

http://stackoverflow.com/comment/36614539
comment on: http://stackoverflow.com/a/23798813
type: Comment
has text: this is very helpful . whene i used boxlayout i had some problems in margin and align this post helped me,thanks .
score: 0
type: AnswerComment

jsp
tags question: http://stackoverflow.com/q/23788715
tags question: http://stackoverflow.com/q/23874916
tags question: http://stackoverflow.com/q/23819095
tags question: http://stackoverflow.com/q/23862760
tags question: http://stackoverflow.com/q/23851143
tags question: http://stackoverflow.com/q/23834981
tags question: http://stackoverflow.com/q/23819833
tags question: http://stackoverflow.com/q/23843017
tags question: http://stackoverflow.com/q/23888930
tags question: http://stackoverflow.com/q/23834485
tags question: http://stackoverflow.com/q/23913144
tags question: http://stackoverflow.com/q/23883769
tags question: http://stackoverflow.com/q/23935276
tags question: http://stackoverflow.com/q/23780749
tags question: http://stackoverflow.com/q/23828617
tags question: http://stackoverflow.com/q/23786813
tags question: http://stackoverflow.com/q/23880515
tags question: http://stackoverflow.com/q/23823223
tags question: http://stackoverflow.com/q/23819968
tags question: http://stackoverflow.com/q/23827729
tags question: http://stackoverflow.com/q/23814045
tags question: http://stackoverflow.com/q/23890503
tags question: http://stackoverflow.com/q/23863235
tags question: http://stackoverflow.com/q/23817358
tags question: http://stackoverflow.com/q/23920047
tags question: http://stackoverflow.com/q/23805909
tags question: http://stackoverflow.com/q/23846216
tags question: http://stackoverflow.com/q/23864896
tags question: http://stackoverflow.com/q/23786226
tags question: http://stackoverflow.com/q/23843347
tags question: http://stackoverflow.com/q/23843262
tags question: http://stackoverflow.com/q/23828063
tags question: http://stackoverflow.com/q/23883561
tags question: http://stackoverflow.com/q/23796325
tags question: http://stackoverflow.com/q/23893486
tags question: http://stackoverflow.com/q/23856549
tags question: http://stackoverflow.com/q/23798879
tags question: http://stackoverflow.com/q/23874076
tags question: http://stackoverflow.com/q/23784063
tags question: http://stackoverflow.com/q/23903939
tags question: http://stackoverflow.com/q/23856769
tags question: http://stackoverflow.com/q/23816548
tags question: http://stackoverflow.com/q/23919226
tags question: http://stackoverflow.com/q/23914394
tags question: http://stackoverflow.com/q/23782792
tags question: http://stackoverflow.com/q/23898024
tags question: http://stackoverflow.com/q/23905831
tags question: http://stackoverflow.com/q/23888835
tags question: http://stackoverflow.com/q/23938957
tags question: http://stackoverflow.com/q/23910387
tags question: http://stackoverflow.com/q/23923072
tags question: http://stackoverflow.com/q/23868712
tags question: http://stackoverflow.com/q/23837238
tags question: http://stackoverflow.com/q/23799664
tags question: http://stackoverflow.com/q/23852270
tags question: http://stackoverflow.com/q/23804236
tags question: http://stackoverflow.com/q/23930848
tags question: http://stackoverflow.com/q/23911217
tags question: http://stackoverflow.com/q/23812711
type: Tag
tags question: http://stackoverflow.com/q/23788803
tags question: http://stackoverflow.com/q/23862729
tags question: http://stackoverflow.com/q/23815552
tags question: http://stackoverflow.com/q/23915838
tags question: http://stackoverflow.com/q/23872897
tags question: http://stackoverflow.com/q/23843628
tags question: http://stackoverflow.com/q/23873507
tags question: http://stackoverflow.com/q/23910160
tags question: http://stackoverflow.com/q/23882697
tags question: http://stackoverflow.com/q/23778761
tags question: http://stackoverflow.com/q/23935788
tags question: http://stackoverflow.com/q/23929229
tags question: http://stackoverflow.com/q/23862617
tags question: http://stackoverflow.com/q/23835653
tags question: http://stackoverflow.com/q/23848847
tags question: http://stackoverflow.com/q/23820390
tags question: http://stackoverflow.com/q/23821967
tags question: http://stackoverflow.com/q/23898162
tags question: http://stackoverflow.com/q/23882198
tags question: http://stackoverflow.com/q/23784212

http://stackoverflow.com/q/23849811
has comment: http://stackoverflow.com/comment/36703551
has comment: http://stackoverflow.com/comment/36703543
has title: Two distinct programs running in the same JVM at the same time with the same static variable - Is that an issue?
accepted answer: http://stackoverflow.com/a/23849820
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36703681
has answer: http://stackoverflow.com/a/23849820
score: 2
answer count: 1
downvote count: 0
has body: I have two distinct programs running in the same JVM at the same time, both declare the same static variable: private static final Location loc = Location.getLocation("myLocation"); Should I expect issues?
favorite count: 0

http://stackoverflow.com/q/23840528
score: -1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23840556
tagged with: static
type: Question
has answer: http://stackoverflow.com/a/23840793
downvote count: 2
upvote count: 1
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/36685612
answer count: 5
has body: Base class class Basics415 { Basics1 b1 = new Basics1(); public static void main_hooo(){ out.println("1234"); } void main_ho(){ } } Extended class public class Basics5 extends Basics415{ public static void main(String[] args){ this.main_hooo(); // this line throws error. } } Why we aren't able to use this instance inside a static method of the extended class?
has answer: http://stackoverflow.com/a/23840556
has answer: http://stackoverflow.com/a/24030612
has comment: http://stackoverflow.com/comment/36685630
has answer: http://stackoverflow.com/a/23840564
has comment: http://stackoverflow.com/comment/36685605
has title: Why can't we use this instance in the static method of extended class?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23840570
has answer: http://stackoverflow.com/a/23840570

http://stackoverflow.com/comment/36738105
type: Comment
comment on: http://stackoverflow.com/a/23867741
type: AnswerComment
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54430/discussion-between-thorn-and-marya).

http://stackoverflow.com/comment/36629115
comment on: http://stackoverflow.com/q/23808441
type: Comment
has text: My fault: `ntlmauth.dll` is from jTDS, Microsofts JDBC driver has `sqljdbc_auth.dll`. I don't know if jTDS has Kerberos support.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36738615
score: 0
type: Comment
type: QuestionComment
has text: One more thing - the screenshot shows that you are not using profiler, but sampler. So there is no instrumentation and everything mentioned about the instrumentation overhead in the answer section below is invalid.
comment on: http://stackoverflow.com/q/23850407

http://stackoverflow.com/comment/36684702
score: 0
comment on: http://stackoverflow.com/q/23839782
has text: Directly splitting bz2 streams would be too risky - there are multistream bz2's and what-not - so both `SPLITTER` and the data are actually string.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23799696
tagged with: file-search
has body: JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try{ String filename = fileName.getText(); FileReader fr = new FileReader(filename); BufferedReader br = new BufferedReader(fr); Scanner scan = new Scanner(br); filename = br.readLine(); if (filename != null){ String text = txtKeyword.getText(); String line; boolean hasError = true; while ((line = br.readLine()) != null) { if(line.contains(text)){ String newline = "\n"; jTextArea1.append(line + newline); hasError = false; } } if (hasError) { JOptionPane.showMessageDialog(null, "Text Not Found"); br.close(); fr.close(); } }}catch(IOException e){ JOptionPane.showMessageDialog(null, "File Not Found"); } } }); So, in this function, I want to read some text files within a mentioned directory/folder by input. User selects the directories/folder using JFILECHOOSER method and the output will be listed in a textbox [Directory]. Lets say that fileName is the text field where users input the name of the file, after users input their file name, they click on a start button. The start button functions on whereby it will look into the given directory/folder [the textbox] and search for text files and output the text files' name using system.out.printIn. I have not tried the code for directory/folder path because I'm not sure how to code for it. Any help or guide to this problem? I have only created one class and I'm new to JAVA GUI The full code is as below: package com.directory.file; import java.awt.BorderLayout; import java.awt.Event; import java.awt.EventQueue; import java.awt.TextArea; import java.awt.TextComponent; import java.awt.Event.*; import java.io.FileReader; import java.io.BufferedReader; import java.util.Scanner; import javax.lang.model.element.VariableElement; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JButton; import javax.swing.JSpin…
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36607940
type: Question
has comment: http://stackoverflow.com/comment/36608179
score: 0
has title: Java GUI Reading a file with the mentioned path
has answer: http://stackoverflow.com/a/23800200
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: io
tagged with: filereader
tagged with: swing
has comment: http://stackoverflow.com/comment/36608092

http://stackoverflow.com/comment/36658268
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23825652
has text: May be use relative path? "..\\some\\relative\\path"? Or what you problem, why you can not construct path?
type: AnswerComment

http://stackoverflow.com/comment/36840600
has text: No, and if you close it explicitly the connection will be put back into connection pool instead of real close (if you use a JTA-compatible `DataSource`).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23921386

http://stackoverflow.com/comment/36872316
comment on: http://stackoverflow.com/a/23848262
has text: Can you explain `time`? It's a magic number.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23874315
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23874176
has body: Should work fine (using char array): public static String reve(String sentence) { char[] characters = sentence.toCharArray(); int i = 0; int j = sentence.length()-1; while(j &gt; i) { char temp = characters[i]; characters[i] = characters[j]; characters[j] = temp; i++;j--; } return new String(characters); }

http://stackoverflow.com/a/23871936
type: Answer
has body: How about doing it without writing a runner? Instead, write a @BeforeClass method that uses a singleton list that records each before-category method that has been run in the current test run, and that knows how to run all the before-category methods (each probably in its own class). The @BeforeClass method determines its class's @Category, checks the list, and does nothing if that @Category's before-category method has already run, or runs the before-category method and note in the list that that @Category's method has been run. Not requiring a custom runner is better because it will work in environments that provide their own runners, such as IDEs and continuous integration servers.
upvote count: 1
answers question: http://stackoverflow.com/q/23870993
has comment: http://stackoverflow.com/comment/37048879
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23870993

http://stackoverflow.com/q/23912587
tagged with: android
answer count: 4
has comment: http://stackoverflow.com/comment/36822954
has comment: http://stackoverflow.com/comment/37001570
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36822951
has answer: http://stackoverflow.com/a/23912729
upvote count: 1
has body: this is jSon Data File from where i want to fetch the data but there is following - error: 05-28 12:42:41.691: W/System.err(2887): org.json.JSONException: No value for vehicle_type 05-28 12:42:41.691: W/System.err(2887): at org.json.JSONObject.get(JSONObject.java:354) 05-28 12:42:41.691: W/System.err(2887): at org.json.JSONObject.getString(JSONObject.java:510) 05-28 12:42:41.691: W/System.err(2887): at com.example.capo.ui.MyCarActivity.returnjson(MyCarActivity.java:124) 05-28 12:42:41.691: W/System.err(2887): at com.example.capo.net.JSONPostRequest.onPostExecute(JSONPostRequest.java:63) 05-28 12:42:41.691: W/System.err(2887): at com.example.capo.net.JSONPostRequest.onPostExecute(JSONPostRequest.java:1) JSON code: {"status":"1","records":[{"vehicle_company":"jande","vehicle_type":"751","vehicle_color":"Black","vehicle_rc":"harry1234","vehicle_capacity":"6"}],"message":"selected &gt; Data"} The code to parse the JSON: //... // Parse String to JSON object try { jObj = new JSONObject(builder.toString()); // jarray = new JSONArray(builder.toString()); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON Object return jObj; } //... The POJO Java class to map the object to: public class MyCar { public String vehicle_type,vehicle_company,vehicle_color,vehicle_rc,vehicle_capacity; public String getVehicle_type() { return vehicle_type; } public void setVehicle_type(String vehicle_type) { this.vehicle_type = vehicle_type; } public String getVehicle_company() { return vehicle_company; } public void setVehicle_company(String vehicle_company) { this.vehicle_company = vehicle_company; } public String getVehicle_color() { return vehicle_color; } public void setVehicle_color(String vehicle_color) { this.vehicle_color = vehicle_color; } public String getVehicle_rc() { return vehicle_rc; } public void setVehicle_rc(String vehicle_rc) { this.vehicle_rc = vehicle_rc; } public String getVehicle_capacity() { return vehicle_capacity; } pu…
tagged with: php
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36824140
score: -1
has comment: http://stackoverflow.com/comment/36822859
has comment: http://stackoverflow.com/comment/36822936
type: Question
has comment: http://stackoverflow.com/comment/36823261
has answer: http://stackoverflow.com/a/23913027
has answer: http://stackoverflow.com/a/23913315
has title: Fetching JSON Data Error
favorite count: 0
has answer: http://stackoverflow.com/a/23913049

http://stackoverflow.com/q/23863909
tagged with: weblogic8.x
has body: I need suggestions/help on the issue below: I am working on oracle migration work for a Java web application. I want to move my application from oracle 9i to 11g The environment is : Jdk – 1.4.2 Weblogic 8.1(SP6) Database to connect to – Oracle 11g weblogic.db.url=jdbc:oracle:thin:@${weblogic.db.host}:${weblogic.db.port}/ weblogic.db.driver=oracle.jdbc.OracleDriver Oracle JDBC Driver version - "10.2.0.2.0" When I query any table that has a CLOB datatype , the query fails to execute with the following error: “Cannot assign value of type 'weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB' to property 'description_en' of type 'oracle.sql.CLOB'”. I have read in oracle docs that weblogic 8.1(S6) supports oracle 11g . Any other query which returns other than CLOB data type, it works fine, the issue is only with CLOB datatype that too with Oracle 11g :( The same code works fine if it is connected to Oracle 9i, the only problem is with Oracle 11g. My assumption is that I may be missing some extra wrappers/extensions which may be needed to map the CLOB datatype as I think there is no direct support from weblogic 8.1. I also am thinking on below lines: If the application includes its own Oracle jar file so is not using the data source provided by WebLogic. But I do not know on how should I ascertain this. Please help!
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36730910
has comment: http://stackoverflow.com/comment/36730535
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23866247
accepted answer: http://stackoverflow.com/a/23866247
has comment: http://stackoverflow.com/comment/36730974
has title: Is weblogic 81.(SP6) compatible with oracle 11 G and Jdk 1.4.2
has comment: http://stackoverflow.com/comment/36730861
score: 2
has comment: http://stackoverflow.com/comment/36731010
tagged with: clob
downvote count: 0
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/36730951
type: AnsweredQuestion

http://stackoverflow.com/q/23819348
upvote count: 3
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23819715
type: Question
has body: So, if you can't already tell by my title, I'm really new to java. I'm trying to write an applet that when you click on a button (button x for instance) a new text window will appear with some information on it. I'm just wondering how I would implement that into my code. Thank you for any help you can give me. import java.awt.Container; import java.awt.FlowLayout; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; public class Button1 extends JApplet { private JButton b1 = new JButton("Button 1"), b2 = new JButton("Button 2"), b3 = new JButton("Button 3"); public void init() { Container cp = getContentPane(); cp.setLayout(new FlowLayout()); cp.add(b1); cp.add(b2); cp.add(b3); } public static void main(String[] args) { run(new Button1(), 200, 50); } public static void run(JApplet applet, int width, int height) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(applet); frame.setSize(width, height); applet.init(); applet.start(); frame.setVisible(true); } } ///:~
score: -1
has comment: http://stackoverflow.com/comment/36645167
has comment: http://stackoverflow.com/comment/36645171
downvote count: 4
answer count: 1
tagged with: button
favorite count: 0
has title: How do I implement a "if/then" statement with buttons in Java?
has comment: http://stackoverflow.com/comment/36645164
has comment: http://stackoverflow.com/comment/36645414
has comment: http://stackoverflow.com/comment/36645151

http://stackoverflow.com/comment/36723719
has text: @ZouZou, I think this it is plausible that someone else could have the same problem and find help here. The answer could be improved, however.
comment on: http://stackoverflow.com/a/23860149
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42403196
comment on: http://stackoverflow.com/a/23886725
type: Comment
has text: Please, make sure you use the latest version. The library is being continuously reviewed & improved and new algorithms / features are being added: http://mvnrepository.com/artifact/com.nimbusds/nimbus-jose-jwt As of version 3.2 all standard JWS signature algorithms as fully supported as well as all JWE encryption algs, save for PBES2 and ECDH-ES.
score: 3
type: AnswerComment

http://stackoverflow.com/comment/36829452
type: Comment
type: QuestionComment
score: 0
has text: @Andi `Thread.currentThread().sleep()` will call the exact same method as `Thread.sleep()`.
comment on: http://stackoverflow.com/q/23915838

http://stackoverflow.com/a/23912099
has comment: http://stackoverflow.com/comment/36822183
answers question: http://stackoverflow.com/q/23911830
has comment: http://stackoverflow.com/comment/36821868
has comment: http://stackoverflow.com/comment/36823375
score: 0
has comment: http://stackoverflow.com/comment/36822015
has comment: http://stackoverflow.com/comment/36822703
type: Answer
has body: Based on the program it is evident that after the 6th attempt the loop exits and the program ends. How about opening an infinite loop ie while(true) and then witin the while loop have this as your first check while(true){ if(attempts &gt;= 6){ if (JOptionPane.showConfirmDialog(null, "Want to play again?", "Play again?", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) { System.out.println("Play again soon!"); System.exit(0); } else { randomNumber = random.nextInt(100); System.out.println(randomNumber); attempts = 0; } } } ....Rest of your code goes here }
has comment: http://stackoverflow.com/comment/36881259
has comment: http://stackoverflow.com/comment/36822443

http://stackoverflow.com/a/24021049
has comment: http://stackoverflow.com/comment/46969708
has comment: http://stackoverflow.com/comment/46976356
has body: Just my 2 cents in the discussion. For quick and easy solution I'd put the property file not to the WAS_HOME/classes but to the PROFILE_ROOT/properties - this folder is on the classpath, and its used to store properties anyway. The one benefit over /classes is that is scoped to profile, so if you have different profiles for example for test or integration they may have different settings. And for 'pure' WebSphere solution, that would allow managing properties via console you could check out the resource environment providers (but its rather long, complicated solution): http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html
downvote count: 0
has comment: http://stackoverflow.com/comment/46979147
type: Answer
has comment: http://stackoverflow.com/comment/46973701
has comment: http://stackoverflow.com/comment/46974117
upvote count: 9
has comment: http://stackoverflow.com/comment/46973001
answers question: http://stackoverflow.com/q/23835508
score: 9

http://stackoverflow.com/a/23860881
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36732121
accepted answer of: http://stackoverflow.com/q/23859671
answers question: http://stackoverflow.com/q/23859671
type: Answer
has comment: http://stackoverflow.com/comment/36730884
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36760418
has comment: http://stackoverflow.com/comment/36727762
has comment: http://stackoverflow.com/comment/36750198
has comment: http://stackoverflow.com/comment/36802607
has comment: http://stackoverflow.com/comment/36750522
has body: Had to reformat your code for better readability. By doing so, I have found a few potential bugs. In the jump2() method, the second if statement does not check the validity of jump2. It might be the cause of exception at gr.get(jump2 == null) condition in that if statement. The same logic applies to the subsequent else if statement. This time, you are not checking the validity of jump1. In the move() method, the first else if, you only check the validity of next1 twice which seems a bug. Please find it in the reformatted code in your question. Overall, I think you need to modify the if conditions as simple(readable) as possible. Reformatting will help, too. [Added] Two minor things. In the canMove() method, you use gr only at the first if statement. You are using getGrid() instead of gr in the second if statement. Can you not avoid doing new Location everytime you get grid in the if statements? You are using those grids without checking their validity. Are you sure they are valid? You might create them at the beginning of the method, check their validity, and use them in the if statements. It might help the readability of the if statements, too. [Added more] jump2() method simplification sample The following code ignores the other side of column (being invalid, null or red piece). It is on my assumption that it doesn't matter what the condition of other sides when one side is valid for jumping over a black piece. public boolean jump2(Location loc){ Grid&lt;Actor&gt; gr = getGrid(); if (gr == null) return false; Location jump1 = new Location(loc.getRow() + 2, loc.getCol() - 2); Location jump2 = new Location(loc.getRow() + 2, loc.getCol() + 2); Location adjacent1 = new Location(loc.getRow() + 1, loc.getCol() - 1); Location adjacent2 = new Location(loc.getRow() + 1, loc.getCol() + 1); // try one column if( gr.isValid(jump1)) { if( (gr.get(jump1) == null) &amp;&amp; (gr.get(adjacent1) instanceof BlackPieces)) { gr.get(adjacent1).removeSelfFromGrid(); moveTo(jump1); retu…

http://stackoverflow.com/q/23881004
has title: Any APIs or code to Convert Raw Image (like DNG) to JPG format in Java/Android
tagged with: http://stackoverflow.com/tag/jpeg
has comment: http://stackoverflow.com/comment/36762987
score: 2
downvote count: 0
has body: I was looking to convert the Raw Image data (like .DNG extension) to JPG format using Android. There is a similar app in Playstore Raw Decoder Free Can anyone provide me some clue or any open source code to do same. [EDIT] I have already tried THIS using Visual C++ and able to develop the Application for Windows OS. The stuff I am looking for Android.
tagged with: java
has comment: http://stackoverflow.com/comment/36767056
type: Question
has answer: http://stackoverflow.com/a/23881119
tagged with: image
linked to: http://stackoverflow.com/q/1222324
upvote count: 2
has comment: http://stackoverflow.com/comment/36762781
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36762643
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/36834029
comment on: http://stackoverflow.com/q/23918445
score: 1
has text: We don't make library recommendations. In the future, please omit that part of your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23827311
score: 1
linked to: http://stackoverflow.com/q/4411129
favorite count: 0
tagged with: javassist
upvote count: 1
has body: I want to create a proxy for a class instead of an interface. There are answers describing use of cglib or Javassist for this purpose (e.g. https://stackoverflow.com/a/4449998/), but I've run into a wrinkle, as the class I am interested in proxying doesn't have a no-argument constructor, so Enhancer.create() throws an exception. Looking at Javassist ProxyFactory javadoc, it needs constructor arguments as well. The obvious workaround is finding constructor argument types by reflection and passing an array of nulls/0/etc. but this won't work if the constructor throws an exception. Are there better alternatives (perhaps using some other library)?
type: AnsweredQuestion
tagged with: reflection
has answer: http://stackoverflow.com/a/23832048
tagged with: java
has title: Create a dynamic proxy for a class without no-argument constructor
tagged with: proxy-classes
type: Question
tagged with: cglib
accepted answer: http://stackoverflow.com/a/23832048
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37127544
has text: can you be more specific? you are looking something automated, declarative? why just writing a piece of code (`AvroA convert(AvroB) {...}`) doesn't work?
type: Comment
comment on: http://stackoverflow.com/q/23893118
score: 0
type: QuestionComment

http://stackoverflow.com/a/23863744
has comment: http://stackoverflow.com/comment/36732707
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36736077
has comment: http://stackoverflow.com/comment/36767497
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36761569
answers question: http://stackoverflow.com/q/23862760
has body: Additional action required to expose redirectAction result. /WEB-INF/jsp/showGet.jsp /WEB-INF/jsp/PostForm.jsp showGet
has comment: http://stackoverflow.com/comment/36761843
has comment: http://stackoverflow.com/comment/36768395
accepted answer of: http://stackoverflow.com/q/23862760
score: 1
upvote count: 1

http://stackoverflow.com/a/23843669
has body: Take a look at Guava's EventBus, a part of Guava's library that deals with in-process PubSub-style communication. It might suit your needs and save you from re-inventing some wheel. If you are looking for interprocess communication, consider a message queue just like Evgeniy proposed.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23843348
answers question: http://stackoverflow.com/q/23843348
type: Answer

http://stackoverflow.com/comment/36632738
type: Comment
comment on: http://stackoverflow.com/a/23812898
has text: @PratLee if you change the code the way I suggested, does it make a difference?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23919226
has comment: http://stackoverflow.com/comment/36851119
score: 1
has comment: http://stackoverflow.com/comment/36856922
favorite count: 0
has comment: http://stackoverflow.com/comment/36857509
has answer: http://stackoverflow.com/a/23941310
upvote count: 1
has comment: http://stackoverflow.com/comment/36859329
tagged with: valuestack
has comment: http://stackoverflow.com/comment/36858708
has title: How to use OGNL index reference operator
type: AnsweredQuestion
has body: Working with OGNL you can reference action context objects like #application, #session,#root, #action,#request,#parameters,#attr, and the action context with #context. The framework sets the OGNL context to be our ActionContext, and the value stack to be the OGNL root object. And OGNL uses [] as index reference to access an object properties. For example if the object foo has a property bar then it can access like foo.bar or foo['bar']. It also works if foo is a map and bar is a key. Now, I want to put a variable and a value to the value stack context like that &lt;s:set var="bar" value="'hello'"/&gt; &lt;s:set var="foo" value="'bar'"/&gt; and print the value &lt;s:property value="%{#attr[#foo]}"/&gt; It should print hello. I'd like to know how this works. I know that #attr is an object that doesn't have a property referenced by #foo, i.e. bar. However this works. It also works if I use #request and #context, and probably #root instead of #attr. Neither of this objects has a property bar, but OGNL thinks otherwise. I'd like to know what OGNL thinks about property of the object it references and why this expression is working. Also if there are alternative ways to print hello using #foo reference in OGNL expression.
has comment: http://stackoverflow.com/comment/36858161
has comment: http://stackoverflow.com/comment/36836543
has comment: http://stackoverflow.com/comment/36853377
tagged with: java
linked to: http://stackoverflow.com/q/26067412
type: Question
has comment: http://stackoverflow.com/comment/36836022
accepted answer: http://stackoverflow.com/a/23941310
has comment: http://stackoverflow.com/comment/36836127
tagged with: ognl
downvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36854879
has comment: http://stackoverflow.com/comment/36859683
tagged with: struts2
has comment: http://stackoverflow.com/comment/36859534
has comment: http://stackoverflow.com/comment/36860940

http://stackoverflow.com/q/23874076
tagged with: java
has title: imported class cannot be resolved to a type
type: Question
has comment: http://stackoverflow.com/comment/36749117
score: 0
has body: I am new to eclipse and jsp. I tried a lot to import class in jsp file but getting this error continuously. An error occurred at line: 13 in the jsp file: /index.jsp DateDemo cannot be resolved to a type I googled but not getting where to put my class. Below is the structure and code- src->beans-> DateDemo.java package beans; import java.util.*; public class DateDemo{ public Date returnDate() { Date d=new Date(); return d; } } WebContent->index.jsp Register here..!!! <%@ page import="beans.DateDemo"%> <% DateDemo demo = new DateDemo(); out.println("Current date : " + demo.returnDate()); %> How to solve this ?
has comment: http://stackoverflow.com/comment/36749328
has answer: http://stackoverflow.com/a/23874149
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36748856
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36749052

http://stackoverflow.com/q/23825840
favorite count: 0
tagged with: postgresql
type: UnansweredQuestion
tagged with: netbeans
score: 1
tagged with: java
upvote count: 1
has body: I am trying to connect netbeans with postgreSQL. However, it gives connection error even though my username and password is correct. Following code is my persistence.xml. Can you help me please? <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider com.travelling.entity.CbrCase com.travelling.entity.CbrCaseAttraction com.travelling.entity.CbrAttractionXCategory com.travelling.entity.CbrCategory com.travelling.entity.CbrAttraction com.travelling.entity.CbrCaseXCategory com.travelling.entity.CbrDay com.travelling.entity.CbrDayXAttraction com.travelling.entity.CbrAttractionXAttraction <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/travelling"/> <property name="hibernate.connection.username" value="*****"/> <property name="hibernate.connection.password" value="*****"/> <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> <property name="hibernate.show_sql" value="true"/> and this is the error: Internal Exception: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres" and i am pretty sure my password is correct because i can log in with the same password to the database.
type: Question
has comment: http://stackoverflow.com/comment/36660273
has comment: http://stackoverflow.com/comment/36657807
has comment: http://stackoverflow.com/comment/36657589
has comment: http://stackoverflow.com/comment/36657268
has comment: http://stackoverflow.com/comment/36657526
has answer: http://stackoverflow.com/a/42387592
answer count: 1
downvote count: 0
has title: PostgreSQL Java Authentication error

http://stackoverflow.com/comment/36694414
type: QuestionComment
has text: I can only repeat myself: Write a harnessed benchmark. At least for future attempts, I have done this for you this time. I recommend you to use JMH. Alternatively, use Caliper, if you must but I like JMH better.
comment on: http://stackoverflow.com/q/23828392
score: 0
type: Comment

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

http://stackoverflow.com/q/23843780
favorite count: 0
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/36691443
has body: The title pretty much says all. If I provide a library and someone uses it he can write classes and add them to packages that are defined by my library. However this rises security issues as this would mean that he gets access to methods within the library that are defined without access modifier. Is there a solution to forbid a user to add classes to an existing package?
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36695142
has comment: http://stackoverflow.com/comment/36696270
type: Question
has answer: http://stackoverflow.com/a/23845774
tagged with: security
answer count: 1
downvote count: 0
has title: Java: Is it possible to close a package (restrict adding classes to it)

http://stackoverflow.com/a/23931802
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36858966
type: Answer
has comment: http://stackoverflow.com/comment/36859141
upvote count: 1
score: 1
has body: I totally agree with ruediste that parsing Java code with regular expression is not the best idea, and you should really avoid that (see links above). However, if you really, really have to, maybe try this regex: (?&lt;!\/\/)@Column.*?name\s*=\s*"(.*?)"(?:.*?length\s*=\s*(\d+))? (First group: name, second group: length, optional)
accepted answer of: http://stackoverflow.com/q/23931572
answers question: http://stackoverflow.com/q/23931572

http://stackoverflow.com/q/23787491
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23787619
score: 0
has comment: http://stackoverflow.com/comment/36584400
possible better answer: http://stackoverflow.com/a/23787599
has answer: http://stackoverflow.com/a/23787599
has answer: http://stackoverflow.com/a/23787605
tagged with: java.util.scanner
has title: Checking user input is a number
has answer: http://stackoverflow.com/a/23790592
has body: I need to check users input. I have a menu and I need the user to select numbers 0-4 but if the user selects a letter instead of a number then I just get a InputMismatchException. So I am trying to validate that the user entered a number. Here is my code: public class TestBankAccount { static Scanner input = new Scanner(System.in); public static void main(String[] args) throws FileNotFoundException { ArrayList&lt;BankAccount&gt; list = new ArrayList&lt;BankAccount&gt;(); int choice; do { System.out.println("1. Deposit money"); System.out.println("2. Withdraw money"); System.out.println("3. Check balance"); System.out.println("4. Create new account"); System.out.print("Your choice, 0 to quit: "); choice = input.nextInt(); switch (choice) { case 1: depositMoney(list); break; case 2: withdrawMoney(list); break; case 3: checkBalance(list); break; case 4: createNewAccount(list); break; case 0: System.out.println("Thank you for trusting us with your banking needs!"); break; default: System.out.println("Invalid option is selected!"); } System.out.println(); } while (choice != 0); if (list.size() &gt; 0) { displayResults(list); } } I was thinking to do something like while (choice != 0 &amp;&amp; choice != input.hasNextInt()); but I get an error. Any ideas?
accepted answer: http://stackoverflow.com/a/23787619
answer count: 4

http://stackoverflow.com/comment/36594204
comment on: http://stackoverflow.com/a/23792542
has text: Yeah, that makes a lot of sense. Thank you :)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23890294
answer count: 2
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/23890815
possible better answer: http://stackoverflow.com/a/23890439
tagged with: synchronization
favorite count: 0
has title: Consumer Producer doesn't work in java
has body: I tried to create a consumer producer according to the offical oracle example (http://docs.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html). This solution creates a problem for me beacuse somehow consume (or produce) are executed twice. example output: 0.27621192120612414 0.24838246527492802, 0.30404137713732027 0.8848100139189661 0.9910138279470992, 0.778606199890833 0.17368370874476935, 0.5661899414440023 ....... My code is very similar to the one oracle posted: import java.util.Random; public class Consumer implements Runnable { private SharedData sharedData; public Consumer(SharedData sharedData) { this.sharedData = sharedData; } @ Override public void run() { // TODO Auto-generated method stub for (int i = 0; i &lt; 10; i++) { double result = this.sharedData.calc(); System.out.println(result); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public class Producer implements Runnable { private SharedData sharedData; private Random numGenerator = new Random(); public Producer(SharedData sharedData) { this.sharedData = sharedData; } @ Override public void run() { // TODO Auto-generated method stub for (int i = 0; i &lt; 10; i++) { double firstNum = numGenerator.nextDouble(); double secondNum = numGenerator.nextDouble(); this.sharedData.store(firstNum, secondNum); System.out.println(firstNum + ", " + secondNum); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public class SharedData { private double x = 0; private double y = 0; private boolean empty = true; public synchronized double calc() { while (empty) { try { wait(); } catch (InterruptedException e) {} } empty = true; notifyAll(); return (x + y) / 2; } public synchronized void store(double x, double y) { while (!empty) { try { wait(); } catch (InterruptedException e) {} } // Toggle status. empty = false; this.x = x; this.y = y; notifyAll(); } }
has answer: http://stackoverflow.com/a/23890815
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23890439
type: Question
score: 0

http://stackoverflow.com/comment/36720040
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23848792
type: Comment
has text: I pushed a [fix](https://github.com/kichik/pecoff4j/commit/2814da662e784f94c3cc0d8cb8ac48b372dc8e58). Try pulling again.

http://stackoverflow.com/comment/36806383
has text: If there isn't a view there is nothing going to be rendered. If for the url `/foo/bar` there is no `foo/bar.html` you will get an exception. The views have to be there. Also you didn't mention Spring Boot nor Thymeleaf in your initial question!. What is it you want to happen, because I'm a bit lost now.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23789444

http://stackoverflow.com/q/23819037
has answer: http://stackoverflow.com/a/23819902
type: Question
has title: Java Joda-Time , assign LocalDate to Month and Year
tagged with: java
possible better answer: http://stackoverflow.com/a/23819168
has answer: http://stackoverflow.com/a/23819168
accepted answer: http://stackoverflow.com/a/23819902
tagged with: jodatime
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/15313090
has body: I have never used Joda-Time before but I have ArrayList which contains objects with LocalDate and count. So I have count for each day in ArrayList and each day is only once in ArrayList. I need to calculate counts for each month of year, which is in list. My data: E.g.: dd.MM.yyyy 17.01.1996 (count 2) 18.01.1996 (count 3) 19.02.1996 (count 4) 19.03.1996 (count 1) 18.05.1997 (count 3) Now I want outpur like this: MM.yyyy 01.1996 -&gt; 2 (17.1.1996) + 3 (18.1.1996) = 5 02.1996 -&gt; 4 (19.2.1996) = 4 03.1996 -&gt; 1 (19.3.1996) = 1 05.1997 -&gt; 3 (18.5.1997) = 3 Simply I need to get count for each month, but I do not know what would be best way to achieve this. Data class: private class Info{ int count; LocalDate day; } And result I would put in some class which contains Month and Year date + count.
type: AnsweredQuestion

http://stackoverflow.com/a/23913526
has body: First of all you don't need to call test1.A(). It's not a method, it's a public constructor of class A. If you need to get private variable url from another class you can create method: public String getUrl() { return this.url; } and get it in your class B, like this: String url2 = test1.getUrl();
answers question: http://stackoverflow.com/q/23913101
has comment: http://stackoverflow.com/comment/36826720
has comment: http://stackoverflow.com/comment/36830032
has comment: http://stackoverflow.com/comment/36827341
has comment: http://stackoverflow.com/comment/36829962
score: 0
type: Answer

http://stackoverflow.com/q/23934392
type: Question
answer count: 2
favorite count: 0
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23934420
possible better answer: http://stackoverflow.com/a/23934463
has title: Android Crash while clicking the Button.
has answer: http://stackoverflow.com/a/23934420
upvote count: 1
downvote count: 1
has body: So, I'm kind of totally brand new to Android development and I'm trying to get my ball rolling with a decent dice-rolling app. I've had a look at the method that I'm calling and it doesn't seem that's the problem with my coding - but when I click one of these Image Buttons (I have some with identical coding, except for different dice numbers), the app freezes up and boots the device back to the menu (tested on Galaxy Nexus AVD and actual Samsung Galaxy S4 device). The code in question (defined in fragment_main.xml): &lt;ImageButton android:id="@+id/d4ImageButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_weight="1" android:cropToPadding="false" android:src="@drawable/d4" android:onClick="rolld4()" /&gt; as well as the method it's attempting to call (defined in main_activity.java) private int _dice; protected int dice() { return _dice; } public void rolld4() { Random rndGen = new Random(System.nanoTime()); _dice = rndGen.nextInt(4); } Thanks in advance for any and all help!
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
has answer: http://stackoverflow.com/a/23934463

http://stackoverflow.com/comment/36779462
score: 0
comment on: http://stackoverflow.com/q/23889764
type: Comment
type: QuestionComment
has text: Well, nothing prevents you from using one as a relay between your producers and consumers; there are also solutions like Terracotta which allow sharing a POJO (with locking and all) across several VMs.

http://stackoverflow.com/comment/61556457
has text: The problem is that usually when it happens my code already hit the breakpoint and I'm stuck with no mouse cursor and don't know/don't have configured keyboard shortcut for "evaluate expression". But with working keyboard I can still start terminal and run some commands to enable second cursor. Yet another way is to configure the breakpoint to evaluate Mouse.setGrabbed(false).
score: 1
comment on: http://stackoverflow.com/a/36991052
type: AnswerComment
type: Comment

sql
tags question: http://stackoverflow.com/q/23921449
tags question: http://stackoverflow.com/q/23873521
tags question: http://stackoverflow.com/q/23859231
tags question: http://stackoverflow.com/q/23862947
tags question: http://stackoverflow.com/q/23922115
tags question: http://stackoverflow.com/q/23846718
tags question: http://stackoverflow.com/q/23784634
tags question: http://stackoverflow.com/q/23931445
tags question: http://stackoverflow.com/q/23807104
tags question: http://stackoverflow.com/q/23905916
tags question: http://stackoverflow.com/q/23807566
tags question: http://stackoverflow.com/q/23783248
tags question: http://stackoverflow.com/q/23879635
tags question: http://stackoverflow.com/q/23882684
tags question: http://stackoverflow.com/q/23789515
tags question: http://stackoverflow.com/q/23883619
tags question: http://stackoverflow.com/q/23937165
tags question: http://stackoverflow.com/q/23819010
tags question: http://stackoverflow.com/q/23929029
tags question: http://stackoverflow.com/q/23838682
tags question: http://stackoverflow.com/q/23824428
tags question: http://stackoverflow.com/q/23866583
tags question: http://stackoverflow.com/q/23855559
tags question: http://stackoverflow.com/q/23940701
tags question: http://stackoverflow.com/q/23818345
tags question: http://stackoverflow.com/q/23841856
tags question: http://stackoverflow.com/q/23805135
tags question: http://stackoverflow.com/q/23836545
tags question: http://stackoverflow.com/q/23852270
tags question: http://stackoverflow.com/q/23834233
tags question: http://stackoverflow.com/q/23782313
tag name: sql
tags question: http://stackoverflow.com/q/23781513
tags question: http://stackoverflow.com/q/23909152
type: Tag
tags question: http://stackoverflow.com/q/23921230
tags question: http://stackoverflow.com/q/23929904
tags question: http://stackoverflow.com/q/23871931
tags question: http://stackoverflow.com/q/23865603
tags question: http://stackoverflow.com/q/23889455
tags question: http://stackoverflow.com/q/23848847
tags question: http://stackoverflow.com/q/23925186
tags question: http://stackoverflow.com/q/23821377
tags question: http://stackoverflow.com/q/23789957
tags question: http://stackoverflow.com/q/23840998
tags question: http://stackoverflow.com/q/23897599
tags question: http://stackoverflow.com/q/23930151
tags question: http://stackoverflow.com/q/23826823
tags question: http://stackoverflow.com/q/23804168
tags question: http://stackoverflow.com/q/23793963
tags question: http://stackoverflow.com/q/23932650
tags question: http://stackoverflow.com/q/23800251
tags question: http://stackoverflow.com/q/23804907
tags question: http://stackoverflow.com/q/23823618
tags question: http://stackoverflow.com/q/23917771
tags question: http://stackoverflow.com/q/23924544
tags question: http://stackoverflow.com/q/23862729
tags question: http://stackoverflow.com/q/23880300
tags question: http://stackoverflow.com/q/23910328
tags question: http://stackoverflow.com/q/23818157
tags question: http://stackoverflow.com/q/23801449
tags question: http://stackoverflow.com/q/23889852
tags question: http://stackoverflow.com/q/23791237
tags question: http://stackoverflow.com/q/23804973
tags question: http://stackoverflow.com/q/23893568
tags question: http://stackoverflow.com/q/23853348
tags question: http://stackoverflow.com/q/23881201
tags question: http://stackoverflow.com/q/23858082
tags question: http://stackoverflow.com/q/23792680
tags question: http://stackoverflow.com/q/23882400
tags question: http://stackoverflow.com/q/23798676
tags question: http://stackoverflow.com/q/23823450
tags question: http://stackoverflow.com/q/23909773
tags question: http://stackoverflow.com/q/23828640
tags question: http://stackoverflow.com/q/23867256
tags question: http://stackoverflow.com/q/23860779
tags question: http://stackoverflow.com/q/23786390
tags question: http://stackoverflow.com/q/23784324
tags question: http://stackoverflow.com/q/23910795
tags question: http://stackoverflow.com/q/23878099

http://stackoverflow.com/comment/36838272
comment on: http://stackoverflow.com/q/23920316
score: 0
type: Comment
type: QuestionComment
has text: @JudyJiang Do you need to store the data? or could you bypass that and access it directly from the file?

http://stackoverflow.com/comment/36814280
score: 1
has text: Why downvoted? I think this is an interesting question about constructors and overriding
comment on: http://stackoverflow.com/q/23907276
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36601205
has text: @user3646145 Are you always going to be filtering by author? Or will your search criteria change?
score: 0
comment on: http://stackoverflow.com/q/23796055
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36707664
comment on: http://stackoverflow.com/q/23848469
has text: *"In java 7 and 8, as the `FontManager` has changed,.."* What on Earth is `FontManager`? It is not in the [JSE 8 docs](http://docs.oracle.com/javase/8/docs/api/index.html). Link to the Java Docs. Also *why* are you trying to get the path of the font? What application feature does it serve?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23866315
has title: Is there a way to determine if an recipient email address is invalid
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23866520
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/13514005
type: Question
has comment: http://stackoverflow.com/comment/36735021
duplicate of: http://stackoverflow.com/q/201323
score: -1
tagged with: optimization
linked to: http://stackoverflow.com/q/201323
tagged with: jakarta-mail
has body: With the mailing application I'm working on, I catch SendFailedException to handle validation of recipient email addresses. After reading a bit more though, I learned that catch blocks are quite expensive. It made me wonder if there was any way to determine if an address is invalid before the message is sent. This is more of an optimization problem of sorts.
tagged with: catch-block
downvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/624581
has comment: http://stackoverflow.com/comment/36735017
has comment: http://stackoverflow.com/comment/36734720
favorite count: 0
has comment: http://stackoverflow.com/comment/36735157

http://stackoverflow.com/a/23881540
upvote count: 1
answers question: http://stackoverflow.com/q/23881298
has comment: http://stackoverflow.com/comment/36764048
type: Answer
downvote count: 0
score: 1
has body: Just use closeButton.setOnClickListener(new OnClickListener(){ //override method public void onClick(View v) { //do something } }); In addition,you can't remove the parent RelativeLayout ,because any view must be included by viewGroup. And the difference between "this" and "getApplicationContext()" as you mentioned at the beginning is: this == yourActivity.this ,it is activity's instance. However,getApplicationContext() will get Application's instance.

http://stackoverflow.com/comment/57359201
type: Comment
comment on: http://stackoverflow.com/a/23818196
score: 0
type: AnswerComment
has text: There is no need to use `list.stream().forEach(…)`. Not only `list.forEach(…)` is simpler, it’s also guaranteed to respect the element order whereas `list.stream().forEach(…)` is not (unlike `list.stream().forEachOrdered(…)`

http://stackoverflow.com/comment/36726136
type: QuestionComment
comment on: http://stackoverflow.com/q/23861345
score: 0
has text: `menupanel2.add(PlayButton, BorderLayout.NORTH); menupanel2.add(CustomButton, BorderLayout.NORTH)` Only one component can be added to each constraint of a `BorderLayout`.
type: Comment

http://stackoverflow.com/comment/36762757
has text: "I don't think that's what the problem is". Fine, what message is shown when you hover over them? Are you *absolutely* *certain* that those classes are in a jar on the project's Java Build Path?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23879500
score: 0

jpa
tags question: http://stackoverflow.com/q/23900976
tags question: http://stackoverflow.com/q/23797816
tags question: http://stackoverflow.com/q/23909344
tags question: http://stackoverflow.com/q/23833656
tags question: http://stackoverflow.com/q/23874814
tags question: http://stackoverflow.com/q/23858751
tags question: http://stackoverflow.com/q/23905202
tags question: http://stackoverflow.com/q/23830221
tags question: http://stackoverflow.com/q/23813779
tags question: http://stackoverflow.com/q/23905047
tags question: http://stackoverflow.com/q/23783248
tags question: http://stackoverflow.com/q/23840905
tags question: http://stackoverflow.com/q/23869829
tags question: http://stackoverflow.com/q/23827144
tags question: http://stackoverflow.com/q/23825060
tags question: http://stackoverflow.com/q/23824106
tags question: http://stackoverflow.com/q/23901494
tags question: http://stackoverflow.com/q/23819010
tags question: http://stackoverflow.com/q/23815897
tags question: http://stackoverflow.com/q/23912293
tags question: http://stackoverflow.com/q/23905831
tags question: http://stackoverflow.com/q/23798971
tags question: http://stackoverflow.com/q/23835442
tags question: http://stackoverflow.com/q/23805113
tags question: http://stackoverflow.com/q/23884620
tags question: http://stackoverflow.com/q/23925322
tags question: http://stackoverflow.com/q/23793610
tags question: http://stackoverflow.com/q/23851558
tags question: http://stackoverflow.com/q/23865883
tags question: http://stackoverflow.com/q/23940320
tags question: http://stackoverflow.com/q/23902514
tags question: http://stackoverflow.com/q/23905902
tags question: http://stackoverflow.com/q/23932684
type: Tag
tags question: http://stackoverflow.com/q/23878556
tags question: http://stackoverflow.com/q/23862969
tags question: http://stackoverflow.com/q/23795632
tags question: http://stackoverflow.com/q/23874002
tags question: http://stackoverflow.com/q/23904030
tags question: http://stackoverflow.com/q/23897367
tags question: http://stackoverflow.com/q/23839391
tags question: http://stackoverflow.com/q/23791838
tags question: http://stackoverflow.com/q/23878459
tags question: http://stackoverflow.com/q/23889455
tags question: http://stackoverflow.com/q/23893699
tags question: http://stackoverflow.com/q/23939108
tags question: http://stackoverflow.com/q/23917084
tags question: http://stackoverflow.com/q/23922894
tags question: http://stackoverflow.com/q/23928067
tags question: http://stackoverflow.com/q/23910154
tags question: http://stackoverflow.com/q/23911652
tags question: http://stackoverflow.com/q/23820492
tags question: http://stackoverflow.com/q/23925186
tags question: http://stackoverflow.com/q/23893345
tags question: http://stackoverflow.com/q/23920323
tags question: http://stackoverflow.com/q/23830080
tags question: http://stackoverflow.com/q/23782304
tags question: http://stackoverflow.com/q/23879444
tags question: http://stackoverflow.com/q/23871136
tags question: http://stackoverflow.com/q/23859391
tags question: http://stackoverflow.com/q/23923886
tags question: http://stackoverflow.com/q/23930151
tags question: http://stackoverflow.com/q/23903628
tags question: http://stackoverflow.com/q/23890861
tags question: http://stackoverflow.com/q/23877624
tags question: http://stackoverflow.com/q/23786120
tags question: http://stackoverflow.com/q/23938043
tags question: http://stackoverflow.com/q/23904429
tags question: http://stackoverflow.com/q/23901411
tags question: http://stackoverflow.com/q/23863401
tags question: http://stackoverflow.com/q/23823618
tags question: http://stackoverflow.com/q/23917771
tags question: http://stackoverflow.com/q/23867624
tags question: http://stackoverflow.com/q/23924544
tags question: http://stackoverflow.com/q/23782859
tags question: http://stackoverflow.com/q/23881319
tags question: http://stackoverflow.com/q/23842814
tags question: http://stackoverflow.com/q/23914149
tag name: jpa
tags question: http://stackoverflow.com/q/23910328

http://stackoverflow.com/comment/36736186
has text: okay. Also can you please tell me what does that 2121 mean in log cat?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23867087

http://stackoverflow.com/comment/36659899
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23823927
has text: [According to Hibernate docs](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch04.html#persistent-classes-pojo-identifier): "We recommend that you declare consistently-named identifier properties on persistent classes and that you use a nullable (i.e., non-primitive) type."

http://stackoverflow.com/comment/36709632
has text: Nowhere near enough information to tell accurately, but it's very likely that the terminal you're running under doesn't have the correct fonts and/or locale settings.
score: 1
comment on: http://stackoverflow.com/q/23852974
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23822652
accepted answer of: http://stackoverflow.com/q/23820776
answers question: http://stackoverflow.com/q/23820776
score: 0
type: AcceptedAnswer
type: Answer
has body: java.lang.ClassNotFoundException: com.danny.myfragmentactivity.MainActivity Your MainActivity is in package com.danny while your manifest file says it is in com.danny.myfragmentactivity. Make sure the manifest and code agree.

http://stackoverflow.com/q/23889852
type: Question
has comment: http://stackoverflow.com/comment/36785425
answer count: 1
has comment: http://stackoverflow.com/comment/36782413
has comment: http://stackoverflow.com/comment/36781393
has body: Entity A has a collection of some entities of type B. Type B is not aware (and should not be) of what type A is. I'd like to query for A which has at least one B with certain property. As for the mappings I use simple one-to-many and a join-column inside it at the A mapping side. Yet, when I do this using JPQL I cannot really use the JPA-generated column a_id since it's not a field of B - and therefore results in PropetyNotFound - jpa exception. Is there a method to use that column not having to define a property in the entity itself? Entity A mapping: <?xml version="1.0" encoding="UTF-8"?> com.example <generated-value strategy="AUTO" /> <basic name="identifier" /> <basic name="payload" /> <version name="version" /> <generated-value strategy="AUTO" /> <join-column name="a_id" referenced-column-name="seqid" /> <cascade-all /> Thanks!
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23918530
tagged with: jpa
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36806169
has comment: http://stackoverflow.com/comment/36780069
has title: JPQL one-to-many query
tagged with: sql
has comment: http://stackoverflow.com/comment/36815635
has comment: http://stackoverflow.com/comment/36781895

http://stackoverflow.com/q/23886205
favorite count: 0
has comment: http://stackoverflow.com/comment/36774374
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20484225
has title: How to convert doc to docx using Tika or POI?
has comment: http://stackoverflow.com/comment/36805877
has answer: http://stackoverflow.com/a/41501199
has comment: http://stackoverflow.com/comment/36939105
score: 2
tagged with: apache-poi
has body: How to convert a .doc file to .docx using apache Tika or with apache POI? I am stuck in converting the document to docx format.
tagged with: java
has comment: http://stackoverflow.com/comment/36933589
type: Question
tagged with: apache-tika
upvote count: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/70298295
has comment: http://stackoverflow.com/comment/36803122
tagged with: ms-word

http://stackoverflow.com/q/23908051
answer count: 0
tagged with: javascript
type: UnansweredQuestion
has title: Validations separation corresponding to their respective fields
type: Question
has comment: http://stackoverflow.com/comment/36814431
score: 0
tagged with: php
tagged with: java
has comment: http://stackoverflow.com/comment/36814496
has body: form: ----- New user? Create account Mobile No.* Email* Password* By clicking Create Account, you agree to our Terms & Conditions and that you have read our Privacy Policy Create Account au-register.php session_start(); include_once("../de@ler/sk-incd/sk-cond.php"); $i=$_SERVER['REMOTE_ADDR']; $date=date("y-m-d"); $message=array(); $query1=mysql_query("select * from tb_cst_lgns where cst_cnt='$_POST[mobile1]'"); if(isset($_POST['email1']) && !empty($_POST['email1'])){ $email1=mysql_real_escape_string($_POST['email1']); if(!filter_var($_POST['email1'], FILTER_VALIDATE_EMAIL)) { $message[]='not valid email address'; } }else{ $message[]='Please enter email'; } if(isset($_POST['password1']) && !empty($_POST['password1'])){ $password1=mysql_real_escape_string($_POST['password1']); }else{ $message[]='Please enter password'; } if(isset($_POST['mobile1']) && !empty($_POST['mobile1'])){ $mobile1=mysql_real_escape_string($_POST['mobile1']); if(!preg_match('/^\d{10}$/',$_POST['mobile1'])) { $message[]='not a valid number'; } }else{ $message[]='Please enter mobile'; } $countError=count($message); if($countError > 0){ for($i=0;$i<$countError;$i++){ echo ucwords($message[$i])." , "; } if(mysql_num_rows($query1)>0) { echo 'Phone number already registered'; } } else{ $query="select * from tb_cst_lgns where cst_email='$email1'"; $res=mysql_query($query); $checkUser=mysql_num_rows($res); if($checkUser > 0){ // $_SESSION['LOGIN_STATUS']=true; //$_SESSION['UNAME']=$uname; echo 'Email id is already exist'; }else{ mysql_query("insert into tb_cst_lgns values('','','','$email1','$password1','$mobile1','','','','','','','$i','$date','1')"); $_SESSION[au_user_session]=$email1; echo "correct"; } } Now my validations are showing in one line above the register area. but i want that each validation should be shown beside its respective field.How can i separate validations and place them corresponding to their respective fields.

http://stackoverflow.com/a/23828388
answers question: http://stackoverflow.com/q/23828277
score: 1
downvote count: 0
has body: One way is to have your class implement ActionListener. Then implement the actionPerformed() method. Here is an example: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Driver extends JFrame implements ActionListener { private static final long serialVersionUID = 3549094714969732803L; private JButton button = new JButton("Click"); public Driver(){ JPanel p = new JPanel(new GridLayout(3,4)); p.add(button); button.addActionListener(this); add(p); } public static void main(String[] args){ Driver frame = new Driver(); frame.setSize(500,200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { System.out.println("You clicked me!"); } }
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36883709
score: 0
type: QuestionComment
has text: @Patrick One of you should post the answer.
comment on: http://stackoverflow.com/q/23940400
type: Comment

http://stackoverflow.com/comment/36819085
score: 1
comment on: http://stackoverflow.com/q/23910665
has text: "whether i shall use break statement or i have to handle it with different way" Totally depends on your usecase. If you have little or no memory leak, running an infinte loop should be okay. But we cannot comment on whether the design is good or not unless we know the usecase.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36828422
type: QuestionComment
comment on: http://stackoverflow.com/q/23913968
has text: @IllegalArgument no luck placing it inside another relative layout
score: 0
type: Comment

http://stackoverflow.com/comment/36680228
type: Comment
has text: [Class.forName](http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html) is not longer supported? The documentation say something other.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23837784

http://stackoverflow.com/q/23855156
tagged with: weld
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23856762
accepted answer: http://stackoverflow.com/a/23856762
type: Question
tagged with: jakarta-ee
tagged with: codi
score: 4
answer count: 1
has comment: http://stackoverflow.com/comment/36714012
has comment: http://stackoverflow.com/comment/36713695
has title: Stereotype for @Inject possible?
favorite count: 0
tagged with: cdi
has body: I have a recurring annotation in my app that's injecting an object created by a CDI-producer. @Inject @FlatGeometryLive FlatGeometry geoObject; I wonder if it's possible to write a stereotype "@FlatGeometryLiveInject" so that i only have to write @FlatGeometryLiveInject FlatGeometry geoObject; and the object is injected. Is this possible with CDI 1.1 or any DI framework?
has comment: http://stackoverflow.com/comment/36713886

http://stackoverflow.com/comment/36604841
comment on: http://stackoverflow.com/q/23783943
type: QuestionComment
has text: 1. Figure out the encoding used in the file. For example, examine the byte values of those non-ASCII characters. 2. Use the same encoding when reading the file in your code.
type: Comment
score: 1

http://stackoverflow.com/comment/36629595
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23810620
has text: In your answer you are simply creating data source manually, but you are not using the pool. Pool does *much* more - it releases connections when they're not used, keeps a certain number open and so on. See DBCP [documentation](http://commons.apache.org/proper/commons-dbcp/configuration.html) for more details.
type: AnswerComment

http://stackoverflow.com/comment/36768731
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23883660
has text: oh yes ! it has blank entries as well

http://stackoverflow.com/comment/36669975
type: Comment
type: QuestionComment
has text: Then you will have to read it as the char[][] array to track line and column
comment on: http://stackoverflow.com/q/23832513
score: 0

http://stackoverflow.com/q/23905215
tagged with: progressdialog
has comment: http://stackoverflow.com/comment/36810446
favorite count: 0
has answer: http://stackoverflow.com/a/23905592
tagged with: android
has comment: http://stackoverflow.com/comment/36810237
has answer: http://stackoverflow.com/a/23906103
accepted answer: http://stackoverflow.com/a/23906103
has body: I am trying to start a ProgressDialog in the main thread but it won't show at all. The flow is such that I start ProgressDialog in main thread and then start a thread where some actions are performed. After the actions are complete ProgressDialog is dismissed. My code is as: Main class: final ProgressDialog ringProgressDialog = ProgressDialog.show(someclass.this, "Please wait ...", "Configuring...", true); ringProgressDialog.setCancelable(true); spinnerThread t = new spinnerThread(this, ringProgressDialog); t.start(); //Dialog won't show try { t.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Intent i = new Intent("org.CameraDemo"); //Activity won't start and the app itself closes i.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); finish(); Thread class: class spinnerThread extends Thread { ProgressDialog progress; someclass someobject; public spinnerThread(someclass someobject, ProgressDialog progress) { super(); this.someobject= someobject; this.progress = progress; } @Override public void run() { someobject.action1(); someobject.action2(); someobject.action3(); progress.dismiss(); } } Requesting downvoters to atleast mention the reason. As without reason one can't know whats missing in the question.
has comment: http://stackoverflow.com/comment/36809649
linked to: http://stackoverflow.com/q/3343490
tagged with: multithreading
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23905592
tagged with: java
has title: ProgressDialog won't display - multithreading
has comment: http://stackoverflow.com/comment/36810058
has comment: http://stackoverflow.com/comment/36809680
type: Question
score: 0
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36810363
downvote count: 1

http://stackoverflow.com/q/23878556
accepted answer: http://stackoverflow.com/a/23878890
score: 0
answer count: 2
tagged with: jpa
has body: Does Oracle TopLink not include the JPA classes? I am trying to create a JPA/TopLink project. I have downloaded the latest version of the TopLink jar (12c 12.1.2) and made sure to include it in the classpath. The problem is that I cannot seem to find any of the javax.persistence.* classes like Entity, Column etc. I though that all implementations of JPA such as TopLink, Hibernate etc would include those classes. Is that not true? How else should I get this JPA/Toplink project to work?
tagged with: toplink
has answer: http://stackoverflow.com/a/23879912
type: AnsweredQuestion
tagged with: java
type: Question
has title: TopLink - Where are the JPA classes
possible better answer: http://stackoverflow.com/a/23879912
has answer: http://stackoverflow.com/a/23878890

http://stackoverflow.com/comment/36847872
type: AnswerComment
score: 0
has text: I have now. You are editing faster than I can comment. Thank you for removing the broken cast.
type: Comment
comment on: http://stackoverflow.com/a/23925630

http://stackoverflow.com/q/23868330
has body: I'm using eclipse kepler to start a dynamic web project with hibernate and mysql. I've installed all plugins and I added all libs needed . And when I want to create a configuration file. I've configured the connection and I've tested it and the Ping succeeds. but the problem is that can't generate classes from my database. So I can't do a hibernate mapping. this is the error : [Classpath]: Could not parse configuration:E:\test\src\hibernate.cfg.xml
favorite count: 0
has comment: http://stackoverflow.com/comment/36739029
answer count: 0
type: UnansweredQuestion
has title: hibernate.cfg.xml error creation
upvote count: 1
has comment: http://stackoverflow.com/comment/36738634
linked to: http://stackoverflow.com/q/23605638
tagged with: java
tagged with: hibernate
tagged with: eclipse
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36738312
has comment: http://stackoverflow.com/comment/36738843
has comment: http://stackoverflow.com/comment/36739721
has comment: http://stackoverflow.com/comment/36738761
score: 1

http://stackoverflow.com/a/23935331
upvote count: 2
answers question: http://stackoverflow.com/q/23935303
has comment: http://stackoverflow.com/comment/36866703
has comment: http://stackoverflow.com/comment/36865856
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36866374
type: Answer
has body: It's not the @ that's the problem, it's the hyphen (-). Within a class ([]), the hyphen defines a range such as a-z. In your second instance, the range between _ and @ is of course invalid, hence the error. You can escape the hyphen to fix this if you need to: \\-.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36865945
accepted answer of: http://stackoverflow.com/q/23935303

http://stackoverflow.com/q/23895793
has title: Java Thread Return Value/Data from run function
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/141284
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36821986
tagged with: java
has comment: http://stackoverflow.com/comment/36807317
has comment: http://stackoverflow.com/comment/36979436
type: Question
has comment: http://stackoverflow.com/comment/36929635
score: -1
has comment: http://stackoverflow.com/comment/36793919
has answer: http://stackoverflow.com/a/23898125
has body: I have one doubt. IF we talk with respect to Java Multithreading, excluding concurrency framework, then how can we return a value from the run() method. I was asked this question in some interview and was asked how to do this without using callable or concurrency framework ie how to tell main thread that Thread1 has completed some execution(run() completed) and you can update the UI. EDIT: This is different from the question marked as duplicate, the current question asks about how will you design/code using runnable to return value. This is not possible as per the run() function but what is asked is how to achieve this behaviour via code for runnable so that main thread can be notified/updated? I suppose these are different questions. Please correct me if I am wrong.

http://stackoverflow.com/comment/36679346
comment on: http://stackoverflow.com/a/23837393
has text: @Bombolo add it in just below `mapView.getOverlays().add(myListOverlay);`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36571932
comment on: http://stackoverflow.com/q/23780472
has text: When the Package View is active it controls the Properties View and it would be very difficult to alter what is shown. Or do you mean the Properties dialog?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23929427
has title: OpenSSL FIPS 140-2 Compliance with Tomcat 5 or any version
tagged with: java
type: Question
downvote count: 0
tagged with: tomcat
tagged with: fips
tagged with: openssl
has body: I have my Struts application running in tomcat version 5.0. I want to add OpenSSL FIPS 140-2 support to this application. I know there are settings into the server.xml which allows OpenSSL https connection. But unable to find oit anything specific to OpenSSL FIPS 140-2 compliance. I have following questions, Is there anything related with Java? that is, do we need to make any settings into Java runtime environment to add a compliance for FIPS 140-2? Does, just doing the settings for OpenSSL in tomcat server.xml would make it compliant with OpenSSL FIPS 140-2? Is there anything else? Like upgrading tomcat to latest version which has support for OpenSSL FIPS 140-2, if yes any information related to same? I am pretty much new to OpenSSL and FIPS. Unable to find anything concrete related to Tomcat.
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: tomcat7
score: 2
has answer: http://stackoverflow.com/a/23930644

http://stackoverflow.com/a/23826507
answers question: http://stackoverflow.com/q/23826149
type: Answer
has comment: http://stackoverflow.com/comment/36666170
score: 2
has comment: http://stackoverflow.com/comment/36665187
has comment: http://stackoverflow.com/comment/36666316
upvote count: 2
has comment: http://stackoverflow.com/comment/36665882
has body: You will run into another problems ... but here is your number 1: Number ONE = new Number() { @Override public int intValue() { return 1; } @Override public long longValue() { return 1L; } @Override public float floatValue() { return 1.0f; } @Override public double doubleValue() { return 1.0; } @Override public byte byteValue() { return 1; } @Override public short shortValue() { return 1; } };
downvote count: 0

http://stackoverflow.com/q/23884755
type: UnansweredQuestion
tagged with: spring
tagged with: catalina
has title: org.apache.catalina.LifecycleException: Failed to start component
has comment: http://stackoverflow.com/comment/36769846
score: 0
tagged with: java
tagged with: eclipse
type: Question
has body: i am getting this error when starting my tomcat server with my application. I don't really understand it but if i "clean" in eclipse a few times or if i stop start the tomcat server a few times it somehow works, but then it happens over again if i stop. any ideas? WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:datalinx-backend' did not find a matching property. May 27, 2014 11:23:36 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\Applications\STS\vfabric-tc-server-developer- 2.9.2.RELEASE\base-instance\wtpwebapps\datalinx-backend\WEB-INF\lib\javax.el-api-2.2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class May 27, 2014 11:23:36 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\Applications\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\wtpwebapps\datalinx-backend\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class May 27, 2014 11:23:36 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\Applications\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\wtpwebapps\datalinx-backend\WEB-INF\lib\tomcat-embed-core-7.0.52.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class May 27, 2014 11:23:36 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\Applications\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\wtpwebapps\datalinx-backend\WEB-INF\lib\tomcat-embed-el-7.0.52.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class May 27, 2014 11:23:39 AM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start …
has answer: http://stackoverflow.com/a/23892680
linked to: http://stackoverflow.com/q/17584495
tagged with: tomcat
answer count: 1

http://stackoverflow.com/a/23798108
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/23796353
has body: So the issue, I discovered, was with native libraries. I was able to get the application to work by copying the .dll from the .jar file and referencing it, but more important, I'm going to rebuild the .java class file responsible for loading the library and add the System.loadLibrary(); call. When the JavaHidApi ClassPathLibraryLoader.loadNativeHIDLibrary(); method is called it doesn't load the library upon successfully writing it out to the temp file which is mildly annoying. Doing this will eliminate the necessity for manually loading the library from a static location... Thank you for pointing me in the correct direction.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23796353

http://stackoverflow.com/q/23870465
has comment: http://stackoverflow.com/comment/36742426
downvote count: 1
type: Question
has body: I'm trying to implement a simple encrypt/decrypt from the javax.crypto library but I'm stuck trying to call the method from an implementation of an AES class I have found on github https://gist.github.com/bricef/2436364. public class AES { static String IV = "AAAAAAAAAAAAAAAA"; public static byte[] encrypt(String plainText, String encryptionKey) throws Exception { //..code return cipher.doFinal(plainText.getBytes("UTF-8")); } } I am then trying to call the method from my main method in another class and assign its return value to a variable using an instance like so; AES aes = new AES(); byte[] encrypt = aes.encrypt(msg, key); I get unhandled exception type Exception. I have also tried it this way; byte[] encrypt = AES.encrypt(msg, key); How do I call this method and assign the return value to a variable which I can then use to do lots of other cool stuff? I know this question is simple but some explanation on how you do these types of calls/assignments in Java would be great.
has answer: http://stackoverflow.com/a/23870523
score: -1
has title: Java - Call static method of another class from main
tagged with: static-methods
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23870523
tagged with: encryption
tagged with: variable-assignment
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36742419
tagged with: java

http://stackoverflow.com/comment/36856274
type: QuestionComment
has text: moved the line and set <application-desc main-class=""> to ui.ui.java (don't know if this is correct, the main class is ui.java and inside package ui). Now I'm getting the "found unsigned entry in resource"
score: 0
comment on: http://stackoverflow.com/q/23908667
type: Comment

http://stackoverflow.com/comment/36838607
type: QuestionComment
has text: You can do the same thing in Python: `a = -8; b = a >> 1`. Now `b` is `-4`.
comment on: http://stackoverflow.com/q/23920431
score: 0
type: Comment

http://stackoverflow.com/comment/36697005
type: QuestionComment
comment on: http://stackoverflow.com/q/23846723
score: 4
has text: Logcat: `MainActivity.onCreate(MainActivity.java:46)` - MainActivity line 46, what is it? It might be `findViewById(R.id.button_frames)` because `button_frames` return null and cannot be found. I guess, but not sure, the layout posted is `fragment_main.xml`. If yes, [see this answer](http://stackoverflow.com/questions/23172934/android-setonclicklistener-not-working/23172981#23172981), it might help.
type: Comment

http://stackoverflow.com/a/23813238
upvote count: 1
answers question: http://stackoverflow.com/q/23812601
has body: [note: have not attempted to compile or run your code] If you want to simply have the JFC pop up without any other elements, you can pass null to the JFC.showOpenDialog(). Since you would be launching that without any other swing/awt elements, it would not be in an actionPerformed method. I would just use something like private static File getFile(){ JFileChooser fc = new JFileChooser(); File file = null; int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); } return file; } and call that from your main method.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/23872203
score: 10
upvote count: 10
answers question: http://stackoverflow.com/q/23870953
has comment: http://stackoverflow.com/comment/36753914
has comment: http://stackoverflow.com/comment/36749966
downvote count: 0
has comment: http://stackoverflow.com/comment/36756578
type: Answer
has body: If it implemented Comparable&lt;Temporal&gt;, every suclass instance would have to be comparable with any other subclass instance. And comparing an Instant with a LocalDate, for example, doesn't make sense. Given that the contract mandates that they are comparable, you can cast T to Comparable&lt;T&gt; and safely ignore the compiler warning.
has comment: http://stackoverflow.com/comment/36753847

http://stackoverflow.com/q/23858418
score: 0
tagged with: java
type: Question
tagged with: media-player
has answer: http://stackoverflow.com/a/23858914
tagged with: android
answer count: 1
has title: android Media Player stream more than 1 URL
has body: I'm using mediaPlayer in my Android application to stream an MP3 url from online. Instead of just playing the 1 url, how can I stream 5 urls to play one after the other? here's my code Uri myUri = Uri.parse("https://db.tt/9nBgouRf"); final MediaPlayer sdrPlayer = new MediaPlayer(); try { sdrPlayer.setDataSource(this, myUri); sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); sdrPlayer.prepare(); //don't use prepareAsync for mp3 playback } catch (IOException e) { e.printStackTrace(); Toast.makeText(channelx.this, "Please turn on WiFi and try again", Toast.LENGTH_LONG).show(); } play.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { sdrPlayer.start(); } } );
type: UnansweredQuestion
tagged with: stream

http://stackoverflow.com/comment/36771851
has text: I always use Bundle to pass data from activity to fragment.I have no idea that why it does not works without bundle.Also "Bundle savedInstanceState" saves the states of your activity i.e. suppose you want to pass some data onorientationchange from potrait to landscape.Then you can put the things you want to save in savedInstanceState and then you can retrieve your saved data from savedInstanceState through the method public void onRestoreInstanceState(Bundle savedInstanceState)
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23885653

http://stackoverflow.com/q/23871183
has answer: http://stackoverflow.com/a/23872256
has body: I would like to test the connection between a client and a server in a ScheduledExecutorService every x ms while processing received data from the distant host. So I did something like this: public class MyClass { private final ScheduledExecutorService _timer = Executors.newScheduledThreadPool(1); private Socket _connection; public void connectToDistantHost() { try { _connection = new Socket(); _connection.connect(_adresseServeur); new Thread(new Runnable() { @Override public void run() { try { //let another object know the connection is ok } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } catch (IOException e) { e.printStackTrace(); } _timer.scheduleAtFixedRate(new Runnable() { @Override public void run() { testConnection(); } }, 0, 200, TimeUnit.MILLISECONDS); } private void testConnection() { //would like to peek on the socket's inputstream to know if something's wrong } private void myProcessing() { while (true) { ... //read what's inside stream //process it in a thread } } } So, if I .read() on the Socket's inputstream it'll screw myProcessing(). I thought about wraping the inputstream in a BufferedReader and mark the buffer position before I read and then reset the position, but as the testing and the processing are in two differents thread it won't work anyway. How can I do that? Knowing that I did it in c# without much problem: class TraitementEnvoiClient { ... private void testConnection(Object obj, ElapsedEventArgs args) { _connectionIsOk = _connexionAuServeur.IsConnected(); if (!_connectionIsOk) { tryToReconnect(); } } } public static class ExtensionTcpClient { //Credit to ElFenix: http://social.msdn.microsoft.com/Forums/en-US/c857cad5-2eb6-4b6c-b0b5-7f4ce320c5cd/c-how-to-determine-if-a-tcpclient-has-been-disconnected?forum=netfxnetcom public static bool IsConnected(this TcpClient client) { // Detect if client disconnected try { if (client.Client.Poll(0, SelectMode.SelectRead)) { byte[] buff = new byte[1]; if (client.Client.Receive…
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36744545
tagged with: sockets
accepted answer: http://stackoverflow.com/a/23872256
upvote count: 1
has comment: http://stackoverflow.com/comment/36744569
has comment: http://stackoverflow.com/comment/36744877
answer count: 1
has comment: http://stackoverflow.com/comment/36745270
has title: Peek on a socket InputStream
tagged with: java
linked to: http://stackoverflow.com/q/23739088
has comment: http://stackoverflow.com/comment/36744975
downvote count: 0

http://stackoverflow.com/a/23838595
answers question: http://stackoverflow.com/q/23837424
has comment: http://stackoverflow.com/comment/36684522
upvote count: 1
has comment: http://stackoverflow.com/comment/36683685
score: 1
has body: If you update the JLabel texture by calling a method which changes it's state, it may or may not be updated immediately unless you call texture.repaint() or texture.paintAll(texture.getGraphics()), or some similar method. Also, I would look into using a LayoutManager for whatever upper level component you are using to hold your grid of JLabels. If you use a GridLayout of your game board and either: set the JLabel's preferred size with texture.setPreferredSize(Dimension) and call frame.pack() once when setting up your game; or set the JLabel's size with label.setSize(Dimension) once and don't pack your JFrame You will only need to set the size of the JLabel once, not every time you set a new ImageIcon to the label. Because, Ideally your game shouldn't be doing any extra work that it doesn't have to so it performs faster. I would also recommend maintaining every possible ImageIcon as static fields in your class, rather than accessing them from the file every time. That way, you read them once from a static initializing method, which then reach ship can directly access when changing the direction.
downvote count: 0
type: Answer

http://stackoverflow.com/q/23881949
has answer: http://stackoverflow.com/a/23884257
score: 0
answer count: 1
tagged with: couchdb
has body: I want to insert data in document in the following format: _id:"c0b3457b1d6e5f8431d62a31fd00073c" Name:"priya" Education: 10th:"68.9%" 12th:"62.83%" graduation:"69.73% post-graduation:"71.55%" i want this format through programming . new to couchdb.
has title: How to give subfield to a field of a document in couch db using java program?
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23884257

loadlibrary
tags question: http://stackoverflow.com/q/23856477
type: Tag
tag name: loadlibrary

http://stackoverflow.com/comment/36772177
score: 0
type: Comment
has text: We want to read artifact Id and version number of each JAR and store it in a map. We have a configuration framework in place where config settings can be made based on the deployed artifact and version. So at runtime we need to know the versions of the artifacts being deployed.
type: QuestionComment
comment on: http://stackoverflow.com/q/23866939

http://stackoverflow.com/comment/36668578
has text: Same issue Santoshsarma
type: Comment
comment on: http://stackoverflow.com/a/23831600
score: 0
type: AnswerComment

http://stackoverflow.com/q/23855199
has comment: http://stackoverflow.com/comment/36715515
has comment: http://stackoverflow.com/comment/39744090
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23855436
type: Question
has title: Working with Unicode file path
has answer: http://stackoverflow.com/a/23855436
has comment: http://stackoverflow.com/comment/36727824
answer count: 2
tagged with: file-io
upvote count: 1
has answer: http://stackoverflow.com/a/73047588
has body: In my copy of Windows, the path separator is not a backslash but a Korean Won currency sign, which is character U20A9 in Unicode. However, when my program searches for this character in a string representing a file path, it doesn't find it, even though it appears as expected when the path is printed. My program is registered with Explorer to appear in the right-click menu for files, so it receives the file path from Explorer as a command-line argument. What is going on here? How can I locate the path separators in the command-line argument?
tagged with: unicode
favorite count: 0
possible better answer: http://stackoverflow.com/a/73047588
has comment: http://stackoverflow.com/comment/36715347
tagged with: windows
has comment: http://stackoverflow.com/comment/36714596
has comment: http://stackoverflow.com/comment/36762620

http://stackoverflow.com/comment/36569981
has text: Java Home:C:\Program Files\Java\jdk1.7.0_51 Path:C:\Users\L335A01\Desktop\apache-maven-2.0.9\bin
comment on: http://stackoverflow.com/a/23779473
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36640370
type: QuestionComment
comment on: http://stackoverflow.com/q/23812921
score: 0
has text: Actually I would use `FileInputStream` and `read(byte[] b)`
type: Comment

http://stackoverflow.com/comment/36844099
score: 1
comment on: http://stackoverflow.com/q/23923438
type: Comment
type: QuestionComment
has text: Step through your code with a debugger, and the answer should be fairly clear. Probably an off-by-one error or similar.

http://stackoverflow.com/q/23906832
tagged with: functional-programming
downvote count: 0
answer count: 1
favorite count: 0
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
has answer: http://stackoverflow.com/a/23907086
tagged with: java
has title: Java 8 functional: How to compute a list of dependent evolutions of an object?
type: Question
accepted answer: http://stackoverflow.com/a/23907086
has body: I want to write the following code in a functional way with streams and lambdas: Thing thing = new Thing(); List&lt;Thing&gt; things = new ArrayList&lt;&gt;(); things.add(thing); for (int i = 0; i &lt; 100; i++) { thing = computeNextValue(thing); things.add(thing); } Something in the way of this... Supplier&lt;Thing&gt; initial = Thing::new; List&lt;Things&gt; things = IntStream.range(0, 100).???(...).collect(toList());
score: 4
upvote count: 4

http://stackoverflow.com/comment/36661047
has text: @RomanC I don't understand what you say with "indexed property names and make sure createIfNull is enabled". And I want to do textfields to Hashmap..
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23827599
type: Comment

http://stackoverflow.com/q/23873972
score: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23874043
type: UnansweredQuestion
tagged with: multithreading
tagged with: interruption
has body: I have a problem when working with thread in Java. What is the method preferred between interrupt() and stop() for interrupting a thread in Java? And why? Thanks for any responses.
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/23874044
has comment: http://stackoverflow.com/comment/36748730
type: Question
has title: Java Thread interruption: interrupt() vs stop()
upvote count: 2
answer count: 2
downvote count: 2

http://stackoverflow.com/q/23891952
type: AnsweredQuestion
tagged with: android-layout
has body: I have a relative layout with two views: &lt;RelativeLayout ...&gt; &lt;view android:id:""+@id/view1" android:layout_above:"+@id/view2" /&gt; &lt;view android:id:""+@id/view2" android:layout_alignParentBottom="true" /&gt; &lt;/RelativeLayout&gt; Is there consistent behavior when I set view2 Visibility to gone?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23892116
tagged with: layout
answer count: 1
accepted answer: http://stackoverflow.com/a/23892116
score: 0
has title: is there a consistent behavior when we set visibility gone on relative layout when another view is set above the gone view?
tagged with: android

http://stackoverflow.com/comment/36879665
score: 0
type: Comment
type: QuestionComment
has text: @GilbertLeBlanc Thanks for your input on this, though I had no idea how to implement such a design. Therefor I do some more research came up with a 'solution' myself, though I wonder if it can be considered as good code.
comment on: http://stackoverflow.com/q/23937050

http://stackoverflow.com/comment/36739350
has text: @Stultuske: It can throw an *unchecked* exception, yes.
comment on: http://stackoverflow.com/q/23868785
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23780376
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/23780586
has answer: http://stackoverflow.com/a/23781119
has body: The question is to design a structure for the employee/manager system. 1) An employee belongs to a manager. 2) A manager has several employees. 3) Manager may also belong to a manager. 4) Employee has only one manager Design the data structure so that it supports the following operation: delete an employee/manager, promotion(an employee becomes a manager). Any programming language would suffice. Note: I do not want code. Just the verbal explanation would be ok.
has answer: http://stackoverflow.com/a/23780948
answer count: 4
favorite count: 0
tagged with: c++
has title: Design data structure for Employee-Manager
has answer: http://stackoverflow.com/a/23780715
type: AnsweredQuestion
tagged with: c#
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/23780948
tagged with: java
has answer: http://stackoverflow.com/a/23780586

http://stackoverflow.com/comment/36654913
comment on: http://stackoverflow.com/a/23824394
has text: Sorry, I just thought you wanted to know about In query. I think for all the other params you need to change the method name and pass objects not id. I updated the answer. try that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36693577
type: QuestionComment
type: Comment
has text: @dasblinkenlight I mistyped the word, there's only one Knight, sorry for confusing
comment on: http://stackoverflow.com/q/23844874
score: 1

http://stackoverflow.com/comment/36740535
type: QuestionComment
comment on: http://stackoverflow.com/q/23869228
score: 0
has text: Do I really need to write a new zip file, if I need to read its txt file content only?
type: Comment

http://stackoverflow.com/a/24141908
answers question: http://stackoverflow.com/q/23905759
score: 0
has body: If the user login server is the same with the one that you want to retrieve information,you can use the sessionId as the token. 1.After authentication,server store userId in the session 2.Server use session_id() to get sessionId ,return it to android client 3.add ?PHPSESSID=sessionId param to the android client http request. 4.Server get userId from the session
type: Answer

http://stackoverflow.com/a/23902415
has comment: http://stackoverflow.com/comment/36804122
score: 2
has comment: http://stackoverflow.com/comment/36838563
answers question: http://stackoverflow.com/q/23900740
accepted answer of: http://stackoverflow.com/q/23900740
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36835126
upvote count: 2
type: Answer
has body: The error is : edittext = (EditText) findViewById(R.id.editText); because editText component is in fragment_main.xml , not the current activity's contentview activity_main.xml, so the value of variable edittext must be null, then the following code will cause error. please move the method addKeyListener() into PlaceholderFragment class, then it will be ok.

http://stackoverflow.com/q/23894725
accepted answer: http://stackoverflow.com/a/23898546
has comment: http://stackoverflow.com/comment/36790101
upvote count: 2
has comment: http://stackoverflow.com/comment/36789467
tagged with: multithreading
downvote count: 3
has comment: http://stackoverflow.com/comment/36790185
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36790106
has title: When to use Akka and when not to?
tagged with: java
has answer: http://stackoverflow.com/a/23898546
score: -1
type: Question
answer count: 2
tagged with: akka
has answer: http://stackoverflow.com/a/23895902
has body: I'm currently in the situation that I'm actually making things more complicated by using Actors then when I don't. I need to execute a lot of Http Requests without blocking the Main thread. Since this is concurrency and I wanted to try something different then locks, I decided to go with Akka. Now I'm in the situation that I'm doubting between two approaches. Approach one (Create new Actors when it's in need): public class Main { public void start() { ActorSystem system = ActorSystem.create(); // Create 5 Manager Actors (Currently the same Actor for all but this is different in actual practise) ActorRef managers = system.actorOf(new BroadcastPool(5).props(Props.create(Actor.class))); managers.tell(new Message(), ActorRef.noSender()); } } public class Actor extends UntypedActor { @Override public void onReceive(Object message) throws Exception { if (message instanceof Message) { ActorRef ref = getContext().actorOf(new SmallestMailboxPool(10).props(Props.create(Actor.class))); // Repeat the below 10 times ref.tell(new Message2(), getSelf()); } else if (message instanceof Message2) { // Execute long running Http Request } } } public final class Message { public Message() { } } public final class Message2 { public Message2() { } } Approach two (Create a whole lot of actors before hand and hope it's enough): public class Main { public void start() { ActorSystem system = ActorSystem.create(); ActorRef actors = system.actorOf(new SmallestMailboxPool(100).props(Props.create(Actor.class))); ActorRef managers = system.actorOf(new BroadcastPool(5).props(Props.create(() -&gt; new Manager(actors)))); managers.tell(new Message(), ActorRef.noSender()); } } public class Manager extends UntypedActor { private ActorRef actors; public Manager(ActorRef actors) { this.actors = actors; } @Override public void onReceive(Object message) throws Exception { if (message instanceof Message) { // Repeat 10 times actors.tell(new Message2(), getSelf()); } } } public class Actor extends UntypedAct…
has comment: http://stackoverflow.com/comment/36789388
favorite count: 0
possible better answer: http://stackoverflow.com/a/23895902

http://stackoverflow.com/q/23790192
tagged with: uml
tagged with: umlgraph
has answer: http://stackoverflow.com/a/24000453
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36982410
type: Question
accepted answer: http://stackoverflow.com/a/24000453
has title: UmlGraphDoc Errors running Graphviz on
has comment: http://stackoverflow.com/comment/36968201
has body: I try to useUmlGraphDoc, however, every time I run the javadoc command, I get a weird error: [javadoc] javadoc: warning - Errors running Graphviz on /private/tmp/test/docs/Class1.dot [javadoc] Building Context view for class Fail [javadoc] javadoc: warning - Errors running Graphviz on /private/tmp/test/docs/Class2.dot My code looks like that: import externalPackage.TestClass; public abstract class Class1 { private TestClass myFail; public boolean doSomething(TestClass fail) { return true; } } public class Class2 extends Class1 { @Override public boolean doSomething(TestClass fail) { fail.toString(); return false; } } build.xml <include name="**/*.jar" /> <filename name="**/*.java" /> I'm using Mac OS X Lion and Mavericks. The dot version on my mavericks computer is dot - graphviz version 2.38.0. It is the newest binary package to download. Here is zip file containing all classes (and libs) I used to generate this error. When you run the ANT script, an error like the on above will be generated. The docs look fine (even the UML diagrams), however, on my bigger project (where I got the error in the first place), some of the diagrams that generated the errors, don't work These errors only occur when: TestClass is in an external package (a jar containing the class is defined in classpath. javac works perfectly). doSomething is overwritten the private var myFail is set. If the myFail is removed, or doSomething isn't overwritten (e.g. it isn't defined in Class1 or Class2), or TestClass is in the same package, no errors will occur.
tagged with: dot
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36969969
tagged with: java

matrix
tags question: http://stackoverflow.com/q/23851063
tag name: matrix
tags question: http://stackoverflow.com/q/23860569
tags question: http://stackoverflow.com/q/23916157
tags question: http://stackoverflow.com/q/23939770
tags question: http://stackoverflow.com/q/23913865
tags question: http://stackoverflow.com/q/23798274
tags question: http://stackoverflow.com/q/23936605
type: Tag
tags question: http://stackoverflow.com/q/23846754
tags question: http://stackoverflow.com/q/23848438

http://stackoverflow.com/q/23897599
has body: I have a problem trying to execute more than one query into my Java Application code. I have a procedure that is called in main and is in the class "Fant": public void XXX(){ Connectivity con=new Connectivity(); // this class set up the data for the connection to db; if ( !con.connect() ) { System.out.println("Error during connection."); System.out.println( con.getError() ); System.exit(0); } ArrayList&lt;User&gt; blabla=new ArrayList&lt;User&gt;(); blabla=this.getAllUsers(con); for (User u:blabla) { try { Connectivity coni=new Connectivity();//start a new connection each time that i perform a query Statement t; t = coni.getDb().createStatement(); String query = "Select count(*) as rowcount from berebe.baraba"; ResultSet rs = t.executeQuery(query); int numPrenotazioni=rs.getInt("rowcount"); rs.close(); //close resultset t.close(); //close statement coni.getDb().close(); //close connection } } catch (SQLException e) { System.err.println("SQLState: " + ((SQLException)e).getSQLState()); System.err.println("Error Code: " + ((SQLException)e).getErrorCode()); } } } The called function is defined as: ArrayList&lt;User&gt; getAllUsers(Connectivity con) { try{ ArrayList&lt;User&gt; userArrayList=new ArrayList&lt;User&gt;(); String query = "Select idUser,bubu,lala,sisi,gogo,gg from berebe.sasasa"; Statement t; t = con.getDb().createStatement(); ResultSet rs = t.executeQuery(query); while (rs.next()) { User utente=new User(....); //user fields got from query userArrayList.add(utente); } rs.close(); t.close(); con.disconnect(); //disconnect the connection return userArrayList; } catch (SQLException e) { } return null; } The main is: public static void main(String[] argv) { ArrayList&lt;User&gt; users=new ArrayList&lt;User&gt;(); System.out.println("-------- MySQL JDBC Connection Testing ------------"); Fant style = new Fant(); style.XXX(); } The query performed into "getAllusers" is executed and into the arraylist "blabla" there are several users; the problem is that the second…
tagged with: sql
answer count: 1
favorite count: 0
tagged with: jdbc
score: 2
type: AnsweredQuestion
tagged with: database-connection
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/22999830
has title: Error S1000 trying to execute more MySql queries in a Java Application
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23897629
accepted answer: http://stackoverflow.com/a/23897629
has comment: http://stackoverflow.com/comment/36796941
upvote count: 2

http://stackoverflow.com/q/23825373
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/49534072
has title: Close a dynamically created Log4j 2 appender
tagged with: log4j2
tagged with: logging
type: Question
accepted answer: http://stackoverflow.com/a/23827382
tagged with: java
has body: I'm using the Routing functionality in Log4j 2 to dynamically create appenders at runtime. When I know that those appenders are finished with, I'd like to tell Log4j so that it can tidy up the related resources (flush & close files, free its internal objects related to those appenders, etc.). Without doing this, Log4j still has open file handles and I'm unable to manipulate the files that it has written (from an external process which post-processes and archives the logs). How do I tell Log4j that an appender won't be used again? I include my Log4j configuration for completeness. <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} %level{ERROR=!, WARN=?, INFO=-, DEBUG=., TRACE=.} %msg%n"/> <PatternLayout pattern="%d{ISO8601} %-5level %-30.30logger{1} %msg%n"/> <AppenderRef ref="MatchLogs" level="debug"/> <AppenderRef ref="Console" level = "info"/> <PatternLayout pattern="%msg"/> <AppenderRef ref="MatchStatsLogs" level="debug"/> <AppenderRef ref="AsyncStatsWrapper"/> <AppenderRef ref="AsyncWrapper"/> When a match starts, I call ThreadContext.put("matchID", theMatchID); from each thread that is involved in that match. When a match finishes, I clear the ThreadContext. Obviously that isn't sufficient for Log4j to know that I'm not going to re-use that match ID, so it keeps the Appender around. However, I know that I'm not going to re-use the match ID, so how do I tell Log4j to tidy up?
upvote count: 4
answer count: 1
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/23827382
favorite count: 0

http://stackoverflow.com/a/23926860
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23926833
type: Answer
answers question: http://stackoverflow.com/q/23926833
score: 1
upvote count: 1
has body: To visble the view again use View.Visible as setVisibility(View.VISIBLE); But you want to blank form details after submitting the form then set editText as editText.setText(""); And also take radiobutton,checkbox etc. to its initial state
type: AcceptedAnswer

http://stackoverflow.com/q/23827960
has comment: http://stackoverflow.com/comment/36661866
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36735208
has comment: http://stackoverflow.com/comment/36728457
answer count: 0
has comment: http://stackoverflow.com/comment/36661693
has comment: http://stackoverflow.com/comment/36661657
tagged with: java
has comment: http://stackoverflow.com/comment/36689162
has comment: http://stackoverflow.com/comment/36690236
has comment: http://stackoverflow.com/comment/36664175
tagged with: startup
type: Question
has comment: http://stackoverflow.com/comment/36734882
has comment: http://stackoverflow.com/comment/36728558
has comment: http://stackoverflow.com/comment/36741333
tagged with: startupscript
has comment: http://stackoverflow.com/comment/36686889
has comment: http://stackoverflow.com/comment/36741024
has comment: http://stackoverflow.com/comment/36694541
tagged with: jar
has comment: http://stackoverflow.com/comment/36735892
has title: Run jar at linux startup from java
has comment: http://stackoverflow.com/comment/36732567
score: 0
has body: I want to run a jar file at startup. So i referred here. I ran the steps manually as indicated by Magpie, i e., using autostart and it worked without problem. But I tried the same in java, i e., from creating script to copying the file to /etc/xdg/autostart. All the files are created safely and there is no exception or error. But my jar file doesn't run on startup. The script contents are as follows: #!/bin/bash ### BEGIN INIT INFO # Provides: testscript.sh # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO java -jar /home/user/Documents/Parthe/StartupTest/Start.jar The contents of .desktop file is as follows: [Desktop Entry] Name=test Exec=/usr/bin/testscript.sh Type=Application Terminal=false The java program I used to create these files is as follows: private void writeScript() { File f = new File("/usr/bin/testscript.sh"); if (!(f.exists())) { try { f.createNewFile(); BufferedWriter bw = new BufferedWriter(new FileWriter(f, true)); bw.write("#!/bin/bash"); bw.newLine(); bw.newLine(); bw.append("### BEGIN INIT INFO"); bw.newLine(); bw.append("# Provides: testScript"); bw.newLine(); bw.append("# Required-Start: $remote_fs $syslog"); bw.newLine(); bw.append("# Required-Stop: $remote_fs $syslog"); bw.newLine(); bw.append("# Default-Start: 2 3 4 5"); bw.newLine(); bw.append("# Default-Stop: 0 1 6"); bw.newLine(); bw.append("# Short-Description: Start daemon at boot time"); bw.newLine(); bw.append("# Description: Enable service provided by daemon."); bw.newLine(); bw.append("### END INIT INFO"); bw.newLine(); bw.newLine(); bw.append("java -jar /home/user/Documents/Parthe/StartupTest/Start.jar"); bw.newLine(); bw.flush(); bw.close(); } catch (IOException ex) { Logger.getLogger(TestStartup.class.getName()) .log(Level.SEVERE, null, ex); } } writeDesktopFile(); } private void writeDesktopFil…
has comment: http://stackoverflow.com/comment/36686864
has comment: http://stackoverflow.com/comment/36732068
has comment: http://stackoverflow.com/comment/36661908
has comment: http://stackoverflow.com/comment/36732616
tagged with: linux
has comment: http://stackoverflow.com/comment/36732160
has comment: http://stackoverflow.com/comment/36729223

http://stackoverflow.com/comment/36633968
score: 0
has text: Can people please stop making edits that replace the code that causes the error with working code..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813352

http://stackoverflow.com/comment/36649273
comment on: http://stackoverflow.com/q/23816019
has text: I'll see what happens when I try that. Now the.other problem is that I'd like to give it linebreaks in the input, but the return key does nothing when typing in the input field. How do I solve this?
score: 0
type: Comment
type: QuestionComment

jakarta-ee
tags question: http://stackoverflow.com/q/23907202
tags question: http://stackoverflow.com/q/23877236
tags question: http://stackoverflow.com/q/23886919
tags question: http://stackoverflow.com/q/23882004
tags question: http://stackoverflow.com/q/23884169
tags question: http://stackoverflow.com/q/23902895
tags question: http://stackoverflow.com/q/23826116
tags question: http://stackoverflow.com/q/23815933
type: Tag
tags question: http://stackoverflow.com/q/23869755
tags question: http://stackoverflow.com/q/23918201
tags question: http://stackoverflow.com/q/23855156
tags question: http://stackoverflow.com/q/23802510
tags question: http://stackoverflow.com/q/23840478
tags question: http://stackoverflow.com/q/23925680
tags question: http://stackoverflow.com/q/23815963
tags question: http://stackoverflow.com/q/23878459
tags question: http://stackoverflow.com/q/23824633
tags question: http://stackoverflow.com/q/23880254
tags question: http://stackoverflow.com/q/23901070
tags question: http://stackoverflow.com/q/23931645
tags question: http://stackoverflow.com/q/23806272
tags question: http://stackoverflow.com/q/23874238
tags question: http://stackoverflow.com/q/23927901
tags question: http://stackoverflow.com/q/23892835
tags question: http://stackoverflow.com/q/23801950
tags question: http://stackoverflow.com/q/23901411
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/23859080
tags question: http://stackoverflow.com/q/23871679
tags question: http://stackoverflow.com/q/23924544
tags question: http://stackoverflow.com/q/23930042
tags question: http://stackoverflow.com/q/23791195
tags question: http://stackoverflow.com/q/23818242
tags question: http://stackoverflow.com/q/23899406
tags question: http://stackoverflow.com/q/23866172
tags question: http://stackoverflow.com/q/23910328
tags question: http://stackoverflow.com/q/23796368
tags question: http://stackoverflow.com/q/23934953
tags question: http://stackoverflow.com/q/23835508
tags question: http://stackoverflow.com/q/23843850
tags question: http://stackoverflow.com/q/23831228
tags question: http://stackoverflow.com/q/23887023
tags question: http://stackoverflow.com/q/23890306
tags question: http://stackoverflow.com/q/23851328
tags question: http://stackoverflow.com/q/23907526
tags question: http://stackoverflow.com/q/23924649
tags question: http://stackoverflow.com/q/23796268
tags question: http://stackoverflow.com/q/23918610
tags question: http://stackoverflow.com/q/23854257
tags question: http://stackoverflow.com/q/23866841
tags question: http://stackoverflow.com/q/23873782
tags question: http://stackoverflow.com/q/23800241
tags question: http://stackoverflow.com/q/23887323
tags question: http://stackoverflow.com/q/23797816
tags question: http://stackoverflow.com/q/23874916
tags question: http://stackoverflow.com/q/23879015
tags question: http://stackoverflow.com/q/23813779
tags question: http://stackoverflow.com/q/23911202
tags question: http://stackoverflow.com/q/23813669
tags question: http://stackoverflow.com/q/23856207
tags question: http://stackoverflow.com/q/23812642
tags question: http://stackoverflow.com/q/23877391
tags question: http://stackoverflow.com/q/23919927
tags question: http://stackoverflow.com/q/23903939
tags question: http://stackoverflow.com/q/23851301

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

http://stackoverflow.com/a/23826077
answers question: http://stackoverflow.com/q/23824731
upvote count: 1
score: 1
type: AcceptedAnswer
has body: Try this tabpanel.setActiveWidget(tabPanel.getWidget(index)); This uses the index of the items, added to it. You can write your own method that returns the particular Widget (returned by initMyModelView()).
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23824731

http://stackoverflow.com/comment/36623928
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23807012
has text: @Absurd-Mind, this is definitely what I will do in the future

google-play-services
tags question: http://stackoverflow.com/q/23905759
tags question: http://stackoverflow.com/q/23882223
tags question: http://stackoverflow.com/q/23822069
tag name: google-play-services
tags question: http://stackoverflow.com/q/23841976
tags question: http://stackoverflow.com/q/23848014
tags question: http://stackoverflow.com/q/23894579
type: Tag
tags question: http://stackoverflow.com/q/23849001
tags question: http://stackoverflow.com/q/23848670

http://stackoverflow.com/a/26244665
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23851035
accepted answer of: http://stackoverflow.com/q/23851035
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/87786392
has comment: http://stackoverflow.com/comment/53936071
has body: Commons IO 2.0 and above do have copyInputStreamToFile(InputStream source, File destination), so you can use ProgressMonitorInputStream.
upvote count: 4

http://stackoverflow.com/comment/36728466
type: AnswerComment
comment on: http://stackoverflow.com/a/23860610
type: Comment
has text: What happens if the server throws an exception isn't specified, but it would mostly be your own `HttpHandler` that did that, and it's if you throw an `IOException` from that it will certainly terminate the associated conversation and possibly the thread that's handling the connection. If the `HttpServer` itself throws an exception during construction it's something like a bind error where it couldn't even get started.
score: 0

http://stackoverflow.com/q/23783766
score: 1
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/36667423
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36662300
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25623722
has comment: http://stackoverflow.com/comment/36661502
accepted answer: http://stackoverflow.com/a/25623722
answer count: 3
has comment: http://stackoverflow.com/comment/36667363
possible better answer: http://stackoverflow.com/a/24079076
tagged with: firefox
has title: using selenium for getting page source, how to use my code on server which doesnot have firefox?
downvote count: 0
has answer: http://stackoverflow.com/a/24079076
has comment: http://stackoverflow.com/comment/36577898
favorite count: 0
has answer: http://stackoverflow.com/a/24058727
has body: When I use selenium for getting the page source, it will use the selenium server through the system Firefox. How can I load my code on the server when it doesn't have Firefox? Web-driver driver = new Firefox-driver(); driver.navigate().to(url); String st = driver.getPageSource(); driver.close();

http://stackoverflow.com/a/23799565
answers question: http://stackoverflow.com/q/23799441
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23799441
type: Answer
has body: You've a lot of extra code which are totally not required. Remove the inner for loop and the if statement which compares the ith and jth elements of the list. The containsKey() method is enough to check if the number is already present in the Map. The if(intList.get(i) == intList.get(j)) { is just an overkill which is making your logic go for a toss. for (int i = 0; i &lt; intList.size(); i++) { if (ctMap.containsKey(intList.get(i))) { ctMap.put(intList.get(i), ctMap.get(intList.get(i)) + 1); } else { ctMap.put(intList.get(i), 1); } } Output when using the above snippet: Duplicate elements in the List: 1 occurs 3 times 2 occurs 2 times 3 occurs 1 times 4 occurs 2 times
score: 1
upvote count: 1

http://stackoverflow.com/comment/46590472
type: Comment
comment on: http://stackoverflow.com/a/23809249
type: AnswerComment
has text: The entrySet is a view; changes to it are reflected in the map and vice versa; it has no independent existence.
score: 20

http://stackoverflow.com/a/25036952
score: 5
upvote count: 5
downvote count: 0
has body: I think that a better solution was to add the @Modifying annotation to your method. See more on the following Answer : Spring Data JPA delete native query throwing exception
type: Answer
answers question: http://stackoverflow.com/q/23889455

http://stackoverflow.com/q/23837638
score: 2
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23839748
favorite count: 0
tagged with: jgrapht
upvote count: 2
tagged with: java
has body: I have a graph SimpleWeightedGraph&lt;Vertex, DefaultWeightedEdge&gt; g where Vertex is a custom class. I have all the vertexes and the edges in a postgresql spatial db. I need to load only a subset of them, to find a path from two vertexes, so I use some queries. The Vertex class has a String as identifier and other parameters that I load from the db. I need them later. I first load all the needed vertexes with some queries. In a second time I add the edges (with other queries) but I need to refer to the vertexes that are already in the graph. Now the question: how can I make this? Here are some extracts of my code. The Vertex class: (I want the Vertex are equals if they have the same id, and they are ordered with the same natural order of the Strings, by their id. I want it's also possible do vertex.equals("something")) public class Vertex implements Comparable&lt;Vertex&gt;{ private String id; //identifier private double x; //x in SRID 900913 private double y; //y in SRID 900913 private String geom; //geome in EWKT private int a; private int p; public Vertex(String id, double x, double y){ [...constructor body...] } public Vertex(String id, Vertex v){ [...constructor body...] } public Vertex(String id, double x, double y, int a, int p){ [...constructor body...] } public Vertice(String id){ this.id = id; } @Override public boolean equals(Object obj){ boolean result; if (obj == this) { return true; } if (obj == null) { return false; } if (obj.getClass() != String.class) { if (obj.getClass() != this.getClass()) { return false; } Vertex v = (Vertex) obj; result = this.id.equals(v.getId()); } else { String s = (String) obj; result = this.id.equals(s); } return result; } @Override public int hashCode(){ final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public String toString(){ return this.id; } public int compareTo(Vertex v){ return this.id.compareTo(v.getId()); } [...other methods...] } Extr…
has answer: http://stackoverflow.com/a/23839748
has title: How to refer to custom Vertexes to add an Edge, using JGraphT
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23846458
tagged with: transactions
tagged with: java
tagged with: jdbi
has body: In spring, we have @Transactional annotation which can be specified at Controller, so everything happens inside a controller method is treated as one transaction. However in dropwizard, we can have transaction at a DAO level by implementing Transactional&lt;DAOclass&gt;. But if I use two DAOs in a single resource method, it is treated as two different transactions. Say I have two DAOs Dao1.java public abstract class Dao1 implements Transactional&lt;Dao1&gt;{ @sqlQuery(//somequery) public abstract void insertIntoArticles(); } Dao2.java public abstract class Dao2 implements Transactional&lt;Dao2&gt;{ @sqlQuery(//somequery) public abstract void insertIntoArticlesChildren(); } ArticleResource.java @POST @PATH("/articles") public void insertArticleAndItsChildren(Integer articleId){ try{ dao1.begin(); dao2.begin(); dao1.insertIntoArticles(); dao2.insertIntoArticlesChildren(); dao1.commit(); dao2.commit(); }catch(Exception e){ dao1.rollback(); dao2.rollback(); } } In the above example, dao1 and dao2 have two different transactions. But I need everthing under a single transaction So is there any way of specifying transactional boundaries at Resource level?
type: Question
downvote count: 0
has title: How do we force Resource(controller) level transaction in Dropwizard with jdbi?
tagged with: dao
accepted answer: http://stackoverflow.com/a/23859731
tagged with: dropwizard
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23859731
score: 6
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/36828669
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23912903
has text: And line 59 on `ListParseAdapter` is the `SimpleAdapter` line?

document-view
type: Tag
tag name: document-view
tags question: http://stackoverflow.com/q/23858373

http://stackoverflow.com/q/23880008
has title: How do I sort a java text file so that I can obtain the median?
has comment: http://stackoverflow.com/comment/36760796
score: 1
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36760815
has answer: http://stackoverflow.com/a/23880152
answer count: 1
favorite count: 0
has body: I have the code below so far. I know the median is wrong because I've placed numbers in it and what I really want is for the program to extract these from the file on its own since the numbers may change. I am not sure how to have the program get the 2 numbers in order to retrieve and calculate the median. Please help. I am very new to this and it has taken me all day to get this far! package trials; import java.util.Scanner; import java.io.IOException; import java.io.File; public class trials2 { public static void main(String[] args) throws IOException { // This is a Scanner object that reads from the keyboard Scanner in = new Scanner(System.in); // The following is set to find the file System.out.println("Please enter the name of your data file: "); String fileName = in.next(); // The file is then to be scanned Scanner fileToRead = new Scanner(new File(fileName)); // This loop finds the contents within the file double sum = 0; int numStudents = 0; double maxVal = 0, minVal = 0; boolean bFirstTime = true; double currVal; while (fileToRead.hasNext()) { if (fileToRead.hasNextDouble()) { numStudents++; currVal = fileToRead.nextDouble(); // The following will find the maximum and minimum values within the file if (bFirstTime) { maxVal = currVal; minVal = currVal; bFirstTime = false; } else { maxVal = Math.max(maxVal,currVal); minVal = Math.min(minVal, currVal); } sum += currVal; } else { fileToRead.next(); } } // Prints out comments and results System.out.println("***Welcome to the Exam Statistics Program!!***"); System.out.println(); System.out.println("Minimum = " + minVal); System.out.println("Maximum = " + maxVal); System.out.println("Average score: " + sum/numStudents); System.out.println(); System.out.println("Number of scores by letter grade: "); System.out.println(); System.out.println("There are " + numStudents + " scores"); } }
tagged with: median
downvote count: 1
type: UnansweredQuestion
tagged with: file

http://stackoverflow.com/comment/36589711
score: 1
comment on: http://stackoverflow.com/q/23790173
has text: What exactly is happening in `//Do Something?` If you tell us this, we can give more specific advice.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/44199471
downvote count: 1
answers question: http://stackoverflow.com/q/23828085
score: -1
has body: In recent versions of Android Studio File -> Invalidate Caches / Restart is worth trying.
upvote count: 0
type: Answer

http://stackoverflow.com/comment/36806929
score: 0
type: Comment
type: QuestionComment
has text: A page containing dynamic content. Say for example 9gag.com whose content keep loading dynamically.
comment on: http://stackoverflow.com/q/23903873

http://stackoverflow.com/q/23873956
answer count: 2
tagged with: bash
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: linux
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2514439
tagged with: windows
has comment: http://stackoverflow.com/comment/36748684
has answer: http://stackoverflow.com/a/47290119
has comment: http://stackoverflow.com/comment/36748773
tagged with: java
has title: how execute linux command using java on windows?
type: Question
has answer: http://stackoverflow.com/a/23874096
has body: I need execute bash commands on a separate Linux machine using java on Windows. I need run executable file from specified directory, like cd /home/bin How can I do this?
has comment: http://stackoverflow.com/comment/36748593
has comment: http://stackoverflow.com/comment/36748657
linked to: http://stackoverflow.com/q/995944
score: 0

http://stackoverflow.com/q/23901008
answer count: 2
accepted answer: http://stackoverflow.com/a/23901456
tagged with: deep-copy
has answer: http://stackoverflow.com/a/23901456
has comment: http://stackoverflow.com/comment/36801566
possible better answer: http://stackoverflow.com/a/23901088
type: AnsweredQuestion
has title: How to decide whether to use deep copy in Java?
has answer: http://stackoverflow.com/a/23901088
tagged with: java
has body: I'm new to Java, and get really confused about deep copy. I think each method that takes some mutable objects as arguments and returns an object that is related to the input should make defensive copy. However, after some coding I find this is very tricky. For example, I want to choose some objects from a container satisfying some conditions, and returns them as a smaller container: List&lt;SomeType&gt; chooseWithSomeCondition(List&lt;SomeType&gt; input) But SomeType is defined by others, which is not immutable, not clonable, not serializable, neither has any copy constructor. Since Java's final cannot help either, I don't know how to make deep copy here. Is my criteria too strict? Is the code I've read problematic? Are there some other ways to make deep copy? Please share your thoughts, and thanks in advance.
type: Question
score: 0

http://stackoverflow.com/a/23793676
answers question: http://stackoverflow.com/q/23790333
has comment: http://stackoverflow.com/comment/36635077
score: 0
has body: This seems to be a bug, caused by the on-the-fly creation of the internal token for the "name" of the property. Can you try to use that property name before so that the token gets created before? Just tried it, if you do @Test public void test() { GraphDatabaseService graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node referenceNode = null; try (Transaction transaction = graphDb.beginTx()) { referenceNode = graphDb.createNode(); // use the "foo" property-name once before referenceNode.setProperty("foo", "bar"); transaction.success(); } VersioningTransactionEventHandler versioningTransactionEventHandler = new VersioningTransactionEventHandler(referenceNode); graphDb.registerTransactionEventHandler(versioningTransactionEventHandler); try (Transaction tx = graphDb.beginTx()) { Node node = graphDb.createNode(); tx.success(); } graphDb.shutdown(); }
type: Answer

http://stackoverflow.com/a/23921381
has comment: http://stackoverflow.com/comment/36861485
accepted answer of: http://stackoverflow.com/q/23920284
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23920284
type: Answer
has comment: http://stackoverflow.com/comment/36867088
has body: Change your handleRequest method to return existing form/model object if error occurred during validation. When you return new ModelAndView, its clearing the errors and as such you don't see them in view. Try with RedirectView to redirect to same view without loss of errors bound to your form/model as: protected ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { EJournalForm form = (EJournalForm) command; form.setUser(getUser()); form.load(request, false); HttpSession session = request.getSession(false); session.setAttribute(LBIBOConstants.SESSION_VAR_TAB_ALERT_MSG, null); if(errors.hasErrors()){ return new ModelAndView(new RedirectView(getFormView())); }else{ return new ModelAndView("anotherView", "commandName", form); } } From Spring 3+, getFormView() and getCommandName() are deprecated.
upvote count: 1
has comment: http://stackoverflow.com/comment/36868118
score: 1

http://stackoverflow.com/q/23822064
has answer: http://stackoverflow.com/a/23823209
has answer: http://stackoverflow.com/a/23823013
tagged with: signalr
type: Question
has answer: http://stackoverflow.com/a/23828641
tagged with: android-arrayadapter
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/23822243
has title: ListView not getting refreshed automatically, no matter whatever i try
type: UnansweredQuestion
tagged with: android
has body: I know that this has been asked many time and even I have solved this kinda problem many time but somehow I am so struck at this point that I can't make it work anyway I try doing it. Can you guys please look in to this I am creating a Chat App in Android and .NET using SignalR framework, and I have been successful in achieving this at model level in Android but things are going weird with the view. - SignalR Server is C# based console App here. - SignalR Client is Android based. Components: Message_Activity: has_Method_To_Send_Message_To_SignalR_Server() static_Method_To_Render_The_Message_Received_From_Custom_Api_Class() Custom_Api_Class (Non Activity): method_invoked_From_SignalR_Server_To_Pass_Message_&amp;_Then_Pass_To_Message_Rendering_Method_In_Message_Activity() The Flow: - Message is sent from Message_Activity to the Console C# SignalR server over the network. - Server send this message to the destined client, by invoking the remote call to the method present in the Custom_Api_Class. - Then this method pass that message to static Message Rendering Method in Message_Activityfor display in theListView`. Problem: - After the message is being received from the Custom_Api_Class into the Message_Activity class for the display of it over the ListView, its not showing up... until and unless the ListView is being scrolled up or down. Conclusion: - I understand its a problem of ListView not getting refreshed and I did try the below methods to solve it but all in vain... - Called notifyDataSetChanged on the ArrayAdapter - Called invalidateViews on the ListView. - Tried by adding the value into the ArrayList&lt;String&gt; which goes into the ArrayAdapter - Tried by adding the value into the ArrayAdapter directly. - android:stackFromBottom="true" android:transcriptMode="alwaysScroll" Can anyone please let me know whats the core problem here is and any solution out of it.. I will be more obliged if someone can help me out of this. Edits: Code in Custom_Api_Class(Non-Acti…
answer count: 4
has comment: http://stackoverflow.com/comment/36650468
tagged with: java

media-player
tags question: http://stackoverflow.com/q/23864354
type: Tag
tags question: http://stackoverflow.com/q/23858418
tags question: http://stackoverflow.com/q/23872763
tag name: media-player

http://stackoverflow.com/q/23863128
linked to: http://stackoverflow.com/q/1200621
tagged with: java
accepted answer: http://stackoverflow.com/a/23863162
duplicate of: http://stackoverflow.com/q/1200621
type: Question
has body: Java enum lets you pass arguments to the constructor, but I can't seem to pass an array. For instance, the following code compiles with out error: enum Color { RED(255,0,0), GREEN(0,255,0), BLUE(0,0,255); int[] rgb; Color(int r, int g, int b) { rgb[0] = r; rgb[1] = g; rgb[2] = b; } } But if this same data is passed in as an array constant, the code will not compile: enum Color { RED({255,0,0}), GREEN({0,255,0}), BLUE({0,0,255}); int[] rgb; Color(int[] rgb) { this.rgb = rgb; } } I have also tried variations of creating a new int[] array, like: ... RED(new int[]{255,0,0}), ... with no luck. I think the problem lies in passing an array constant. I'm not sure if it is a simple syntax that needs to be corrected or if there is an underlying problem with passing this type of data. Thanks in advance.
score: 5
upvote count: 5
tagged with: arrays
downvote count: 0
answer count: 1
has title: Passing Array Constant to enum Constructor
has comment: http://stackoverflow.com/comment/64854410
has answer: http://stackoverflow.com/a/23863162
favorite count: 0
type: AnsweredQuestion
tagged with: enums

http://stackoverflow.com/comment/36859278
score: 0
has text: You could do an outer join on the date, or use union of two separate queries. As I said in the answer, if you're not too good at SQL you might prefer loading everything into Java with separate queries and construct your own datasets, that might be easier.
comment on: http://stackoverflow.com/a/23931485
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23928671
upvote count: 1
score: 1
downvote count: 0
has body: You can use BlockingQueue if you allowed to change your implementation, or use a wait/notify technique to wait and run when occupy. String value = null; while(true) { if((value = map.get(1)) != null) { // VARY IMPORTANT to use get and != // work with value } else { synchronized (map) { try { map.wait(); } catch (InterruptedException ie) {} } } } and for producer: String value = "Test"; map.put(1,value); synchronized (map) { map.notifyAll(); // or notify(). }
answers question: http://stackoverflow.com/q/23917818
type: Answer

http://stackoverflow.com/a/23870501
has comment: http://stackoverflow.com/comment/36778903
has comment: http://stackoverflow.com/comment/36780071
has body: Well, I've done this: zipStream = new ZipInputStream(channelSftp.get("Port_Increment_201405261400_2251.zip")); zipStream.getNextEntry(); sc = new Scanner(zipStream); while (sc.hasNextLine()) { System.out.println(sc.nextLine()); } It helps me to read ZIP's content without writing to another file.
downvote count: 1
has comment: http://stackoverflow.com/comment/36777416
score: 37
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23869228
answers question: http://stackoverflow.com/q/23869228
has comment: http://stackoverflow.com/comment/36766990
upvote count: 38
type: Answer

generics
tags question: http://stackoverflow.com/q/23797972
tags question: http://stackoverflow.com/q/23785807
tags question: http://stackoverflow.com/q/23781017
tags question: http://stackoverflow.com/q/23929947
tags question: http://stackoverflow.com/q/23824684
tags question: http://stackoverflow.com/q/23850693
tags question: http://stackoverflow.com/q/23808946
tags question: http://stackoverflow.com/q/23827889
tags question: http://stackoverflow.com/q/23857288
tags question: http://stackoverflow.com/q/23810781
tags question: http://stackoverflow.com/q/23915910
tags question: http://stackoverflow.com/q/23840887
tags question: http://stackoverflow.com/q/23937066
tags question: http://stackoverflow.com/q/23867303
tags question: http://stackoverflow.com/q/23797579
tags question: http://stackoverflow.com/q/23863716
tags question: http://stackoverflow.com/q/23781299
tags question: http://stackoverflow.com/q/23788278
type: Tag
tags question: http://stackoverflow.com/q/23923518
tags question: http://stackoverflow.com/q/23832497
tags question: http://stackoverflow.com/q/23821202
tags question: http://stackoverflow.com/q/23871541
tags question: http://stackoverflow.com/q/23901814
tags question: http://stackoverflow.com/q/23783720
tags question: http://stackoverflow.com/q/23814482
tags question: http://stackoverflow.com/q/23865950
tags question: http://stackoverflow.com/q/23796540
tags question: http://stackoverflow.com/q/23910086
tags question: http://stackoverflow.com/q/23898541
tags question: http://stackoverflow.com/q/23798679
tags question: http://stackoverflow.com/q/23802595
tags question: http://stackoverflow.com/q/23849954
tags question: http://stackoverflow.com/q/23895478
tags question: http://stackoverflow.com/q/23939294
tags question: http://stackoverflow.com/q/23877840
tags question: http://stackoverflow.com/q/23860437
tags question: http://stackoverflow.com/q/23848992
tags question: http://stackoverflow.com/q/23862790
tags question: http://stackoverflow.com/q/23852841
tags question: http://stackoverflow.com/q/23843250
tags question: http://stackoverflow.com/q/23910114
tags question: http://stackoverflow.com/q/23935448
tags question: http://stackoverflow.com/q/23828025
tags question: http://stackoverflow.com/q/23806429
tags question: http://stackoverflow.com/q/23889506
tags question: http://stackoverflow.com/q/23920150
tags question: http://stackoverflow.com/q/23787127
tag name: generics
tags question: http://stackoverflow.com/q/23818426
tags question: http://stackoverflow.com/q/23873615
tags question: http://stackoverflow.com/q/23879227

http://stackoverflow.com/comment/36792673
score: 0
type: QuestionComment
type: Comment
has text: Ah this is so confusing T_T. Okay if we use an example - say I want to move left. I issue that command. The server waits for other clients to issue their commands before sending out the updated game state. If we look at my perspective, wouldn't we see me clicking the move left button, not moving, and then suddenly move a few milliseconds after?
comment on: http://stackoverflow.com/q/23895107

http://stackoverflow.com/a/23898355
has body: Few tweaks done: public class Test { public static void main(String args[]){ int rnd; Random rand=new Random(); int[] nums = new int[50]; boolean[] check = new boolean[50]; for (int k = 0; k&lt;50; k++) { rnd = rand.nextInt(50); //Loop for when there number is already chosen while (check[rnd]) { rnd = rand.nextInt(50); } //Sets the random unique number to a slot in the array nums[k]=rnd; check[rnd]=true; } for(int num : nums){ System.out.println("\n" + num); } } }
type: Answer
answers question: http://stackoverflow.com/q/23897814
score: 0

http://stackoverflow.com/q/23940443
type: Question
has answer: http://stackoverflow.com/a/23940601
tagged with: java
has comment: http://stackoverflow.com/comment/36875046
score: 0
answer count: 1
tagged with: polymorphism
accepted answer: http://stackoverflow.com/a/23940601
linked to: http://stackoverflow.com/q/154577
has comment: http://stackoverflow.com/comment/36875143
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36875171
has title: Enforce method overload
has body: Looking at great example Polymorphism vs Overriding vs Overloading , consider this scenario: abstract class Human { public void goPee() { println("drop pants"); } } class Male extends Human { public void goPee() { super.goPee(); println("stand up"); } } class Female extends Human { public void goPee() { super.goPee(); println("sit down"); } } My questions: Is it possible, on concrete classes level, to enforce using super.goPee() inside goPee() ? if so - how ? Is it possible, on abstract class level, to know which concrete class had called super.goPee() ? Rationale for that is if I would need to call method let's say liftToiletSeat() somewhere on abstract class level. Thank you.

http://stackoverflow.com/comment/36647150
type: Comment
type: QuestionComment
has text: I expect b.behavior() to print the code within the method. I don't expect anything. I would like to know why Java doesn't allow any one to write like that. What's the reason behind constructing a language like this?
comment on: http://stackoverflow.com/q/23820319
score: 0

http://stackoverflow.com/comment/36595300
comment on: http://stackoverflow.com/q/23779332
score: 0
type: QuestionComment
type: Comment
has text: Well, a `String` isn't a `CustomObject`. So of course `contains()` should return `false`.

http://stackoverflow.com/q/23794647
score: 0
has body: I am trying to connect to an old web service and I am getting an error when I autogenerate the classes with wsimport and other tools as well. computer-name:tmp me$ wsimport -keep -verbose https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL parsing WSDL... [WARNING] src-resolve.4.2: Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1'. line 30 of https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1 [ERROR] undefined element declaration 's:schema' line 30 of https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL Is the problem that I need to have them edit the WSDL to remove s:schema? The WSDL passes validation, which is even more strange. I know it is possible to still pull the data as many online SOAP client testing tools and even Eclipse allow me to navigate and execute the methods. Thanks in advance for any guidance!
tagged with: wsdl
answer count: 1
has answer: http://stackoverflow.com/a/23796679
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: java
tagged with: wsimport
type: Question
has title: WSDL error on wsimport

http://stackoverflow.com/q/23803843
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36678768
accepted answer: http://stackoverflow.com/a/23804029
has title: margin:auto not working in FTL file
score: -1
has comment: http://stackoverflow.com/comment/36615128
has comment: http://stackoverflow.com/comment/36615063
upvote count: 0
answer count: 1
has body: I am preparing html body by using FTL template (in Java). I have written css as follows: width: 620px; margin-left: auto; margin-right: auto; also tried margin: auto; FTL not considering auto keyword from css. Could you please help anyone on this.
favorite count: 0
tagged with: freemarker
has answer: http://stackoverflow.com/a/23804029
tagged with: css

http://stackoverflow.com/comment/36881634
type: Comment
has text: Thanks, I got an error message that postgresql does not yet support Connection.isValid(). If I want to keep using the same connection I'll just resort to re-opening it if an Exception occurs during an update.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23921508

http://stackoverflow.com/comment/36845613
score: 0
type: AnswerComment
has text: As for what's *right and wrong* from a design perspective, That's an opinion. You asked us to answer your question and you have lots of offers.
type: Comment
comment on: http://stackoverflow.com/a/23905251

http://stackoverflow.com/comment/36605307
comment on: http://stackoverflow.com/q/23797972
has text: Just a suggestion, they usually appreciate you providing a test case that shows your bug. What I normally do with my projects is copy everything to a new project and start deleting everything I know isn't necessary until I reach a point where any change I make will cause the error to vanish. Also might want to consider raising the priority on the bug.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36651118
has text: You are missing struts-tiles jars, download all jars related to struts from [here](http://struts.apache.org/download.cgi)
score: 1
comment on: http://stackoverflow.com/q/23822501
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36653555
has text: Yes but I'm also working with different kinds of objects. I want to be able to say that **object A's attribute foo value is inferior to 3** or **object A's attribute foo value is equal to object B's attribute foo value**
comment on: http://stackoverflow.com/a/23823653
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23838709
type: AnsweredQuestion
has body: I'm trying to read a moderately sized txt file (65,00 words) into a String, then a string array. The bufferedreader throws the "could not read file" catch. When I clear it, a small part of the contents of the text file is shown in the system.out. I do not get the error with smaller text files. I'm a beginner and I'm having a lot of trouble trying to narrow down the issue. Why isn't the BufferedReader ingesting the entire file? And why is the "could not read file" error being thrown? public class Main { public static void main(String[] args) { final Guid Main = new Guid(); //creates instance of Guid Main.mergeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { merge(); } }); } static void merge() { //read file and turn into string String pathone = open(Guid.PathOne); System.out.print(pathone); //parse and format //String[] oneArray = pathone.replace("\n"," ").split(" "); //get pathtwo text //String pathtwo = open(Guid.PathTwo); //parse and format //load into array //compare array entries //add new array entry //sort array //write array to paththree file //for(int i=0; i&lt;oneArray.length;i++) //{ //System.out.println(oneArray[i]); //} } public static String open(JTextArea Path) { String record = null; FileReader frFile = null; try { frFile = new FileReader(Path.getText());//gets file from Path BufferedReader brFile = new BufferedReader(frFile);//creates buffered reader record = brFile.readLine() + "\n"; //gets contents of file and puts it into a string brFile.mark(0); while (brFile.read() != -1) //loop to read the rest of the text file { brFile.reset(); record = record + brFile.readLine() + "\n"; brFile.mark(0); } } catch (FileNotFoundException e) //catch path is in error { JFrame frame = null; JOptionPane.showMessageDialog(frame, "Could not find file."); } catch (IOException e) //catch if file cannot be read { JFrame frame = null; JOptionPane.showMessageDialog(frame, "Could not read file."); } try { //closes file frFile.c…
has answer: http://stackoverflow.com/a/23838734
downvote count: 1
possible better answer: http://stackoverflow.com/a/23838779
type: Question
accepted answer: http://stackoverflow.com/a/23838734
has answer: http://stackoverflow.com/a/23838779
tagged with: java
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/23838837
upvote count: 0
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/36682329
favorite count: 0
linked to: http://stackoverflow.com/q/17739362
has title: BufferedReader not reading complete .txt file

http://stackoverflow.com/q/23863439
has comment: http://stackoverflow.com/comment/36730153
tagged with: java
score: -1
has body: class BadFoodException extends Exception{ //Do something } class Reader { private String food1; private String food2; public static void main(String args[]) { Reader m = new Reader(args); for (int i=0; i&lt;args.length; i++){ try { m.checkfood(args[i]); } catch(BadFoodException e){System.out.println(args[i]+ " caught");} } } private Reader(String [] args){ food1=args[0]; food2=args[1]; } void checkfood(String food) throws BadFoodException { if( food == "banana") throw new BadFoodException(); System.out.println(food + " passed through."); } } I am passing two foods- banana and mango through command line. The checkfood method should throw an exception when the food is banana.. and the mango should pass through. However both are passing through instead? why?
has comment: http://stackoverflow.com/comment/36730489
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23863484
favorite count: 0
has comment: http://stackoverflow.com/comment/36730122
linked to: http://stackoverflow.com/q/513832
tagged with: exception
has title: Exception handling not working?(JAVA)
duplicate of: http://stackoverflow.com/q/513832
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23863451
has answer: http://stackoverflow.com/a/23863610
has comment: http://stackoverflow.com/comment/36730057

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

http://stackoverflow.com/comment/36804437
score: 0
type: Comment
type: QuestionComment
has text: last but not least, be very careful of the sleep method you are using, there are high chance that sometime that equation will return negative value and crash you program.
comment on: http://stackoverflow.com/q/23901398

http://stackoverflow.com/comment/50900758
comment on: http://stackoverflow.com/a/23949158
score: 0
type: AnswerComment
has text: @Thomas sonar.jacoco.reportPath is for Unit tests generated jacoco exec file (for ex: jacocoUT.exec) and sonar.jacoco.itReportPath is for Non-Unit tests (i.e. Integration Tests, acceptance tests, Selenium based etc tests which require separate JVM that Gradle's and these kind of tests require external resources). In my case, I get either a jacocoIT.exec or jacocoAT.exec or jacocoST.exec file for non-Unit tests depending upon what kind of tests I have in my src/xxTest/java or groovy. If you have both .exec or multiple exec files, you can generate combined code coverage reports.
type: Comment

http://stackoverflow.com/comment/36782370
comment on: http://stackoverflow.com/a/23891255
type: AnswerComment
has text: I actually am :/ And that's what is concerning me. I start a thread in the SnakeCanvas's run method where the first thing I do is repaint.
score: 0
type: Comment

http://stackoverflow.com/q/23802242
type: Question
has comment: http://stackoverflow.com/comment/36612322
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36612332
favorite count: 0
has title: Find string between two strings
has answer: http://stackoverflow.com/a/23802493
accepted answer: http://stackoverflow.com/a/23802493
has comment: http://stackoverflow.com/comment/36612522
upvote count: 0
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36612311
score: -1
has body: The sample content is given below, I need to get the value between "body{" and "}". I tried with pattern matcher and it is not finding. Can someone help me with this. body { font-family: Arial, Helvetica, sans-serif; font-style: normal; font-size: 10pt color: #000000; } Here's the code: String patt1 = "body {"; String patt2 = "}"; Pattern p1 = Pattern.compile(Pattern.quote(patt1) + "(.*?)" + Pattern.quote(patt2)); Matcher m1 = p1.matcher(cssContent); while (m1.find()) { System.out.println("Mathced string : "+m1.group(1)); }

http://stackoverflow.com/comment/36905726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23939756
has text: Continuing Andrew Thompson comment, you'll be able to post to the server, no to the web page where te app was initiated. But the webpage could poll the server for new data. Is that good enough for you?
score: 0

push-notification
tags question: http://stackoverflow.com/q/23931469
tags question: http://stackoverflow.com/q/23779719
tags question: http://stackoverflow.com/q/23782769
tags question: http://stackoverflow.com/q/23844347
type: Tag
tags question: http://stackoverflow.com/q/23782851
tag name: push-notification
tags question: http://stackoverflow.com/q/23781307

http://stackoverflow.com/a/23907078
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23906717
score: 1
answers question: http://stackoverflow.com/q/23906717
has comment: http://stackoverflow.com/comment/36813533
has comment: http://stackoverflow.com/comment/36814575
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36813683
type: Answer
has body: You can pass params to your shell script and use them inside de script, The Class ProcessBuilder have a constructor that take the command to execute and the list of parameters to pass to the executable : ProcessBuilder(String... command) you have to pass params like this : ProcessBuilder pb = new ProcessBuilder("/home/najib/upload.sh",param1,param2,param3); inside the script param1 is $1 , param2 is $2 , and param3 is $3 (you can pass in the constructor as many arguments as you want )
has comment: http://stackoverflow.com/comment/36815100

http://stackoverflow.com/q/23824466
type: Question
answer count: 1
downvote count: 0
tagged with: custom-controls
tagged with: javafx-8
has answer: http://stackoverflow.com/a/32208998
tagged with: javafx-2
favorite count: 0
type: UnansweredQuestion
has title: Should my custom control rely on Controller classes or Interfaces?
upvote count: 1
has body: Suppose I make a custom control in my application. This custom control can be housed in another layout's FXML file, or added dynamically through code. The parent container housing this custom widget has to be able to respond to its changes. Should my custom widget utilize INTERFACES (polymorphism) or CONTROLLER passing? The former requires that any parent class dynamically adding it to their layout implement the WidgetInterface so that it may handle changes. The latter lets controller classes pass themselves in during construction so that the widget can tell the parent controller to act upon changes. This best works with FXML injection. The problem with this method, however, is that it only lets one parent controller class control the widget. How can my widget be utilized by any class, anywhere, and be easily injected from FXML without problems? Via the injection method, it will try to call initialize() and rely on a controller class when there might not be one.
score: 1
tagged with: java
tagged with: javafx

http://stackoverflow.com/q/23937330
has answer: http://stackoverflow.com/a/23938915
tagged with: libgdx
tagged with: java
has body: My app cant show interstitial. If i run the app with the test device id than it shows me the interstitial test window from google. But without the test device id it shows me nothing. I make the same steps like intergrate the smart_banner. My app shows the smart_banner but not the interstitial. It is possible that i work with the wrong class... there exist also a interstitial class but i use the AdView class. I have no idea did anyone know a good tutorial for including interstitial in libgdx ? public class MainActivity extends AndroidApplication { private AdView adView; private AdView fullAdView; private RelativeLayout layout; private final String ADCODE = "XXX"; private final String FULLADCODE = "XXX"; @Override public void onCreate(Bundle savedInstanceState) { ... // Create the layout layout = new RelativeLayout(this); // AdMob View fullAdView = new AdView(this); fullAdView.setAdUnitId(FULLADCODE); fullAdView.setAdSize(AdSize.MEDIUM_RECTANGLE); View gameView = initializeForView(new FPGame(new RequestHandler(adView, fullAdView)), cfg); ... AdRequest fadRequest = new AdRequest.Builder().build(); fullAdView.loadAd(fadRequest); fullAdView.setAdListener(new AdListener(){ @Override public void onAdLoaded() { super.onAdLoaded(); MainActivity.this.runOnUiThread(new Runnable(){ @Override public void run() { layout.requestLayout(); } }); } });
tagged with: admob
type: Question
answer count: 1
favorite count: 0
score: 0
tagged with: android
has title: How to show Admob interstitial in libGDX
type: UnansweredQuestion
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/36600181
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23793456
type: AnswerComment
has text: you might be right but there are also options like `Microsoft Azure` or `Google Cloud Platform` or `Amazon Web Services` where you pay for what you use so the costs are not that much. I personally use Amazon for my backend storage

http://stackoverflow.com/comment/36835316
type: Comment
type: QuestionComment
score: 1
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)
comment on: http://stackoverflow.com/q/23918620

http://stackoverflow.com/q/23938601
has title: Hiding headers from a query in java program
tagged with: properties-file
score: 0
answer count: 1
has body: So i have a program that spits out data from google to a csv file. What i want to do is allow users to choose to display the headers or not via using a string. Here is my printer: ...some code // getting the queries to print if (results.getRows() == null || results.getRows().isEmpty()) { pw.println("No results Found."); System.out.println("No results Found."); } else { // Print column headers. for (ColumnHeaders header : results.getColumnHeaders()) { pw.print(header.getName() + ", "); } pw.println(); // Print actual data. for (List&lt;String&gt; row : results.getRows()) { for (String column : row) { pw.print(column + ","); } pw.println(); } pw.close(); } } } I have a properties file that is connected to my program and i want to put it so that when a user types in no in the header part of the properties file i dont want the headers to show. I was thinking about converting the header part into a string and putting it in the if then statement. any suggestions? thx in advanced EDIT: // column headers statement if (headers=="yes") { for (ColumnHeaders header : results.getColumnHeaders()) pw.print(header.getName() + ", "); } else { // Print column headers. for (ColumnHeaders header : results.getColumnHeaders()) { pw.print("" + ", "); } pw.println(); } // getting the queries to print if (results.getRows() == null || results.getRows().isEmpty()) { pw.println("No results Found."); System.out.println("No results Found."); } else { // Print actual data. for (List&lt;String&gt; row : results.getRows()) { for (String column : row) { pw.print(column + ","); } pw.println(); } pw.close(); } } } But what I have now is not working correctly.
type: AnsweredQuestion
tagged with: printwriter
has answer: http://stackoverflow.com/a/23940712
accepted answer: http://stackoverflow.com/a/23940712
type: Question
tagged with: java

http://stackoverflow.com/a/23921456
has comment: http://stackoverflow.com/comment/117128935
has comment: http://stackoverflow.com/comment/117142611
has comment: http://stackoverflow.com/comment/117142443
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23919788
has comment: http://stackoverflow.com/comment/117142659
answers question: http://stackoverflow.com/q/23919788
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/117143075
has body: DateFormat.getDateTimeInstance() can also have three arguments. The third argument specifies the region where certain customs like time formats are common (if 24-hour-style in most countries or rather am/pm-style like in US). By choosing an explicit locale you can control the behaviour of your format-object in a locale-dependent way. Internally Java will choose the right format pattern for you given the informations about date style, time style and locale. If this is not sufficient you might consider SimpleDateFormat instead. Then you yourself decide which exact format pattern to choose, but this is fixed then. You might also consider a combination of both approaches if you are not satisfied with what Java sees as right format for given locale but also want to have a localized solution: DateFormat df; if (locale.equals(myLocale)) { df = new SimpleDateFormat("dd/MM/yy HH:mm"); // yy for 2-digit-year, not YY! } else { // general solution for other locales df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, myLocale); }
type: Answer
upvote count: 4

http://stackoverflow.com/comment/36570402
type: AnswerComment
score: 0
type: Comment
has text: Well, the JPA framework uses it so intensively that IMHO it is more than conventions...
comment on: http://stackoverflow.com/a/23779799

http://stackoverflow.com/q/23819196
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/36644875
has answer: http://stackoverflow.com/a/23819480
tagged with: jframe
tagged with: animation
tagged with: swing
has comment: http://stackoverflow.com/comment/36645138
has body: I am new to java GUI, and am trying to learn it. I want to move a circle on screen automatically(i.e not by pressing any key or doing any other action). I found a way to move it by doing some action but thats not what i needed. Please could anybody tell me the simplest way of doing that? I want to remove the action listener in the following code, so that circles move automatically: public class MyFirstGraphics extends JFrame { int x = 100; int y = 100; MyFirstGraphics() { super("Circle"); setSize(800, 800); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setBackground(Color.pink); JButton f = new JButton("circle"); f.addActionListener(new re()); add(f, BorderLayout.NORTH); } private class re implements ActionListener { public void actionPerformed(ActionEvent e) { for (int i = 1; i &lt; 50; i++) { x++; y++; repaint(); } } } public void paint(Graphics g) { super.paint(g); g.drawOval(x, y, 100, 100); } public static void main(String[] args) { MyFirstGraphics l = new MyFirstGraphics(); l.setVisible(true); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23819401
tagged with: java
downvote count: 5
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36645135
accepted answer: http://stackoverflow.com/a/23819480
possible better answer: http://stackoverflow.com/a/23819401
answer count: 2
has comment: http://stackoverflow.com/comment/36644881
has title: How to move a circle automatically in java?
tagged with: awt
linked to: http://stackoverflow.com/q/23815472
has comment: http://stackoverflow.com/comment/36644907

logging
tags question: http://stackoverflow.com/q/23815645
tags question: http://stackoverflow.com/q/23929579
tag name: logging
tags question: http://stackoverflow.com/q/23882995
tags question: http://stackoverflow.com/q/23928036
tags question: http://stackoverflow.com/q/23888166
tags question: http://stackoverflow.com/q/23869207
tags question: http://stackoverflow.com/q/23814067
tags question: http://stackoverflow.com/q/23910615
tags question: http://stackoverflow.com/q/23867230
tags question: http://stackoverflow.com/q/23853449
tags question: http://stackoverflow.com/q/23911306
tags question: http://stackoverflow.com/q/23826552
tags question: http://stackoverflow.com/q/23825373
tags question: http://stackoverflow.com/q/23818520
tags question: http://stackoverflow.com/q/23839530
tags question: http://stackoverflow.com/q/23923156
tags question: http://stackoverflow.com/q/23835483
tags question: http://stackoverflow.com/q/23830762
tags question: http://stackoverflow.com/q/23906041
tags question: http://stackoverflow.com/q/23940346
tags question: http://stackoverflow.com/q/23888511
tags question: http://stackoverflow.com/q/23865468
tags question: http://stackoverflow.com/q/23788363
tags question: http://stackoverflow.com/q/23809490
tags question: http://stackoverflow.com/q/23929339
tags question: http://stackoverflow.com/q/23786807
type: Tag
tags question: http://stackoverflow.com/q/23820765
tags question: http://stackoverflow.com/q/23863615

hadoop
tags question: http://stackoverflow.com/q/23840304
tags question: http://stackoverflow.com/q/23834319
tags question: http://stackoverflow.com/q/23903285
tags question: http://stackoverflow.com/q/23862309
tags question: http://stackoverflow.com/q/23897303
tags question: http://stackoverflow.com/q/23923490
tag name: hadoop
tags question: http://stackoverflow.com/q/23779976
tags question: http://stackoverflow.com/q/23912772
tags question: http://stackoverflow.com/q/23823741
type: Tag
tags question: http://stackoverflow.com/q/23908191
tags question: http://stackoverflow.com/q/23784215
tags question: http://stackoverflow.com/q/23834824
tags question: http://stackoverflow.com/q/23859699
tags question: http://stackoverflow.com/q/23877969
tags question: http://stackoverflow.com/q/23828393
tags question: http://stackoverflow.com/q/23931932
tags question: http://stackoverflow.com/q/23826007
tags question: http://stackoverflow.com/q/23885521
tags question: http://stackoverflow.com/q/23872677
tags question: http://stackoverflow.com/q/23896086
tags question: http://stackoverflow.com/q/23938633
tags question: http://stackoverflow.com/q/23819949
tags question: http://stackoverflow.com/q/23868022
tags question: http://stackoverflow.com/q/23916710
tags question: http://stackoverflow.com/q/23862908
tags question: http://stackoverflow.com/q/23839988
tags question: http://stackoverflow.com/q/23792625

http://stackoverflow.com/q/23898476
downvote count: 1
type: AnsweredQuestion
has body: public class AreaDeRectangulo extends JFrame { public static final int WIDTH = 640; public static final int HEIGHT = 480; public JLabel AltoL, AnchoL, AreaL, PerimetroL; public JTextField AltoTF, AnchoTF, AreaTF, PerimetroTF; public JButton Calcular, Salir; public BotonDeCalcular cbHandler; public BotonDeSalir ebHandler; } public class BotonDeCalcular implements ActionListener { public void actionPerformed(ActionEvent e) { double alto, ancho, area; ancho = Double.parseDouble(AnchoTF.getText()); alto = Double.parseDouble(AltoTF.getText()); area = ancho * alto; AreaTF.setText(" " + area); } } public static class BotonDeSalir implements ActionListener { public void actionPerformed(ActionEvent e) { System.exit(0); } public static void main(String[] args) { AreaDeRectangulo rectObj = new AreaDeRectangulo(); } } } Why the classes "BotondeCalcular" and "BotondeSalir" have to be created inside the main class? are they like a mini-classes? PD: it gives me an error if I try to separate the classes
tagged with: java
has comment: http://stackoverflow.com/comment/36796592
has comment: http://stackoverflow.com/comment/36796589
type: Question
has answer: http://stackoverflow.com/a/23898569
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/23898509
accepted answer: http://stackoverflow.com/a/23898509
favorite count: 0
possible better answer: http://stackoverflow.com/a/23898569
has comment: http://stackoverflow.com/comment/36796758
has title: why the classes have to be inside the other class?
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36796652

http://stackoverflow.com/comment/36695979
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23845789
has text: it is not on my machine. but i can connect my localhost and if i create database with `remote_ip` i can connect too. Still i dont want to do this i want to connect my `remote_desktop_localhost` with java like anyone who write url and connect my database with wordpress.
type: Comment

http://stackoverflow.com/q/23867628
upvote count: 5
downvote count: 0
has title: Kerberos - found unsupported keytype (1)
has comment: http://stackoverflow.com/comment/56723475
has comment: http://stackoverflow.com/comment/36737128
favorite count: 0
possible better answer: http://stackoverflow.com/a/49816191
accepted answer: http://stackoverflow.com/a/23883508
has body: I am getting error after I updated Java from JAVA 6 to JAVA 7. In java 6 everything was running fine, but I need to move. Found unsupported keytype (1) for my/my.com Added key: 16version: 1 Added key: 23version: 1 Added key: 18version: 1 Ordering keys wrt default_tkt_enctypes list Using builtin default etypes for default_tkt_enctypes default etypes for default_tkt_enctypes: 18 17 16 23. Found unsupported keytype (1) for my/my.com Added key: 16version: 1 Added key: 23version: 1 Added key: 18version: 1 Ordering keys wrt default_tkt_enctypes list Using builtin default etypes for default_tkt_enctypes default etypes for default_tkt_enctypes: 18 17 16 23. Using builtin default etypes for default_tkt_enctypes default etypes for default_tkt_enctypes: 18 17 16 23. >>> KrbAsReq creating message >>> KrbKdcReq send: kdc=my.com UDP:88, timeout=3, number of retries =1, #bytes=183 >>> KDCCommunication: kdc=my.com UDP:88, timeout=3,Attempt =1, #bytes=183 Exception in thread "main" java.io.IOException: Login failure for my/my.com from keytab /etc/hbase/conf/hdfs.keytab
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23883508
type: Question
tagged with: kerberos
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/49816191

http://stackoverflow.com/comment/36805240
comment on: http://stackoverflow.com/a/23896976
type: AnswerComment
type: Comment
has text: It's unlikely that the version of NCSO.jar is a problem here. All it does is invoke remote methods with matching signatures on the server. It's a very thin layer. Also, IBM is really, really good about backward compatibility, so while you won't have the ability to call newer methods, you can be as close to 100% certain as exists in the tech world that the methods that are in the jar will continue to work with upgraded versions of the server. getAllDocumentsByKey has been around forever, and hasn't changed in a way that would break things. That said, there's no harm in upgrading your NCSO.jar.
score: 1

http://stackoverflow.com/q/23832922
has answer: http://stackoverflow.com/a/23832990
has comment: http://stackoverflow.com/comment/36670933
has answer: http://stackoverflow.com/a/23832986
type: AnsweredQuestion
type: Question
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/23833048
has comment: http://stackoverflow.com/comment/36671239
has body: Is there a way to print all values in a 3d array? This is what I got but getting a null pointer exception: int i = 2; int x = 15; String[][][] arrays = new String[x][x][i]; String arraytext = "hello"; for (String[][] row: arrays) Arrays.fill(row, arraytext); for (int a = 0; a&lt;=x; a++){ for (int b = 0; b&lt;=x; b++){ for (int j = 0; j&lt;=i; j++) {System.out.println(arrays[a][b][j]);} } }
has answer: http://stackoverflow.com/a/23832966
has answer: http://stackoverflow.com/a/50832234
has comment: http://stackoverflow.com/comment/36670664
has comment: http://stackoverflow.com/comment/36670642
score: 0
tagged with: java
answer count: 7
accepted answer: http://stackoverflow.com/a/23833048
has answer: http://stackoverflow.com/a/23832975
possible better answer: http://stackoverflow.com/a/23833178
tagged with: arrays
has answer: http://stackoverflow.com/a/23833178
has comment: http://stackoverflow.com/comment/36670671
has comment: http://stackoverflow.com/comment/36671117
has title: Print all values in a 3d array

http://stackoverflow.com/comment/36780928
comment on: http://stackoverflow.com/q/23890541
has text: Can you show some basic sax parsing code that you tried so far?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36670642
score: 0
has text: Check the stacktrace. If you don't know how, post the stacktrace here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23832922

http://stackoverflow.com/q/23905216
type: Question
has comment: http://stackoverflow.com/comment/36816137
has title: Can I get CSS property "padding" of an element using WebDriver?
has comment: http://stackoverflow.com/comment/36814446
accepted answer: http://stackoverflow.com/a/23909371
has comment: http://stackoverflow.com/comment/36813908
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36813781
has body: I have a task to test that all over the application, spacing between the 2 input fields should be 6px. So when I tried to read the css value using getCssvalue method, it is giving a blank value. Note: getCssvalue method is working fine for the other properties (Eg: font-family) Here is the screen shot of css values for one the input field containing spacing between the input fields.
has comment: http://stackoverflow.com/comment/36816783
tagged with: css
has answer: http://stackoverflow.com/a/23909371
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/36816945
has comment: http://stackoverflow.com/comment/36815491
downvote count: 1

http://stackoverflow.com/q/23784046
has comment: http://stackoverflow.com/comment/36578447
tagged with: java
type: Question
has title: ORACLE SQL DEVELOPER,Asking for JDK 7 and NO ADMIN rights
linked to: http://stackoverflow.com/q/1619662
has answer: http://stackoverflow.com/a/23784883
accepted answer: http://stackoverflow.com/a/23784883
has comment: http://stackoverflow.com/comment/36578250
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/36578836
possible better answer: http://stackoverflow.com/a/23784184
has body: I am trying to use Oracle SQL Developr. When I try to open it, it asks for the jdk path. Whereas I have only a JRE installed. I do not have admin privileges and I can not get it that. I have tried modifying the sqldeveloper\bin\sqldeveloper.CONF file but it did not help. Is there any alternative to do that. I have searched for around 3 hours on Google. Nothing hits up straight. And if you are planning to call it duplicate. I have gone through the similar questions but dint worked out. And installed as per the answer How to start Oracle SQL Developer 4 using 32 bit JDK on Win 64?. But there also ERROR pops up when I start.
downvote count: 1
linked to: http://stackoverflow.com/q/22225769
has comment: http://stackoverflow.com/comment/36578109
has comment: http://stackoverflow.com/comment/36578347
favorite count: 0
tagged with: oracle-sqldeveloper
has answer: http://stackoverflow.com/a/23784184
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36578702
has comment: http://stackoverflow.com/comment/36578143
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/36632230
comment on: http://stackoverflow.com/q/23812764
type: Comment
type: QuestionComment
score: 2
has text: I'll just leave [this](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) here

http://stackoverflow.com/q/23828191
has title: JAXB unmarshall xml without package-info.java
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23831088
score: 1
has body: JAXB unmarshaller throws exception if there is no package-info.java file. This code is called from another language and custom classloader can not load package-info properly. I had already manually added the namespace parameter to all the @XmlElement annotations. Xml root element has multiple xmlns attributes. Two of them (xmlns and xmlns:c) have the same value (I can not change xml, which is comeing from external service) BUT: It works if I remove xmlns="urn:foo:bar" from document even without package-info The question: how can I unmarshall without package-info (I can not modify custom classloader which can not load it) and without removing xmlns from xml ? What should I change in my code? Java 1.6_45 vJAXB 2.1.10 XML root element sample: &lt;?xml-stylesheet type="text/xsl" href="file1.xslt"&gt; &lt;?xml-stylesheet type="text/xsl" href="file1.xslt"?&gt; &lt;c:ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:foo:ba" xmlns:c="urn:foo:bar" xmlns:std="urn:foo:std" xsi:schemaLocation="urn:foo:bar file2.xsd"&gt; Code: String path = "D:\\data\\document.xml"; try { JAXBContext jc = JAXBContext.newInstance(ObjectFactory.class); Unmarshaller u = jc.createUnmarshaller(); Object root = u.unmarshal(new File(path)); //exception w/o package-info.java CDocument doc= (CDocument) JAXBIntrospector.getValue(root); System.out.println(doc); package-info.java @javax.xml.bind.annotation.XmlSchema(namespace = "urn:foo:bar", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns={@XmlNs(namespaceURI = "urn:foo:bar", prefix = "")}) package test.model; import javax.xml.bind.annotation.XmlNs; Exception: javax.xml.bind.UnmarshalException: Unable to create an instance of my.package.here.model.ANY Any ideas will be greatly appreciated, I had spent so much time trying, but still have nothing.
upvote count: 1
type: Question
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/23831088
tagged with: unmarshalling
tagged with: package-info
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36734204
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23854958
has text: Ensure the [Java Console](http://www.java.com/en/download/help/javaconsole.xml) is configured to show for applets & JWS apps. If there is no output at the default level, raise it and try again.
score: 0

http://stackoverflow.com/comment/36748032
score: 0
type: Comment
type: QuestionComment
has text: It gets nulledWhen You leave SetProgress bar, or when You exit findProgressBar()? In Java all is passed as value, means, ProgressBar is a local value, not more alive when SetProgressbar leaves, getting null, YOu assigned the value variable via reference to localprg, means, this also gets null then.
comment on: http://stackoverflow.com/q/23873469

http://stackoverflow.com/q/23913285
type: AnsweredQuestion
has title: Use a Java file that is in a different place than the rest of the project
type: Question
has body: I have a java source file in my project, that I want to move to an entirely different location than the rest of the files (my unix home dir), but I still want to be able to properly use it in my project. Is there a way to do this? EDIT - I see there is a vote to close this for being unclear, so - let's say you have a pJava project in Eclispe. All the source files are neatly saved in their relevant packages, under the same directory. Now, I want to move one of the files to somewhere completely different, but still have it used in my project. I hope this clarifies Thanks!
tagged with: java
has answer: http://stackoverflow.com/a/23913656
score: 0
answer count: 2
tagged with: linux
accepted answer: http://stackoverflow.com/a/23913656
possible better answer: http://stackoverflow.com/a/23913550
has answer: http://stackoverflow.com/a/23913550
tagged with: unix

http://stackoverflow.com/q/23926329
favorite count: 0
has comment: http://stackoverflow.com/comment/36849099
has comment: http://stackoverflow.com/comment/36865315
has comment: http://stackoverflow.com/comment/36849046
has answer: http://stackoverflow.com/a/23926470
has comment: http://stackoverflow.com/comment/36849191
upvote count: 4
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23926473
accepted answer: http://stackoverflow.com/a/23926473
possible better answer: http://stackoverflow.com/a/23926470
tagged with: java
has comment: http://stackoverflow.com/comment/36848998
has answer: http://stackoverflow.com/a/23926500
type: Question
has comment: http://stackoverflow.com/comment/36851962
score: 3
tagged with: enums
has comment: http://stackoverflow.com/comment/36890311
has comment: http://stackoverflow.com/comment/36910063
has comment: http://stackoverflow.com/comment/36943916
has body: Suppose there is the enum declaration somewhere in code: enum Colors { RED(100), BLUE(200); } Can I get the lowest/highest index value for that particular enum type presuming I am not aware of the declaration? Is it possible in java? Example: int lowIndex = Colors.minIndex(); // should return 100 Thanks everyone. So there are no implicit methods to query for min/max defined integer value. I'll have to iterate through the enum values and determine it from there as you have described.
downvote count: 1
has answer: http://stackoverflow.com/a/23926660
has title: How to determine lowest/highest index of enum in java?

http://stackoverflow.com/comment/36788047
type: Comment
type: QuestionComment
has text: can't understand y my questions are voted down.is it a sin to ask doubts in stackoverflow.i think if i ask one or two questions more i won't even have reputation to comment or vote up an answer....grrr
score: 0
comment on: http://stackoverflow.com/q/23893851

http://stackoverflow.com/q/23779301
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36712282
answer count: 0
tagged with: java
has title: How to avoid duplicates on restoring sms in android?
has comment: http://stackoverflow.com/comment/36569669
type: Question
has body: I'm doing backup and restore of sms, I'm able to do,but on restoring sms multiple times im getting the duplicates,which is not good, Im getting duplicates since im comparing with _Id(which is wrong),alternately I thought of comparing with number and body,but it is not efficient. can anyone suggest solution with alternate comparision or if you know any other method to avoid duplicates, thanks in advance.
score: 0
tagged with: sms

http://stackoverflow.com/a/64800193
answers question: http://stackoverflow.com/q/23923443
type: Answer
has body: I have done the following changes to come out from the problem.I have used the two steps for it , first one is that update the jacoco in latest version along with its toolVersion , please check it once below classpath "com.dicedmelon.gradle:jacoco-android:0.1.4" And toolVersion is as follow jacoco { toolVersion = "0.8.4" } Please refer the link for more info Click here And now check the second step for it in which we use the excludes = ['jdk.internal.*'] inside the testOption like below testOptions { unitTests.all { jacoco { includeNoLocationClasses = true excludes = ['jdk.internal.*'] } } } For more info in it, please check the link Click here
score: 0

http://stackoverflow.com/a/23792108
type: Answer
has body: Your ChangePosition method is static and modifies some static variables. That means that you don't have the coordinates safed for every player, but they all share the same, hence the two methods add up. You need to declare the coordinates without the static modifier to make them fields that are individual on every instance of that class.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23791883
score: 0
accepted answer of: http://stackoverflow.com/q/23791883

http://stackoverflow.com/comment/36659757
has text: You can randomize a value from a `List<String>` and use reflection to invoke a method corresponding to the given `String`. Although this is probably a very very bad idea design-wise. I would recommend you just randomize any argument given to a single method, whatever your purpose is.
comment on: http://stackoverflow.com/q/23827251
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/23917326
tagged with: memory-management
has comment: http://stackoverflow.com/comment/36832266
has body: Suppose we are creating an ArrayList Object like ArrayList&lt;User&gt; list=new ArrayList&lt;User&gt;(); System.out.println(list.size()); // it will be 0 at this time Now my question is, what memory it will allocate when this list object will be created in the heap. I want to know how this memory size is allocated at run time if the size of the list grows dynamically.
has comment: http://stackoverflow.com/comment/36831989
has title: Default memory allocation on object creation for ArrayList
upvote count: 1
tagged with: collections
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23918402
has comment: http://stackoverflow.com/comment/36831987
has answer: http://stackoverflow.com/a/23918402
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36831973
has comment: http://stackoverflow.com/comment/36832589
has answer: http://stackoverflow.com/a/23918334
has comment: http://stackoverflow.com/comment/36833323
has comment: http://stackoverflow.com/comment/36832849
has comment: http://stackoverflow.com/comment/36832769
has answer: http://stackoverflow.com/a/23918742
has comment: http://stackoverflow.com/comment/36831994
tagged with: arraylist
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36832152
favorite count: 0
has comment: http://stackoverflow.com/comment/36831927
accepted answer: http://stackoverflow.com/a/23918334

http://stackoverflow.com/comment/40109538
has text: I have the exact same problem. Not promising when you search for a problem, but find an *unaswered* Stack Overflow question. ;)
score: 1
comment on: http://stackoverflow.com/q/23786120
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23817034
has answer: http://stackoverflow.com/a/23997452
has answer: http://stackoverflow.com/a/23819004
accepted answer: http://stackoverflow.com/a/23819004
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: gradle
type: Question
tagged with: libgdx
possible better answer: http://stackoverflow.com/a/23997452
has answer: http://stackoverflow.com/a/23866449
upvote count: 2
answer count: 3
downvote count: 0
favorite count: 0
has title: Errors using LibGdx with Google Play Services/BaseGameUtils (Gradle)
has body: I am using Eclipse, LibGdx 1.0.1, Latest Google Play Lib, and Latest BaseGameUtils from https://github.com/playgameservices/android-samples (Gradle Project) My BaseGameUtils has a few errors GameHelper.java // Api options to use when adding each API, null for none GoogleApiClient.ApiOptions mGamesApiOptions = null; //error with this line GoogleApiClient.ApiOptions mPlusApiOptions = null; //error with this line GoogleApiClient.ApiOptions mAppStateApiOptions = null; //error with this line /** * Sets the options to pass when setting up the Games API. Call before * setup(). */ public void setGamesApiOptions(GoogleApiClient.ApiOptions options) { //error with this line doApiOptionsPreCheck(); mGamesApiOptions = options; //error with this line } /** * Sets the options to pass when setting up the AppState API. Call before * setup(). */ public void setAppStateApiOptions(GoogleApiClient.ApiOptions options) { //error with this line doApiOptionsPreCheck(); mAppStateApiOptions = options; //error with this line } /** * Sets the options to pass when setting up the Plus API. Call before * setup(). */ public void setPlusApiOptions(GoogleApiClient.ApiOptions options) { //error with this line doApiOptionsPreCheck(); mPlusApiOptions = options; //error with this line } /** * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally, * you do not have to do this; use this method only if you need to make * nonstandard setup (e.g. adding extra scopes for other APIs) on the * GoogleApiClient.Builder before calling @link{#setup}. */ public GoogleApiClient.Builder createApiClientBuilder() { if (mSetupDone) { String error = "GameHelper: you called GameHelper.createApiClientBuilder() after " + "calling setup. You can only get a client builder BEFORE performing setup."; logError(error); throw new IllegalStateException(error); } GoogleApiClient.Builder builder = new GoogleApiClient.Builder( mActivity, this, this); if (0 != (mRequestedClients &amp; CLIENT_GAMES)) { builder.addApi(Game…
tagged with: android

http://stackoverflow.com/comment/36692772
type: Comment
comment on: http://stackoverflow.com/a/23844333
type: AnswerComment
has text: I made the change, but it's just made it worse. All in all, the variables are still saving, but then upon clicking, carrying on from 1/0, and I can't figure out why.
score: 0

http://stackoverflow.com/comment/36670696
type: QuestionComment
has text: Sounds like this is going to fail - unless the advertisements use a common set of techniques (i.e same classes etc) then I don't see how you can reliably or efficiently do this.
comment on: http://stackoverflow.com/q/23832786
type: Comment
score: 0

http://stackoverflow.com/q/23787381
has comment: http://stackoverflow.com/comment/36585399
tagged with: arrays
has comment: http://stackoverflow.com/comment/36584848
score: 0
has body: I would like to create X button or X textview from a JSON array in an Android application Here my JSON Array which could have X Object : [ {"id":"1","nom":"Caine","prenom":"Horatio"}, {"id":"2","nom":"Taylor","prenom":"Mac"} ] And my Android code that should create X buttons (with this array : X = 2) try{ JSONArray jArray = new JSONArray(myJSONarray); for(int k=0;k&lt;jArray.length();k++){ JSONObject json_data = jArray.getJSONObject(k); Button but = new Button(getBaseContext()); ((LinearLayout)findViewById(R.id.mainLayout)).addView(but, 0); but.setText(json_data.getString("nom")); } }catch(JSONException e){ Log.e("log_tag", "Error parsing data " + e.toString()); } But logcat says : "Unable to launch activity". I don't know what I'm missing, I'm new in Android field. Thanking you in advance EDIT exception strack trace: 05-21 15:26:59.374: D/dalvikvm(1948): GC_EXTERNAL_ALLOC freed 676 objects / 53072 bytes in 135ms 05-21 15:26:59.444: V/GCMRegistrar(1948): Is registered on server: true 05-21 15:26:59.764: D/dalvikvm(1948): GC_FOR_MALLOC freed 2631 objects / 169000 bytes in 35ms 05-21 15:26:59.764: D/AndroidRuntime(1948): Shutting down VM 05-21 15:26:59.774: W/dalvikvm(1948): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 05-21 15:26:59.774: E/AndroidRuntime(1948): FATAL EXCEPTION: main 05-21 15:26:59.774: E/AndroidRuntime(1948): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidexample.gcm/com.androidexample.gcm.MainActivity}: java.lang.NullPointerException 05-21 15:26:59.774: E/AndroidRuntime(1948): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 05-21 15:26:59.774: E/AndroidRuntime(1948): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 05-21 15:26:59.774: E/AndroidRuntime(1948): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 05-21 15:26:59.774: E/AndroidRuntime(1948): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)…
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/36584772
has comment: http://stackoverflow.com/comment/36586219
has comment: http://stackoverflow.com/comment/36585045
has comment: http://stackoverflow.com/comment/36586385
has comment: http://stackoverflow.com/comment/36585521
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36585782
has comment: http://stackoverflow.com/comment/36586163
has comment: http://stackoverflow.com/comment/36585826
has comment: http://stackoverflow.com/comment/36584293
has answer: http://stackoverflow.com/a/23788525
has comment: http://stackoverflow.com/comment/36584238
tagged with: java
has comment: http://stackoverflow.com/comment/36585233
tagged with: android-linearlayout
type: Question
has comment: http://stackoverflow.com/comment/36586164
has title: Create dynamically button/textview in Android Java

http://stackoverflow.com/a/23824154
downvote count: 0
answers question: http://stackoverflow.com/q/23824033
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36656603
type: Answer
has comment: http://stackoverflow.com/comment/36655094
has comment: http://stackoverflow.com/comment/36655073
score: 5
has body: Because the methods are static and therefore the classes need are needed to access them. Basics4.method_Inside_Basics4() So, after you edited a bunch of code ... public class Basics5 extends Basics415{ public static void main(){ // accessing a static method in a static context. Basics415.main_hooo(); // accessing an instance method in a static context. final Basics415 b = new Basics415(); b.main_ho(); } }
accepted answer of: http://stackoverflow.com/q/23824033
has comment: http://stackoverflow.com/comment/36655047
upvote count: 5

http://stackoverflow.com/comment/41860472
type: QuestionComment
score: 1
has text: Or Else try to run using Maven project its too simple if ur using maven u just need to add two things in pom.xml file. 1) add this repository==> xuggle repo http://xuggle.googlecode.com/svn/trunk/repo/share/java/ and one depedency===> xuggle xuggle-xuggler 5.4 . Would u pls share ur mail-id if your not comfortable with maven
comment on: http://stackoverflow.com/q/23784422
type: Comment

http://stackoverflow.com/a/23880212
has comment: http://stackoverflow.com/comment/36761439
upvote count: 1
has comment: http://stackoverflow.com/comment/36761668
has body: If your are familiar with a while loop construct you can take a look at my pseudocode, should be within the constraints of your problem: String text = "texty text text" while(TextHasASapce){ print text up to space set text to equal all text AFTER the space } print ?? Using your two allowed methods the above is convertible line by line to what you are after. Hope it helps.
has comment: http://stackoverflow.com/comment/36761185
has comment: http://stackoverflow.com/comment/36761333
has comment: http://stackoverflow.com/comment/36761752
type: Answer
has comment: http://stackoverflow.com/comment/36761816
answers question: http://stackoverflow.com/q/23879656
downvote count: 0
has comment: http://stackoverflow.com/comment/36761583
score: 1
has comment: http://stackoverflow.com/comment/36761861

http://stackoverflow.com/comment/36712563
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23854500
has text: Go with second solution

http://stackoverflow.com/q/23917407
tagged with: navigation
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/36832239
has answer: http://stackoverflow.com/a/23968104
has title: Buttons within Navigation Drawer
accepted answer: http://stackoverflow.com/a/23968104
has comment: http://stackoverflow.com/comment/36832664
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36833038
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has body: I'm fairly new to Android development, and I'm trying to customize a Navigation Drawer with 4 buttons, which I then want to customize in their looks, similar to what VSCO Cam does, but without the header image and just 4 buttons that take up all the space in the navigation drawer. What I'm doing right now is creating a Drawer Layout using a FrameLayout for the main content and a LinearLayout for the Drawer. I then placed 4 Buttons in that Linear Layout. &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;!-- The main content view --&gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;!-- Sidemenu (Navigation Drawer) --&gt; &lt;LinearLayout android:id="@+id/left_drawer" android:layout_width="240dp" android:orientation="vertical" android:layout_height="match_parent" android:gravity="left"&gt; &lt;Button android:id="@+id/btn_lend_return" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/lend_return"/&gt; &lt;Button android:id="@+id/btn_inv_order" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/manage_inventory"/&gt; &lt;Button android:id="@+id/btn_inventar" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/inventory"/&gt; &lt;Button android:id="@+id/btn_add_user" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/add_user"/&gt; &lt;/LinearLayout&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; For the Java Code: public class MainActivity extends Activity { // constants for db public static final String DATABASE_NAME = "sync_gateway"; public stat…
upvote count: 1

http://stackoverflow.com/q/23826007
tagged with: mapreduce
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/36659635
has body: I'm trying to start a MapReduce job from java. But when I try to submit the job I get Permission Denied exception. I'm able to run hdfs dfs -ls / from command line without any error. But it doesn't work from my java program. Here's my code public static void main(String[] args) { Configuration conf=new Configuration(); conf.set("mapreduce.map.class","org.apache.hadoop.conf.TestMapper"); conf.set("mapreduce.reduce.class","org.apache.hadoop.conf.TestReducer"); conf.set("mapreduce.framework.name","yarn"); conf.set("hadoop.security.group.mapping","org.apache.hadoop.security.ShellBasedUnixGroupsMapping"); conf.set("fs.default.name","hdfs://master:9000"); conf.set("dfs.permission","false"); conf.set("yarn.nodemanager.aux-services","mapreduce_shuffle"); conf.set("yarn.resourcemanager.resource-tracker.address","master:8025"); conf.set("yarn.resourcemanager.scheduler.address","master:8030"); conf.set("yarn.resourcemanager.address","master:8040"); conf.set("yarn.nodemanager.localizer.address","master:8060"); Job job=null; try { job = Job.getInstance(conf, "Test Map Reduce"); job.setJarByClass(RunJob.class); job.setOutputKeyClass(LongWritable.class); job.setOutputValueClass(Text.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); TextInputFormat.setInputPaths(job, new Path("/input.txt")); TextOutputFormat.setOutputPath(job, new Path("/output")); job.submit(); } But I get the following exception org.apache.hadoop.security.AccessControlException: Permission denied: user=manthosh, access=EXECUTE, inode="/tmp":hduser:supergroup:drwxrwx--- The solution here doesn't work. What am I missing?
tagged with: permission-denied
linked to: http://stackoverflow.com/q/11593374
has title: HDFS Permission denied
answer count: 0
has comment: http://stackoverflow.com/comment/36659677
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38183540
type: Question
tagged with: java

http://stackoverflow.com/a/23938245
has body: Declare a CDI bean that will provide this Map for its consumption: @Named @ApplicationScoped public class ApplicationScopedBean { private Map&lt;KeyClass, ValueClass&gt; map; @PostConstruct public void init() { //initialize the map and its data here map = new ConcurrentHashMap&lt;&gt;(); map.put(..., ...); //... } //provide a getter for the map public Map&lt;KeyClass, ValueClass&gt; getMap() { return this.map; } } Now, the bean can be injected in clients and can show the data in your view.
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23938060
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23938060

http://stackoverflow.com/comment/36567666
has text: Es written, I suggest creating a socket handler class for this. You may even create an own socket class extending your socket and create your own identifier in it if you need it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23778205

http://stackoverflow.com/comment/58647005
comment on: http://stackoverflow.com/a/23940095
has text: if data element inside Location data array facility with media info which comes from internet,call `notifyDatasetChanged()`every time will make the app ANR.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23796355
downvote count: 0
has body: Exception handling in Java is about error management. It's a way to gracefully handle errors in your programs. For example, you can use Integer.parseInt() to convert a String to an integer. It throws a NumberFormatException if it cannot parse the String. In that case, you can catch the exception, default the value, and display an appropriate message to the user. And your program will be more robust and elegant.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23796319

http://stackoverflow.com/comment/36750511
comment on: http://stackoverflow.com/q/23874815
score: 0
has text: @Karakuri I was not asking for a lengthy discourse on intents and intent filters. I know that. I am interested in the more hard to understand concepts and differences between intents and events. Please be more constructive in your responses in the future.
type: QuestionComment
type: Comment

web-services
tags question: http://stackoverflow.com/q/23929880
type: Tag
tags question: http://stackoverflow.com/q/23884206
tags question: http://stackoverflow.com/q/23780580
tags question: http://stackoverflow.com/q/23936240
tags question: http://stackoverflow.com/q/23928210
tags question: http://stackoverflow.com/q/23919680
tags question: http://stackoverflow.com/q/23826203
tags question: http://stackoverflow.com/q/23887631
tags question: http://stackoverflow.com/q/23831146
tags question: http://stackoverflow.com/q/23880249
tags question: http://stackoverflow.com/q/23790929
tags question: http://stackoverflow.com/q/23784582
tags question: http://stackoverflow.com/q/23903608
tags question: http://stackoverflow.com/q/23854986
tags question: http://stackoverflow.com/q/23884720
tags question: http://stackoverflow.com/q/23806801
tags question: http://stackoverflow.com/q/23842335
tags question: http://stackoverflow.com/q/23848800
tags question: http://stackoverflow.com/q/23915505
tags question: http://stackoverflow.com/q/23881630
tags question: http://stackoverflow.com/q/23783617
tags question: http://stackoverflow.com/q/23934045
tags question: http://stackoverflow.com/q/23928030
tags question: http://stackoverflow.com/q/23787049
tags question: http://stackoverflow.com/q/23857402
tags question: http://stackoverflow.com/q/23850146
tags question: http://stackoverflow.com/q/23912554
tags question: http://stackoverflow.com/q/23794647
tags question: http://stackoverflow.com/q/23904580
tags question: http://stackoverflow.com/q/23819608
tags question: http://stackoverflow.com/q/23902434
tags question: http://stackoverflow.com/q/23913561
tags question: http://stackoverflow.com/q/23905826
tags question: http://stackoverflow.com/q/23867256
tags question: http://stackoverflow.com/q/23934769
tags question: http://stackoverflow.com/q/23876734
tags question: http://stackoverflow.com/q/23882507
tags question: http://stackoverflow.com/q/23852130
tags question: http://stackoverflow.com/q/23893097
tags question: http://stackoverflow.com/q/23865626
tags question: http://stackoverflow.com/q/23836367
tags question: http://stackoverflow.com/q/23937060
tags question: http://stackoverflow.com/q/23828703
tags question: http://stackoverflow.com/q/23835441
tags question: http://stackoverflow.com/q/23876193
tags question: http://stackoverflow.com/q/23924649
tags question: http://stackoverflow.com/q/23790752
tag name: web-services
tags question: http://stackoverflow.com/q/23909170
tags question: http://stackoverflow.com/q/23866459
tags question: http://stackoverflow.com/q/23814921
tags question: http://stackoverflow.com/q/23933099
tags question: http://stackoverflow.com/q/23805082
tags question: http://stackoverflow.com/q/23861488

http://stackoverflow.com/q/23778808
tagged with: jquery
score: -1
accepted answer: http://stackoverflow.com/a/23778992
answer count: 1
has comment: http://stackoverflow.com/comment/36568810
favorite count: 0
type: AnsweredQuestion
has body: What I'm trying to do today is to directly call a Javascript function from a JSP Servlet response. What does that mean? Here's the code: Servlet, This is contained in myServlet.java // Takes an XML already previously parsed as a string as input CharSequence confirm= "something"; if (xml.contains(confirm)) { // Carry on // If it is contained we needn't go further } else { // "couldn't find confirms content errorMessage = "Does not contain confirm"; // "If ^ quit this servlet" request.setAttribute("rol", this.rol); request.setAttribute("user", this.user); request.setAttribute("errorMessage", errorMessage); forwardToJSP(request, response, "/myJSP.jsp"); } Now In Javascript I already have defined a function I want to be called. It is something along these lines: Javascript, This is contained in myJSP.jsp &lt;script language="JavaScript" type="text/JavaScript"&gt; // Assume all document.getElementById calls are properly implemented, // they call real variables that exist elsewhere, but not shown // here due to irrelevance. window.errorExists = function() { var errorExists = document.getElementById("terror"); errorExists.setAtribute("terror", "Does not contain confirm"); if (errorExists.attributes == "Does not contain confirm"){ if(confirm("Cannot find content, do you wish to add it?")){ anotherFunctionCall(); } else { // Don't do anything } } } &lt;/script&gt; Now, in simple terms what I want to do is to call my Javascript function from the aforementioned JSP. I think cannot do so with work arounds such as: PrintWriter out = response.getWriter(); out.println("&lt;tr&gt;&lt;td&gt;&lt;input type='button' name='Button' value='Search' onclick=\"searchRecord('"+ argument + "');\"&gt;&lt;/td&gt;&lt;/tr&gt;"); Because the other function wouldn't be called, also there's an update to Javascript variables. How would one go around this? Any and all help is greatly appreciated.
tagged with: java
downvote count: 1
tagged with: servlets
type: Question
has title: Call a Javascript function from a JSP Servlet forward
upvote count: 0
has answer: http://stackoverflow.com/a/23778992
tagged with: jsp
has comment: http://stackoverflow.com/comment/36568913
tagged with: javascript

http://stackoverflow.com/comment/36573439
has text: No, I haven't configured it. How can I configure DNS for 1and1? yeah SMTP port is open
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23780543
score: 0

http://stackoverflow.com/comment/36696833
type: AnswerComment
comment on: http://stackoverflow.com/a/23846137
score: 0
type: Comment
has text: Do you know how I can draw my polygon for testing purposes? I tried this: <shapeRenderer.polygon(kid.getVertices()); However it only crashes my program with the following output: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Must call begin(ShapeType.Line) at com.badlogic.gdx.graphics.glutils.ShapeRenderer.polygon(ShapeRenderer.java:1030) at com.badlogic.gdx.graphics.glutils.ShapeRenderer.polygon(ShapeRenderer.java:1023)

http://stackoverflow.com/q/23867633
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36737274
linked to: http://stackoverflow.com/q/9053600
has comment: http://stackoverflow.com/comment/36737159
tagged with: java
upvote count: 1
has title: call Fortran executable file from java in Linux
downvote count: 1
duplicate of: http://stackoverflow.com/q/11203145
type: Question
linked to: http://stackoverflow.com/q/11203145
has comment: http://stackoverflow.com/comment/36737033
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23867701
has body: I have a Fortran exe. What I need to do.... I need to call that exe through java in Linux. After that it should ask for input file and output file. This is my code: Process process = new ProcessBuilder("/home/admin/Documents/file.out", "input","output").start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf("Output of running %s is:", Arrays.toString(args)); while ((line = br.readLine()) != null) { System.out.println(line); } It is running but nit asking for input and output file
has comment: http://stackoverflow.com/comment/36737301
has answer: http://stackoverflow.com/a/23867922

truetype
tags question: http://stackoverflow.com/q/23885962
tag name: truetype
type: Tag

http://stackoverflow.com/a/23822013
has body: I solved my problem with Native2Ascii Maven plugin. This problem was solved by choosing right working directory ('target' directory not 'source') and right phase of plugin execution. 'test' phase works for me. So files are copying in target directory and then converting in ANSI encoding, but original files remain unchanged.Here my configuration: [...] [...] [...] org.codehaus.mojo native2ascii-maven-plugin </executions> native2ascii-utf8-validation test native2ascii UTF8 ValidationMessages*.properties ${basedir}/target/classes/app/validation [...] </executions> [...] [...] [...] [...]
score: 0
answers question: http://stackoverflow.com/q/23798137
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23798137

hql
tags question: http://stackoverflow.com/q/23866709
tag name: hql
tags question: http://stackoverflow.com/q/23851409
tags question: http://stackoverflow.com/q/23801053
tags question: http://stackoverflow.com/q/23882400
tags question: http://stackoverflow.com/q/23867435
tags question: http://stackoverflow.com/q/23804678
tags question: http://stackoverflow.com/q/23841326
tags question: http://stackoverflow.com/q/23835442
type: Tag
tags question: http://stackoverflow.com/q/23904030
tags question: http://stackoverflow.com/q/23867119
tags question: http://stackoverflow.com/q/23878459
tags question: http://stackoverflow.com/q/23904570

http://stackoverflow.com/a/23793045
type: Answer
has body: You could add a mock for myController which would implement the same interface but the mock would just return a file path without any user intervention.
answers question: http://stackoverflow.com/q/23792958
score: 0

http://stackoverflow.com/a/23867616
type: Answer
accepted answer of: http://stackoverflow.com/q/23867424
score: 8
answers question: http://stackoverflow.com/q/23867424
upvote count: 11
type: AcceptedAnswer
has body: String In Java String is a special object and allows you to create a new String without necessarily doing new String("ABC"). However String s = "ABC" and String s = new String("ABC") is not the same operation. From the javadoc for new String(String original): Initializes a newly created String object so that it represents the same sequence of characters as the argument; [...] Unless an explicit copy of original is needed, use of this constructor is unnecessary since Strings are immutable. In other words doing String s = new String("ABC") creates a new instance of String, while String s = "ABC" reuse, if available, an instance of the String Constant Pool. String Constant Pool The String Constant Pool is where the collection of references to String objects are placed. String s = "prasad" creates a new reference only if there isn't another one available. You can easily see that by using the == operator. String s = "prasad"; String s2 = "prasad"; System.out.println(s == s2); // true Image taken from thejavageek.com. new String("prasad") always create a new reference, in other words s and s2 from the example below will have the same value but won't be the same object. String s = "prasad"; String s2 = new String("prasad"); System.out.println(s == s2); // false Image taken from thejavageek.com.
downvote count: 3

http://stackoverflow.com/a/23871285
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23782662
type: AcceptedAnswer
type: Answer
has body: I have same issue, just difference is that i have used Turkish font and that are missing:- please see my answer solution for this Hope helps you Regards,
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23782662

http://stackoverflow.com/comment/36616850
score: 0
has text: So... you've found existing code that does this (in other questions) but found it too hard to understand and you're hoping this can be done in a simpler fashion? Can you point us to some of this code?
type: QuestionComment
comment on: http://stackoverflow.com/q/23804675
type: Comment

http://stackoverflow.com/q/23815933
type: Question
has body: i want to select many items from a list of Utilisateur(Users) but the checkbox is repeated for each line eg:i have 2 Users in Db and this is why it appears that two checkbox on the values ​​of a for each Users for each line of datatble this is my xhtml file: &lt;p:dataTable id="dta" value="#{UtilisateurComponent.listUtilisateurs()}" var="current" rows="15" paginator="true" paginatorPosition="bottom"&gt; &lt;p:column&gt; &lt;h:selectManyCheckbox id="selectUser" value="#{ProjetComponent.projet.utilisateurs}" &gt; &lt;f:selectItems value="#{UtilisateurComponent.listUtilisateurs()}" var="utilisateurs" itemValue="#{utilisateurs.iduser}" itemLabel=""/&gt; &lt;/h:selectManyCheckbox&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{utilisateurmsgs['utilisateur.datederniereconnexion.title']}" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.datederniereconnexion}" converter="dateTimeConverterForCalendar" /&gt; &lt;/p:column&gt; and this the generated form
tagged with: jakarta-ee
tagged with: primefaces
has title: JSF: datatable row manyselect
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23817433
tagged with: web
type: AnsweredQuestion
tagged with: jsf
accepted answer: http://stackoverflow.com/a/23817433
tagged with: java

http://stackoverflow.com/q/23896341
accepted answer: http://stackoverflow.com/a/23896611
score: 2
has title: How to compile a Jenkins workspace to a .jar
downvote count: 0
tagged with: jar
type: Question
type: AnsweredQuestion
answer count: 1
favorite count: 0
has body: I have a Jenkins hooked up with my Git. That works perfectly, it has .git, .settings, bin, src, .classpath, and .project in the job workspace. But what I wanted is, how do I compile all of this to a .jar and send it to a directory using SSH. The SSH part I know how to do, it's just the compiling I don't get. So this is what I want to happen: I build project > gets my git source on bitbucket.org > puts it on workspace > compiles to a .jar > grabs .jar and send it to SSH. Thank you. If you have any questions please ask!
has answer: http://stackoverflow.com/a/23896611
tagged with: jenkins
upvote count: 2
tagged with: git
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36607187
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23799360
has text: Package should contain a content type part [M1.13] will be the error after I remove POIFSFileSystem fs = new POIFSFileSystem(input);
type: AnswerComment

http://stackoverflow.com/a/23837648
type: Answer
answers question: http://stackoverflow.com/q/23837306
has body: I would assume that somewhere in jnlp internals it makes a call to oracle's servers and checks what version is the latest and whether it your currently running version is old. You can inspect the calls with a packet inspector and even try to spoof it to see whether you can circumvent that rather crude security measure.
score: 0

http://stackoverflow.com/comment/60309935
score: 11
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23868969
has text: Fleshing out @jpangamarca's "Oops" above: In the comments on the duplicate question he linked, Brian Goetz confirmed that `Runnable` was intended to be used for this purpose, not just for threading contexts.

http://stackoverflow.com/q/23845288
tagged with: java
accepted answer: http://stackoverflow.com/a/23846674
has comment: http://stackoverflow.com/comment/36694229
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36694212
type: AnsweredQuestion
downvote count: 0
tagged with: layout-manager
score: 1
has comment: http://stackoverflow.com/comment/36696721
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36694185
has answer: http://stackoverflow.com/a/23846674
tagged with: netbeans
has title: How to handle org.netbeans.* under Eclipse
has body: I'm trying to migrate from netbeans to eclipse and I have this line which I couldn't be able to know how to change it : org.netbeans.lib.awtextra.AbsoluteLayout() How do I to fix this line to make it work under Eclipse, please?
has comment: http://stackoverflow.com/comment/36694170
upvote count: 1
tagged with: swing
answer count: 1

http://stackoverflow.com/q/23856838
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/36716831
has comment: http://stackoverflow.com/comment/36716935
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/36716868
has answer: http://stackoverflow.com/a/24110538
type: Question
has title: Android Application Crashes on login and register
has comment: http://stackoverflow.com/comment/36716923
tagged with: database
has comment: http://stackoverflow.com/comment/36717542
score: 0
has comment: http://stackoverflow.com/comment/36717021
answer count: 1
has comment: http://stackoverflow.com/comment/36717145
type: UnansweredQuestion
has body: I need help in my application, it's for school project. In that application I want to do login and registration but whenever I press the login and register new account buttons, it crash the whole application. I'm using wamp 2.5 as server. loginactivity.java package com.yang.hotelreceptiondemo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.yang.hotelreceptiondemo.library.UserFunctions; public class LoginActivity extends Activity { public Button btnLogin; Button btnLinkToRegister; EditText inputEmail; EditText inputPassword; public TextView loginErrorMsg; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); // Importing all assets like buttons, text fields inputEmail = (EditText) findViewById(R.id.loginEmail); inputPassword = (EditText) findViewById(R.id.loginPassword); btnLogin = (Button) findViewById(R.id.btnLogin); btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen); loginErrorMsg = (TextView) findViewById(R.id.login_error); // Login button Click Event btnLogin.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String email = inputEmail.getText().toString(); String password = inputPassword.getText().toString(); UserFunctions userFunction = new UserFunctions(); Log.d("Button", "Login"); new LoginAsyncTask(LoginActivity.this, userFunction).execute( email, password); btnLogin.setEnabled(false); } }); // Link to Register Screen btnLinkToRegister.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent i = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(i); finish(); } }); } } LoginAsyncTask.java package com.yang.hotelreceptiondemo; import org.json.JSONException; import org.json.JSONObject; import …

http://stackoverflow.com/comment/36753621
score: 2
comment on: http://stackoverflow.com/a/23875709
type: AnswerComment
has text: `try { if(!tr.isActive()) tr.begin(); entityManager.persist(entity); tr.commit(); } catch (Exception e) { tr.rollback(); }`
type: Comment

http://stackoverflow.com/comment/36752808
type: Comment
comment on: http://stackoverflow.com/q/23829520
has text: Those are two distinct signing operations (technically time stamping is a special case of signing) one of which has to follow the other. Thus, the initial operation always cam be separated, so not atomic.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23837232
has comment: http://stackoverflow.com/comment/36679048
score: 3
has body: I have an array ArrayList myArray = new ArrayList(); No, you don't have an array. Arrays are declared using brackes [], like this: int[] myArray; You have an object of ArrayList class. This object will use an array internally to store the data and dynamically change the array for a newer one when needs to assign more values. then I add something to it like this myArray.add(new myArray(1, 2, 3)); Conceptually, this is wrong and won't even compile. If you want to add more than one value in your array, you should use ArrayList#addAll method, that receives another collection. Then, you have two ways to pass a Collection in one statement: Create a list using Arrays#asList: myArray.addAll(Arrays.asList(1, 2, 3)); You can use double brace initialization: myArray.addAll(new ArrayList() {{ add(1); add(2); add(3); }}); You should take into account that you should specify the generic for your ArrayList instead of using raw data: ArrayList&lt;Integer&gt; myArray = new ArrayList&lt;Integer&gt;(); myArray.addAll(new ArrayList&lt;Integer&gt;() {{ add(1); add(2); add(3); }}); More info: Java Tutorial. Collections Initialization of an ArrayList in one line Note that if you have an ArrayList that is tied to a custom class, let's say ArrayList&lt;SomeClass&gt; myArrayList, then the compiler prevents you to add elements to the list that doesn't pass the IS-A test (noted by instanceof operator), so this code: ArrayList&lt;SomeClass&gt; myArrayList = new ArrayList&lt;SomeClass&gt;(); myArrayList..addAll(new ArrayList&lt;Integer&gt;() {{ add(1); add(2); add(3); }}); Won't be able to compile since Integer is not a SomeClass. Similar with this piece of code: ArrayList&lt;SomeClass&gt; myArrayList = new ArrayList&lt;SomeClass&gt;(); myArray.add(Arrays.asList(1, 2, 3)); But due to type erasure you can trick the compiler by using raw types. For example: public void addData(ArrayList yourArrayList, Object anyData) { yourArrayList.add(anyData); } Then in your code, you call this method: ArrayLis…
has comment: http://stackoverflow.com/comment/36679214
accepted answer of: http://stackoverflow.com/q/23837205
has comment: http://stackoverflow.com/comment/36679003
has comment: http://stackoverflow.com/comment/36678989
has comment: http://stackoverflow.com/comment/36679185
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23837205
has comment: http://stackoverflow.com/comment/36679251
type: Answer
has comment: http://stackoverflow.com/comment/36679032
upvote count: 3
has comment: http://stackoverflow.com/comment/36679069

http://stackoverflow.com/q/23859568
tagged with: rest
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/23968292
score: 0
tagged with: java
answer count: 2
has body: I'm using AndroidAnnotations to build a Rest for an Android Application. On the Serverside im using PHP, which send a json looking like : {"tag":"register","success":0,"error":2,"msg":"User already existed","body":[]} I have two POJOS : User.java: public class User implements Serializable { private String name; private String email; private String password; //getter and setter Methods } Response.java: public class RegistrationResponse implements Serializable { private String tag; private int success; private int error; private String msg; private String body; //getter and setter Methods } Rest Client: @Rest(rootUrl = "http://my.domain.com", converters = { MappingJacksonHttpMessageConverter.class, StringHttpMessageConverter.class, GsonHttpMessageConverter.class }, interceptors = { MyInterceptor.class }) public interface RestClient extends RestClientErrorHandling { @Post("/user/register/{name}/{email}/{pass}") @Accept(MediaType.APPLICATION_JSON_VALUE) Response sendUserRegistration(User user, String name, String email, String pass); RestTemplate getRestTemplate(); } Activity.java: //User and Response are POJOs Response result = RestClient.sendUserRegistration(user, user.getName(),user.getEmail(),user.getPassword()); But i got an Null Pointer Exception error on Activity.java. But if i change the return value of "sendUserRegistration" function to String all work. So my "Response" POJO seems not to be converted from AndroidAnnotations. How can i convert the Rest Response to my "Response"-POJO using AndroidAnnotations?
has answer: http://stackoverflow.com/a/24049554
tagged with: android-annotations
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23968292
has title: How to parse JSON Response to POJO with AndroidAnnotations?
accepted answer: http://stackoverflow.com/a/24049554

http://stackoverflow.com/a/23932164
score: 0
accepted answer of: http://stackoverflow.com/q/23931266
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23931266
type: Answer
has body: You have to call getText() when you are clicking the ViewLineNumbers menue item. I modified your code. Check it. public class ViewLineNumbs extends javax.swing.JFrame { int i=0; JTextArea tx,lines; JScrollPane scrollpane; public ViewLineNumbs() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); Create = new javax.swing.JMenuItem(); ViewLineNumbers = new javax.swing.JCheckBoxMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); Create.setText("Create"); Create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CreateActionPerformed(evt); } }); jMenu1.add(Create); ViewLineNumbers.setSelected(true); ViewLineNumbers.setText("ViewLineNumbers"); ViewLineNumbers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ViewLineNumbersActionPerformed(evt); } }); jMenu1.add(ViewLineNumbers); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE) ); pack(); }// &lt;/editor-fold&gt; private void CreateActionPerformed(java.awt.event.ActionEvent evt) { final JInternalFrame internalFrame = new JInternalFrame(""); i++; internalFrame.setName("Document"+i); inte…

http://stackoverflow.com/q/23892020
has body: I have tons of tests that run as JUnit tests in my eclipse. Iv'e just upgraded to spring 4.0.3 from spring 3.X and whenever i try to execute a junit test i get an immidiate exception : java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:126) at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:137) at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:137) at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:96) at org.springframework.test.context.ContextLoaderUtils.resolveActiveProfiles(ContextLoaderUtils.java:499) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:722) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:656) at org.springframework.test.context.DefaultTestContext.&lt;init&gt;(DefaultTestContext.java:93) at org.springframework.test.context.TestContextManager.&lt;init&gt;(TestContextManager.java:119) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:120) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.&lt;init&gt;(SpringJUnit4ClassRunner.java:109) 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 org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java…
tagged with: spring
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/23789271
tagged with: eclipse
tagged with: gradle
type: Question
duplicate of: http://stackoverflow.com/q/23789271
has comment: http://stackoverflow.com/comment/36783816
score: 0
has comment: http://stackoverflow.com/comment/36784623
tagged with: junit
has title: Junit 4 tests doesn't run after upgrading to spring 4.0.3
type: UnansweredQuestion

http://stackoverflow.com/a/23916344
score: 1
has comment: http://stackoverflow.com/comment/36910316
has comment: http://stackoverflow.com/comment/36893592
downvote count: 0
has comment: http://stackoverflow.com/comment/36831561
type: Answer
has body: There are at least two problems: In the context of an anonymous inner class (like new View.OnClickListener()), this refers to the instance of the inner class. The ArrayAdapter constructor needs a Context, so you must use MainActivity.this instead. The type parameter of ArrayAdapter&lt;T&gt; must be the item type. So in this case, it should be ArrayAdapter&lt;Presentation&gt;. So: List&lt;Presentation&gt; list = db.getAllPresentations(); ListView l = (ListView)findViewById(R.id.list); l.setAdapter(new ArrayAdapter&lt;Presentation&gt;(MainActivity.this, R.layout.view_presentation, list));
has comment: http://stackoverflow.com/comment/36830517
upvote count: 1
answers question: http://stackoverflow.com/q/23916295

http://stackoverflow.com/comment/36796914
type: QuestionComment
comment on: http://stackoverflow.com/q/23898350
has text: you really need to start with java101, and don't skip the chapter on static fields.
type: Comment
score: 0

http://stackoverflow.com/comment/36753623
type: QuestionComment
has text: Uhm.. because fiering a click event on a already selected button would be quite redundant :P, All the function does is changeing the radio state. It's used for my edit tests where I make use changes in my form are saved, radio states are among those things.
comment on: http://stackoverflow.com/q/23874015
score: 0
type: Comment

http://stackoverflow.com/comment/36748117
comment on: http://stackoverflow.com/q/23873507
type: Comment
type: QuestionComment
has text: i mean in the row that i pressed the edit button
score: 0

http://stackoverflow.com/a/23856347
type: Answer
has body: From your code, looks like all the components are in your fragment_main layout. delete the code i.e., method onCreateView (.....) on the top and paste the entire stuff in the bottom onCreateView like this. You cannot have 2 onCreateView methods defined in your java code. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); counter=0; add = (Button) rootView.findViewById(R.id.bAdd); subtract = (Button) rootView.findViewById(R.id.bSub); display = (TextView) rootView.findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter++; display.setText("Your total is " + counter); } }); subtract.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter--; display.setText("Your total is" + counter); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); } return rootView; }
answers question: http://stackoverflow.com/q/23856043
score: 0

http://stackoverflow.com/comment/36866155
comment on: http://stackoverflow.com/a/23911243
type: Comment
score: 1
has text: Really sounds like you need either a separate config xml for these tests, or if you're doing true unit testing, provide mocks for the objects you're not directly testing. Not sure there's more I can do to assist.
type: AnswerComment

http://stackoverflow.com/q/23779340
has title: How to properly wait for user input?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36574906
downvote count: 0
tagged with: wait
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36593657
tagged with: android
has comment: http://stackoverflow.com/comment/36570058
has answer: http://stackoverflow.com/a/23782312
has comment: http://stackoverflow.com/comment/36570294
has comment: http://stackoverflow.com/comment/36569748
has body: I've got several buttons in my Activity and I have to wait until one of them is pressed. I was thinking about something like while(CONDITION_IS_NOT_TRUE); So basically I could change condition in OnClickListeners of buttons, which means once you press button, code will continue to execute. But is it OK to do it like that? Is there better or more proper way to do it? I write some of my code to give you idea what I'm trying to do: while(TRUE){ if(CONDITION_1){ setContentView(view1); else if(CONDITION_2){ setContentView(view2); button.setOnClickListener... } //Now I need to wait until condition is not true, while(CONDITION_IS_NOT_TRUE); }
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36569682
tagged with: conditional-statements
tagged with: java

catch-block
tag name: catch-block
type: Tag
tags question: http://stackoverflow.com/q/23866315

http://stackoverflow.com/comment/36631402
has text: Btw if your program has "A LOT of math" as you said, you should change your Double to BigDecimal anyway (If you take care of the correct results)
comment on: http://stackoverflow.com/q/23812067
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23839694
answers question: http://stackoverflow.com/q/23828085
score: 76
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/122701833
upvote count: 76
has comment: http://stackoverflow.com/comment/60051071
type: Answer
has comment: http://stackoverflow.com/comment/70559803
downvote count: 0
has body: An "error in opening zip file" tends to mean that a file that Gradle has downloaded has somehow become corrupted -- this might be the download of Gradle itself (which the wrapper does), or a dependency that Gradle has downloaded to run your build. Gradle doesn't attempt to detect or resolve the problem, so you need to fix it manually. The solution is often to purge Gradle's download caches and let it get fresh copies of what it needs. To do that, delete the .gradle directories in both your home directory and in your project's root directory and try building again.
has comment: http://stackoverflow.com/comment/37935120
has comment: http://stackoverflow.com/comment/72076252
accepted answer of: http://stackoverflow.com/q/23828085

http://stackoverflow.com/a/23856761
answers question: http://stackoverflow.com/q/23856264
score: 0
type: Answer
has body: I assume you are trying to avoid repetition of random number when your method is invoked, why don't you try with SecureRandom which is better than Random as it provides a cryptographically strong random number generator.

http://stackoverflow.com/a/23909417
type: Answer
answers question: http://stackoverflow.com/q/23909205
has body: Your probably need to setBorderPainted to false. Refer http://docs.oracle.com/javase/8/docs/api/javax/swing/JProgressBar.html#setBorderPainted-boolean-
score: 0

http://stackoverflow.com/q/23924544
has comment: http://stackoverflow.com/comment/36845933
has comment: http://stackoverflow.com/comment/36846097
has comment: http://stackoverflow.com/comment/36845931
downvote count: 2
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/23924721
favorite count: 0
has title: what's wrong with this HQL query?
has answer: http://stackoverflow.com/a/23924721
has comment: http://stackoverflow.com/comment/36846053
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: hibernate
has body: I have a ManyToMany relationship between Utilisateur and Projet and I want to extract all users not existing in the project entity and the users assigned to a "Terminé" (value of statut:Projet property) project then this is my query: select u from Utilisateur u left join u.projets p where p is null and p.statut like 'Terminé' generated sql query : Hibernate: select utilisateu0_.iduser as iduser5_, utilisateu0_.datederniereconnexion as datedern2_5_, utilisateu0_.email as email5_, utilisateu0_.grade as grade5_, utilisateu0_.login as login5_, utilisateu0_.mdp as mdp5_, utilisateu0_.nomuser as nomuser5_, utilisateu0_.tel as tel5_ from public.utilisateur utilisateu0_ left outer join projet_utilisateur projets1_ on utilisateu0_.iduser=projets1_.utilisateurs_iduser left outer join public.projet projet2_ on projets1_.projets_idprojet=projet2_.idprojet where (projet2_.idprojet is null) and (projet2_.statut like 'Terminé') This is my Projet Entity: @Entity public class Projet implements Serializable { @Column(name = "idprojet", nullable = false) @Id @GeneratedValue(strategy=GenerationType.IDENTITY) Integer idprojet; String statut; @ManyToMany( mappedBy="projets", fetch = FetchType.LAZY) List&lt;Utilisateur&gt; utilisateurs; } and this is the Utilisateur Entity: @Entity public class Utilisateur implements Serializable { @Column(name = "iduser", nullable = false) @Id @GeneratedValue(strategy=GenerationType.IDENTITY) Integer iduser; @ManyToMany(fetch = FetchType.LAZY) @JoinTable( schema = "public", name = "join_membre_projet", joinColumns = { @JoinColumn( name = "iduser", referencedColumnName = "iduser", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn( name = "idprojet", referencedColumnName = "idprojet", nullable = false, updatable = false) }) List&lt;Projet&gt; projets; } the problem is it does not show any user
has comment: http://stackoverflow.com/comment/36846149
has comment: http://stackoverflow.com/comment/36846085
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36845883
score: -2
tagged with: jpa

http://stackoverflow.com/comment/36856264
type: Comment
type: QuestionComment
score: 2
has text: it's a catch statement. what is in that block, will be executed if either a ClassNotFoundException or an IOException is thrown within the try block
comment on: http://stackoverflow.com/q/23930545

http://stackoverflow.com/a/23801377
score: 0
has body: As you don't want to test the Activity but rather the business logic, you could factor out the receiving of the String to an own class and test this class instead in an isolated way where you don't have any Android specifics around. For example, you could write a POJO class ServerValidator which receives a String and returns a boolean value and you use this validator in your activity and can test it without needing any Android surroundings. public class ServerValidator { public static boolean validate(String input) { return ...; // Insert validation logic } } public class ServerValidatorTest { @Test public void testValidateFailure() { final String faultyString = ...; Assert.assertFalse(ServerValidator.validate(faultyString)); } @Test public void testValidateSuccessful() { final String correctString = ...; Assert.assertTrue(ServerValidator.validate(correctString)); } }
type: Answer
answers question: http://stackoverflow.com/q/23801281

http://stackoverflow.com/comment/37043652
comment on: http://stackoverflow.com/a/23932324
score: 1
has text: That's my golden rule, yes. The one-to-many side may be LAZY but for large collections you will eventually have to fetch it somehow and that's going to put a toll on the overall application performance. So better not to map it at all.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/87617135
has text: I think one of the reasons this issue comes up is that, in principle, a lambda expression behaves exactly like any other object, so we don't need to know which objects are lambdas. In practice, there are certain situations where lambdas (and anonymous classes) don't behave like other objects, and one of them is garbage collection.
comment on: http://stackoverflow.com/a/23870800
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36667512
type: Comment
has text: My code is like : ((JavascriptExecutor) driver).executeScript("window.scrollTo(0,"+i+""); and i increments in a for loop
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23831229

http://stackoverflow.com/q/23873341
has body: I was curious if it is possible to run a project in a different desktop by just downloading the source folder and setting it as the workspace? If possible, how can I run it? When I try, an ant-builder shows up when running it. Any help would be nice, Thank you.
favorite count: 0
has answer: http://stackoverflow.com/a/23873374
has answer: http://stackoverflow.com/a/23873546
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/58053602
tagged with: antbuilder
score: 1
upvote count: 1
type: Question
has title: Is it possible to run a program by downloading the source folder in eclipse?
tagged with: java
has answer: http://stackoverflow.com/a/23873535
tagged with: eclipse
answer count: 3
downvote count: 0
tagged with: runtime

http://stackoverflow.com/a/23783241
answers question: http://stackoverflow.com/q/23783052
has body: This shall work for you: for (int i = 0; i &lt; array.length/3; ++i) { for (int k = 0; k &lt; 3; ++k) { result[i][k] = args[i*3+k]; } } Here we are computing the source index array based on i*3+k to keep on getting the next index value.
type: Answer
accepted answer of: http://stackoverflow.com/q/23783052
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23852914
has answer: http://stackoverflow.com/a/26622444
upvote count: 3
tagged with: maven
tagged with: spring
accepted answer: http://stackoverflow.com/a/23852968
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23853087
tagged with: java
tagged with: hibernate
type: Question
possible better answer: http://stackoverflow.com/a/23853087
answer count: 3
downvote count: 0
favorite count: 0
has title: Spring Test fails: java.lang.NoClassDefFoundError: org/springframework/cglib/transform/impl/MemorySafeUndeclaredThrowableStrategy
has answer: http://stackoverflow.com/a/23852968
has body: I am using spring-data for persisting entities The classes look like @Repository public interface NetworkRepository extends JpaSpecificationExecutor<Network>, JpaRepository<Network, Long> { } and NetworkRepositoryService as import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.org.comma.persistence.entities.Network; import com.org.comma.persistence.repository.NetworkRepository; @Service @Transactional public class NetworkRepositoryService { @Autowired NetworkRepository networkRepository; @Nonnull public Network save(@Nonnull final Network network) { return networkRepository.save(network); } } The @Test looks like @ActiveProfiles("development") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {H2DatabaseConfig.class}) public class NetworkRepositoryTest { @Autowired NetworkRepositoryService networkRepositoryService; @Test public void testAllNetworks() { final Network network = new Network(1, "US", true, DateTime.now()); { final Network networkInDb = networkRepositoryService.save(network); assertNotNull(networkInDb.getId()); } { // final List<Network> networks = networkRepository.findAll(); final List<Network> networks = Collections.emptyList(); assertFalse(networks.isEmpty()); assertEquals(1, networks.size()); assertEquals(network.getNetworkId(), networks.get(0).getNetworkId()); assertEquals(network.getName(), networks.get(0).getName()); assertEquals("Network must be active", network.isActive(), networks.get(0).isActive()); assertEquals(network.getCreatedAt(), networks.get(0).getCreatedAt()); assertNull(networks.get(0).getCreatedBy()); assertNull(networks.get(0).getUpdatedAt()); assertNull(networks.get(0).getUpdatedBy()); } } } The dependencies looks as parent pom org.springframework spring-core 4.0.3.RELEASE org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final joda-time joda-time 2.3 com.google.code.fi…

http://stackoverflow.com/comment/36615103
score: 1
has text: In the if block instead of getText() use getAttribute("value"). If you want to get the text from editBox then you should use this and not getText. Also I see there is ID for all the fields. Use ID instead of xpath. Reserve xpath only for dynamic scenarios.
comment on: http://stackoverflow.com/q/23799986
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24019394
has body: You can add the @javax.persistence.OrderBy annotation on your @OneToMany field. For example, if you have a position field on your FinalMark entity, you could order on that field with this code : @Entity public class Card extends Model { ... @OneToMany(mappedBy = "card") @OrderBy("position asc") public List&lt;FinalMark&gt; finalMarks; ... }
type: Answer
accepted answer of: http://stackoverflow.com/q/23925538
downvote count: 0
answers question: http://stackoverflow.com/q/23925538
score: 10
upvote count: 10
type: AcceptedAnswer

http://stackoverflow.com/q/23782548
has comment: http://stackoverflow.com/comment/36577857
tagged with: maximize
tagged with: java
tagged with: minimize
has body: Im making a quiz application. And when a team pushed their button, they aren't allowed to still see the question or see the video/audio piece. This kind of information is displayed in the quizview ( this is a jpanel ) added to a parent JFrame. What i'm trying to do is minimize the JFrame when a button is pushed from the teams. This works perfectly. If a button is pushed the administator get a pop up in his view. If the answer is incorrect the JFrame should be maximized again. So when he pushes a button if the answer is incorrect, a boolean will be set on true in the quiz model ( $maximize ). We update the views then. In the update of the view im checking if the boolean is set on true. If it is true, i call the maximize method. And maximize it again when the answer is wrong. Minimizing works perfectly, but maximizing not. Anyone knows what's wrong? This is my code in the view, this view is a JPanel in the bigger JFrame, where the maximizing happens : public void update(Observable arg0, Object arg1) { $question = (Question) arg1; if(((QuizModel) getModel()).getMaximize()) /* Only maximize the JFrame when needed */ maximizeFrame(); /* Maximize the frame first */ repaint(); } /** * Maximize the parent JFrame so the teams can see the question */ protected void maximizeFrame() { System.out.println("MAXIMIZE"); JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); topFrame.setState(JFrame.MAXIMIZED_BOTH); } The minimizing occurs when a team pushed their button, here is the code : /** * If a button gets pressed we call this function * @param team the team that pressed their button */ protected void buttonPressed(int team) { /* Check if a button is pressed */ if(((QuizModel) getModel()).getTeamPressed() &gt; 0) $isPressed = true; else $isPressed = false; /* If there hasn't been pressed yet and the question is not null */ if(!$isPressed &amp;&amp; $question != null){ minimizeFrame(); /* Minimize the frame */ /* If this question has a media path we need to pause t…
has comment: http://stackoverflow.com/comment/36581307
has comment: http://stackoverflow.com/comment/36577428
type: Question
has comment: http://stackoverflow.com/comment/36575695
linked to: http://stackoverflow.com/q/5258207
has comment: http://stackoverflow.com/comment/36575519
has title: Minimize/maximize parent JFrame
score: -1
tagged with: parent-child
has answer: http://stackoverflow.com/a/23803550
accepted answer: http://stackoverflow.com/a/23803550
has comment: http://stackoverflow.com/comment/36576337
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36575584
has comment: http://stackoverflow.com/comment/36575511
favorite count: 0
has comment: http://stackoverflow.com/comment/36575619
has comment: http://stackoverflow.com/comment/36575628
has comment: http://stackoverflow.com/comment/36576636
has comment: http://stackoverflow.com/comment/36575477
tagged with: swing
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/23914839
has body: I had a problem with a Form Field (Transient wicket form field ignored) and I had no much luck with the answers, so I made some changes and now the field is sometimes updated, and sometimes not... here's the current code: The User entity: @Entity(name = "user") @Audited public class User extends DataObjectAudit { private static final long serialVersionUID = 1L; private RoleTypeEnum role = null; public RoleTypeEnum getRole() { return role; } public void setRole(RoleTypeEnum role) { this.role = role; } } And in the panel, there is a drop down panel (extends GenericPanel) and the options possible are the current active role of the user is loaded among with the "lower" possible roles. The chosen option should be loaded into the "role" property. User sessionUser = StudySession.getSessionUser(); List&lt;RoleTypeEnum&gt; roles = new ArrayList&lt;RoleTypeEnum&gt;(); roles.addAll(sessionUser.getRole().getLowerAndEqualsThanSelf()); WefDropDownPanel&lt;RoleTypeEnum&gt; role = new WefDropDownPanel&lt;RoleTypeEnum&gt;(helper.of(RoleTypeEnum.class, "role").errorRequired(), roles).setSizes(Size.S0, Size.S1, Size.S4); add(role); There is no validation for that field, others have though. The only thing that is made before saving the form is: @Override protected void onBeforeSave(AjaxRequestTarget target, WefForm&lt;User&gt; form) { User user = getModelObject(); DataService dataService = ServiceFactory.getBean(DataService.class); ProjectCenter projectCenter = dataService.findUniqueByParameters(ProjectCenter.class, new Parameter&lt;Object&gt;("center", user.getCenter())); if (projectCenter != null) { user.setProject(projectCenter.getProject()); } } So the result is that sometimes "role" is updated, and sometimes it is not... Also, all the other fields (that I have erased to simplify) are also being ignored... If I erase the onBeforeSubmit method, the result is the same... sometimes the entity is updated with the values the user entered, sometimes not... The funny thing is that sometim…
tagged with: forms
has answer: http://stackoverflow.com/a/23930134
type: Question
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/23865997
tagged with: wicket
has title: Wicket Form changes randomly being ignored
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/23891390
answers question: http://stackoverflow.com/q/23891087
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36782420
has comment: http://stackoverflow.com/comment/36782535
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36784243
has body: What I've seen commonly is a pattern like this: public class A{ A(int a){ ... } } abstract class B extends A{ B(int a) {// "proxy" constructor" super(a); } } public class C extends B{ C(int a) { super(a); } void myMethod(int a){ // super(a); &lt;- note this is invalid code, you can only call this from the constructor new C(0); // &lt;-- this is valid } } Granted, it's a bit verbose and boilerplate-y, but it allows you to avoid duplicating any functionality
has comment: http://stackoverflow.com/comment/36784135
has comment: http://stackoverflow.com/comment/36782243
accepted answer of: http://stackoverflow.com/q/23891087

http://stackoverflow.com/a/23796809
downvote count: 0
has body: System.out.println() can be assigned a lower priority than other types of output, and get printed after them, even if they are called before. It depends on what you are running your program on. For example, in my setup, if I print something then throw an exception, the exception can come before the printed content.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23796620

http://stackoverflow.com/q/23807492
has comment: http://stackoverflow.com/comment/36622701
has answer: http://stackoverflow.com/a/23808047
score: 0
has body: I want to parse a document and extract each element of a numbered list for example I have this: 1. I like to blah and blah 2. But also to blah and blah I would like to extract each element from the list like [1. text for item1, 2. text from item2] I used a regular expression like this "[0-9].*;" before because I though each list item ended with ; but that is not always true. So I would like a regex to extract the text without it ending with ";". This is what I tried: String regexLineNumber = "[0-9]..*;"; String[] splitted = inputData.split(regexLineNumber);
upvote count: 1
has comment: http://stackoverflow.com/comment/36622441
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36622564
has comment: http://stackoverflow.com/comment/36622037
has comment: http://stackoverflow.com/comment/36621911
accepted answer: http://stackoverflow.com/a/23808047
answer count: 2
possible better answer: http://stackoverflow.com/a/23808015
has answer: http://stackoverflow.com/a/23808015
has title: Java Regex Numbered multiline list
tagged with: regex
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/36662479
has text: It certainly will not. As you can see, the XPath in the first part uses the day element, in the second part the night element. This will never return the same element. Please also clarify your question. Please give example output for your example input. It is unclear to me how you want to identify the place (based on the name? based on the position?) and what your problem is using tempmin/tempmax. This should be a simple axis step
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23825466
score: 0

http://stackoverflow.com/comment/36752281
has text: i put the column userCol but when i'm not remember this error when runing
type: Comment
comment on: http://stackoverflow.com/q/23874795
score: 0
type: QuestionComment

http://stackoverflow.com/q/23791394
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36596364
type: Question
tagged with: jframe
has title: choosing the best Layout for this jframe
has body: plz can any one help me to choose the best Layout to make this window
answer count: 2
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23798813
has comment: http://stackoverflow.com/comment/36592096
tagged with: java
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/23797694
has answer: http://stackoverflow.com/a/23797694
tagged with: layout-manager
has answer: http://stackoverflow.com/a/23798813
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/23913598
answers question: http://stackoverflow.com/q/23913481
has comment: http://stackoverflow.com/comment/36826106
has comment: http://stackoverflow.com/comment/36825617
accepted answer of: http://stackoverflow.com/q/23913481
has comment: http://stackoverflow.com/comment/36826907
has comment: http://stackoverflow.com/comment/36825874
score: 2
type: AcceptedAnswer
downvote count: 0
has body: You do this by appending the literal, e.g. "Trentino", to the dbpedia URL "http://dbpedia.org/resource/" => http://dbpedia.org/resource/Trentino . As some literals won't yield any result, e.g. "http://dbpedia.org/resource/TrentinoAltoAdige", you want to pre-process your data. In your case, alter the literal to "http://dbpedia.org/resource/Trentino_Alto_Adige" (see the pattern: insert a '_' before uppercase characters besides it's the first character). Interlink your data with property e.g. rdf:seeAlso or, if you want link to wikipedia, e.g. &lt;http://purl.org/ontology/mo/wikipedia&gt;.
type: Answer
has comment: http://stackoverflow.com/comment/36826498
upvote count: 2
has comment: http://stackoverflow.com/comment/36825100

http://stackoverflow.com/comment/36874668
type: Comment
has text: Find a way using JavaScript [GitHub - getWeek.js](https://gist.github.com/dblock/1081513l) and call from GWT JSNI.
type: QuestionComment
comment on: http://stackoverflow.com/q/23938938
score: 0

http://stackoverflow.com/comment/36708915
has text: And **what is `FontManager`**?
score: 0
comment on: http://stackoverflow.com/q/23848469
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36641599
has text: First I did discourage you for using null layouts, you don't control many of the rendering differences between different systems that can change the size of individual components. You could try writing your content out as HTML or implement your own markup language
score: 2
comment on: http://stackoverflow.com/q/23817482
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23915520
type: Answer
has comment: http://stackoverflow.com/comment/36829596
has body: The code is missing surrounding braces({..}): params[1] = "{print \"1\" $0}";
score: 2
accepted answer of: http://stackoverflow.com/q/23915478
upvote count: 2
has comment: http://stackoverflow.com/comment/36829904
answers question: http://stackoverflow.com/q/23915478
has comment: http://stackoverflow.com/comment/36830094
has comment: http://stackoverflow.com/comment/36830009
has comment: http://stackoverflow.com/comment/36828870
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36852875
has comment: http://stackoverflow.com/comment/36848993

http://stackoverflow.com/comment/36711145
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23844561
type: QuestionComment
has text: I don't want id to be visible.

http://stackoverflow.com/comment/36687691
type: AnswerComment
score: 0
type: Comment
has text: @Chiquelo I'm tweaking the functionality of the `SelendroidDriver` class when I change the mentioned constant fields to something else. That's what I'm pointing to as a poor workaround. @SiKing I'm not very well-versed with Java. Started working on this project a week back. I guess the word import is wrong to use here. I meant using the mentioned .java files to rule out the dependencies.
comment on: http://stackoverflow.com/a/23831018

http://stackoverflow.com/comment/36808610
score: 0
has text: is the second parameter of createChain a Order. `<T extends A> T createChain(Class<? extends A>[] chainOrder, Order chainType)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23901814

error-handling
tags question: http://stackoverflow.com/q/23890957
tag name: error-handling
tags question: http://stackoverflow.com/q/23875725
tags question: http://stackoverflow.com/q/23813611
type: Tag

http://stackoverflow.com/comment/36616764
score: 1
comment on: http://stackoverflow.com/q/23804645
type: Comment
type: QuestionComment
has text: @Macrosoft-Dev All arguments are passed by value, even references are passed by value.

spring
tags question: http://stackoverflow.com/q/23938043
tags question: http://stackoverflow.com/q/23826192
tags question: http://stackoverflow.com/q/23854668
tags question: http://stackoverflow.com/q/23863401
tags question: http://stackoverflow.com/q/23913665
tags question: http://stackoverflow.com/q/23834575
tags question: http://stackoverflow.com/q/23839001
tags question: http://stackoverflow.com/q/23857197
tags question: http://stackoverflow.com/q/23853524
tags question: http://stackoverflow.com/q/23875007
tags question: http://stackoverflow.com/q/23920284
tags question: http://stackoverflow.com/q/23930042
tags question: http://stackoverflow.com/q/23915524
tags question: http://stackoverflow.com/q/23791195
tags question: http://stackoverflow.com/q/23910663
tags question: http://stackoverflow.com/q/23894640
tags question: http://stackoverflow.com/q/23829716
tags question: http://stackoverflow.com/q/23789437
tags question: http://stackoverflow.com/q/23810352
tags question: http://stackoverflow.com/q/23834266
tags question: http://stackoverflow.com/q/23899406
tags question: http://stackoverflow.com/q/23890800
tags question: http://stackoverflow.com/q/23808733
tags question: http://stackoverflow.com/q/23822445
tags question: http://stackoverflow.com/q/23887669
tags question: http://stackoverflow.com/q/23905776
tags question: http://stackoverflow.com/q/23940911
tags question: http://stackoverflow.com/q/23883750
tags question: http://stackoverflow.com/q/23871255
tags question: http://stackoverflow.com/q/23784617
tags question: http://stackoverflow.com/q/23910489
tags question: http://stackoverflow.com/q/23923316
tags question: http://stackoverflow.com/q/23929380
tags question: http://stackoverflow.com/q/23787068
tags question: http://stackoverflow.com/q/23819180
tags question: http://stackoverflow.com/q/23875257
tags question: http://stackoverflow.com/q/23784324
tags question: http://stackoverflow.com/q/23788026
tags question: http://stackoverflow.com/q/23790743
tags question: http://stackoverflow.com/q/23839223
tags question: http://stackoverflow.com/q/23917192
tags question: http://stackoverflow.com/q/23872358
tags question: http://stackoverflow.com/q/23792360
tags question: http://stackoverflow.com/q/23872644
tags question: http://stackoverflow.com/q/23935534
tags question: http://stackoverflow.com/q/23785477
tags question: http://stackoverflow.com/q/23896348
tags question: http://stackoverflow.com/q/23843437
tags question: http://stackoverflow.com/q/23831870
tags question: http://stackoverflow.com/q/23880866
tags question: http://stackoverflow.com/q/23862994
tags question: http://stackoverflow.com/q/23804973
tags question: http://stackoverflow.com/q/23825554
type: Tag
tags question: http://stackoverflow.com/q/23839226
tags question: http://stackoverflow.com/q/23934110
tags question: http://stackoverflow.com/q/23896912
tags question: http://stackoverflow.com/q/23907391
tags question: http://stackoverflow.com/q/23912524
tags question: http://stackoverflow.com/q/23920613
tags question: http://stackoverflow.com/q/23877884
tags question: http://stackoverflow.com/q/23897618
tags question: http://stackoverflow.com/q/23827412
tags question: http://stackoverflow.com/q/23874693
tags question: http://stackoverflow.com/q/23827728
tags question: http://stackoverflow.com/q/23877900
tags question: http://stackoverflow.com/q/23895663
tags question: http://stackoverflow.com/q/23929835
tags question: http://stackoverflow.com/q/23798358
tags question: http://stackoverflow.com/q/23917048
tags question: http://stackoverflow.com/q/23895810
tags question: http://stackoverflow.com/q/23893080
tags question: http://stackoverflow.com/q/23871707
tags question: http://stackoverflow.com/q/23877175
tags question: http://stackoverflow.com/q/23936162
tags question: http://stackoverflow.com/q/23849850
tags question: http://stackoverflow.com/q/23920357
tags question: http://stackoverflow.com/q/23848090
tags question: http://stackoverflow.com/q/23927671
tags question: http://stackoverflow.com/q/23832759

http://stackoverflow.com/a/23858045
has comment: http://stackoverflow.com/comment/36719631
has comment: http://stackoverflow.com/comment/36719439
has comment: http://stackoverflow.com/comment/36719956
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36719558
answers question: http://stackoverflow.com/q/23857766
has comment: http://stackoverflow.com/comment/36719484
has comment: http://stackoverflow.com/comment/36719317
has body: It's not bad solution but it's not good too. Here is the reasons 1) Official recomendation: Generally it is recommended to have a single instance of HttpClient per communication component or even per application 2) AndroidHttpClient is the same what you are doing, but it implemented not as a singleton. 3) You can see in source code of AndroidHttpClient if connection would not be closed finalize method says that it's very bad @Override protected void finalize() throws Throwable { super.finalize(); if (mLeakedException != null) { Log.e(TAG, "Leak found", mLeakedException); mLeakedException = null; } } Update I guess I would use it like below public static InputStream getInputStreamFromUrl(String url) { InputStream content = null; try { HttpClient httpclient = AndroidHttpClient.newInstance(); HttpResponse response = httpclient.execute(new HttpGet(url)); content = response.getEntity().getContent(); httpclient.close(); } catch (Exception e) { Log.("Demo", "Network exception", e); } return content; }
downvote count: 0
type: Answer

http://stackoverflow.com/a/23828996
type: Answer
has comment: http://stackoverflow.com/comment/36665764
score: 7
downvote count: 1
answers question: http://stackoverflow.com/q/23828946
has comment: http://stackoverflow.com/comment/36663142
has comment: http://stackoverflow.com/comment/36663109
has body: Your main loop that is starting the thread is likely dominating the CPU, so it finishes doing its entire loop and only then do the threads get a chance to go. In fact, given that all of your threads sleep for an entire second and you're only looping 29 times, you're guaranteed that your loop will finish (and print all of the numbers) before your threads do. Add a sleep to your main loop if you want the threads to print - remember, the main loop doesn't stop when you start a thread.
has comment: http://stackoverflow.com/comment/36665779
upvote count: 8

http://stackoverflow.com/comment/36693072
comment on: http://stackoverflow.com/a/23843293
score: 1
type: AnswerComment
has text: baos.close() is redundant.
type: Comment

http://stackoverflow.com/comment/36834817
has text: Can you change your lib path to some absolute path and see if it works. My guess is that it's not getting selenium jars in class path.
comment on: http://stackoverflow.com/q/23918491
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23913684
type: Question
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0
score: 0
has body: I am getting following exception in my Android App: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'context' defined in class path resource [com/vmware/vim/binding/vmodl/context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org.springframework.core.io.ResourceEditor My project already has reference to spring-core.jar What can cause above issue?
has title: BeanCreation Exception for Android
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/23913802
has comment: http://stackoverflow.com/comment/36825412
has comment: http://stackoverflow.com/comment/36824960
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/23891586
downvote count: 0
has comment: http://stackoverflow.com/comment/36920925
has answer: http://stackoverflow.com/a/69940391
has comment: http://stackoverflow.com/comment/36789114
has title: JMH not working in Eclipse (as Maven project) - No benchmarks to run
has answer: http://stackoverflow.com/a/23988532
has comment: http://stackoverflow.com/comment/45190486
linked to: http://stackoverflow.com/q/21397542
favorite count: 0
has comment: http://stackoverflow.com/comment/36807627
has comment: http://stackoverflow.com/comment/36788951
tagged with: maven
has answer: http://stackoverflow.com/a/38343009
answer count: 4
type: AnsweredQuestion
tagged with: microbenchmark
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/23988532
possible better answer: http://stackoverflow.com/a/38343009
has body: I want to start have a look at JMH and I'm failing to run benchmarks due some reasons. Let me explain what I tried: Setup a maven project in Eclipse Define pom.xml like: Downloaded some official JMH examples. As example I choosed which is pretty simple and a good place to start: http://hg.openjdk.java.net/code-tools/jmh/file/0c58dc4fcf17/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_01_HelloWorld.java Right mouse click > Run As > Java Application However this produces the output: Exception in thread "main" No benchmarks to run; check the include/exclude regexps. at org.openjdk.jmh.runner.Runner.run(Runner.java:155) at org.openjdk.jmh.samples.JMHSample_01_HelloWorld.main(JMHSample_01_HelloWorld.java:90) I have googled and it seems the above example should work, but it is not the case for me. I also tried to solve the issue by reading but this seems not working for me: "No matching benchmarks" when running JMH from main in eclipse I tried to move the generated class manually to /META-INF/MicroBenchmarks however this produces following error: Exception in thread "main" java.lang.IllegalStateException: Mismatched format for the line: JMHSample_01_HelloWorld.class at org.openjdk.jmh.runner.BenchmarkRecord.<init>(BenchmarkRecord.java:92) at org.openjdk.jmh.runner.MicroBenchmarkList.find(MicroBenchmarkList.java:133) at org.openjdk.jmh.runner.Runner.run(Runner.java:150) at JMHSample_01_HelloWorld.main(JMHSample_01_HelloWorld.java:80) It seems like the JMH should produce some valid lines in /META-INF/MicroBenchmarks - meaning in this folder there should no generated java class files, correct? Can anyone help me to find the mistake? Thank you.
upvote count: 7
tagged with: eclipse
type: Question
tagged with: jmh
has comment: http://stackoverflow.com/comment/49505476
has answer: http://stackoverflow.com/a/50995578

http://stackoverflow.com/a/23857226
type: Answer
has comment: http://stackoverflow.com/comment/36718959
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23849406
has body: I'm not sure why you think having the right object will mean you won't get any exception. You're not getting a NullPointerException, if that is what you mean by the right object. Having said that, if you read the exception it is a FailingHttpStatusCodeException with the following message: 404 Not Found for http://forums.bukkit.org/threads/plugin-idea-to-get-tons-of-downloads.271185/members/jthort.90885864/post So that URL is giving you a 404 error when you perform an HTTP POST on it. You should keep debugging why this is happening. I would enable JavaScript, maybe it is needed there.
score: 0
accepted answer of: http://stackoverflow.com/q/23849406

http://stackoverflow.com/a/23890815
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23890294
has body: The problem you are seeing is not a failure of the guarding system, it is a failure in your printing mechanism. Here's an example you could use. I have created a new class called Calc which holds the details of the calculation at the time it was calculated. It shows the system works fine: public class Consumer implements Runnable { private SharedData sharedData; public Consumer(SharedData sharedData) { this.sharedData = sharedData; } @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i &lt; 10; i++) { Calc result = this.sharedData.calc(); System.out.println(result); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public class Producer implements Runnable { private SharedData sharedData; private Random numGenerator = new Random(); public Producer(SharedData sharedData) { this.sharedData = sharedData; } @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i &lt; 10; i++) { double firstNum = numGenerator.nextDouble(); double secondNum = numGenerator.nextDouble(); this.sharedData.store(firstNum, secondNum); //System.out.println("Sum: " + firstNum + ", " + secondNum); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public class Calc { final double x; final double y; final double r; public Calc(double x, double y, double r) { this.x = x; this.y = y; this.r = r; } public String toString() { return x + "," + y + "=" + r; } } public class SharedData { private double x = 0; private double y = 0; private volatile boolean empty = true; public synchronized Calc calc() { while (empty) { try { wait(); } catch (InterruptedException e) { } } // Create my Calc before the data can be changed. Calc calc = new Calc(x, y, (x + y) / 2); empty = true; notifyAll(); return calc; } public synchronized void store(double x, double y) { while (!empty) { try { wait(); } catch (InterruptedExce…
answers question: http://stackoverflow.com/q/23890294
type: Answer
score: 0

http://stackoverflow.com/a/23894830
upvote count: 1
answers question: http://stackoverflow.com/q/23890907
type: Answer
has body: You can not restrict recognition in Android Speech API, it doesn't support grammars. However, you can try CMUSphinx. See the example under link, you can define a grammar to use alpha digits only, it will work offline so the response will be very fast and you can tune accuracy for the best match too.
downvote count: 0
score: 1

http://stackoverflow.com/comment/36729554
has text: I see. Although is tricky.. very. So i shall leave this as correct answer? (is too tale here, i have to go to sleep, tomorrow i'll take a decision!) Thanks!!!!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23863216
type: Comment

http://stackoverflow.com/comment/36884658
type: Comment
type: QuestionComment
has text: JMeter makes HTTP requests to web sites. You'll get back whatever the web app renders, e.g., JavaScript, CSS, and HTML. You have to pull data from the DOM, and this is covered in the JMeter docs.
comment on: http://stackoverflow.com/q/23940662
score: 0

http://stackoverflow.com/comment/36738184
comment on: http://stackoverflow.com/q/23868273
score: 0
type: Comment
type: QuestionComment
has text: What's the error message?

http://stackoverflow.com/q/23806615
has answer: http://stackoverflow.com/a/23806742
accepted answer: http://stackoverflow.com/a/23806742
has comment: http://stackoverflow.com/comment/36620412
tagged with: switch-statement
type: Question
tagged with: case
has comment: http://stackoverflow.com/comment/36620279
has comment: http://stackoverflow.com/comment/36620361
has comment: http://stackoverflow.com/comment/36620343
possible better answer: http://stackoverflow.com/a/23806814
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23806814
has comment: http://stackoverflow.com/comment/36620523
has comment: http://stackoverflow.com/comment/36621291
has title: Using a switch case to write button values to variable
tagged with: android
has body: I am trying to get values from my buttons using a switch case. But everytime when I am using this code it crashes.. Does anyone know how to fix it. Also, this code is not finished so I am missing 7 buttons but thats for later. public void startGame(View v){ String randText = ""; String test = "10"; String test1 = "11"; Random randGen = new Random(); int rando = randGen.nextInt(10); randText = Integer.toString(rando); TextView RandomValue = (TextView) findViewById(R.id.randomValueTv); RandomValue.setText(randText); randomNumbersRbra(); TimerGame(); Button start = (Button)findViewById(R.id.startGameBtn); start.setVisibility(View.INVISIBLE); TextView go = (TextView)findViewById(R.id.tvGo); go.setVisibility(View.VISIBLE); Button btnTap1 = (Button)findViewById(R.id.tap1); Button btnTap2 = (Button)findViewById(R.id.tap2); Button btnTap3 = (Button)findViewById(R.id.tap3); Button btnTap4 = (Button)findViewById(R.id.tap4); Button btnTap5 = (Button)findViewById(R.id.tap5); Button btnTap6 = (Button)findViewById(R.id.tap6); Button btnTap7 = (Button)findViewById(R.id.tap7); Button btnTap8 = (Button)findViewById(R.id.tap8); Button btnTap9 = (Button)findViewById(R.id.tap9); TextView tvtest = (TextView)findViewById(R.id.scoreTv); tvtest.setText(test.toString()); switch(v.getId()) { case R.id.tap1: tvtest.setText(test1.toString()); break; case R.id.tap2: tvtest.setText(test1.toString()); } btnTap1.setOnClickListener((OnClickListener) this); btnTap2.setOnClickListener((OnClickListener) this); } Logcat &gt; 05-22 14:06:22.271: D/dalvikvm(29893): Late-enabling CheckJNI 05-22 14:06:22.821: D/libEGL(29893): loaded /system/lib/egl/libEGL_mali.so 05-22 14:06:22.821: D/libEGL(29893): loaded /system/lib/egl/libGLESv1_CM_mali.so 05-22 14:06:22.881: D/libEGL(29893): loaded /system/lib/egl/libGLESv2_mali.so 05-22 14:06:22.941: D/OpenGLRenderer(29893): Enabling debug mode 0 05-22 14:06:24.753: D/dalvikvm(29893): JIT code cache reset in 13 ms (4096 bytes 2/0) 05-22 14:06:24.763: D/dalvikvm(29893)…
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23814063
score: 1
has comment: http://stackoverflow.com/comment/36634817
favorite count: 0
has comment: http://stackoverflow.com/comment/36635098
type: UnansweredQuestion
has title: How can I tell the content type of an empty list in java
has comment: http://stackoverflow.com/comment/36635397
has comment: http://stackoverflow.com/comment/36635052
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/23814894
upvote count: 1
has comment: http://stackoverflow.com/comment/36634927
type: Question
has body: Say I have the following two empty lists List&lt;String&gt; obj1 = new ArrayList&lt;String&gt;(); List&lt; Integer&gt; obj2 = new ArrayList&lt;Integer&gt;(); without foreknowledge, how can I tell which is of type String and which is of type Integer? (Please, never mind why I need this info). Here I can no longer do if (!list.isEmpty() &amp;&amp; list.get(0) instanceof String) as the list is empty.
linked to: http://stackoverflow.com/q/3403909
linked to: http://stackoverflow.com/q/1942644
has comment: http://stackoverflow.com/comment/36635861
has comment: http://stackoverflow.com/comment/36635014
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36634875
duplicate of: http://stackoverflow.com/q/1942644
has comment: http://stackoverflow.com/comment/36634924
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36635365

http://stackoverflow.com/a/23883115
type: Answer
has comment: http://stackoverflow.com/comment/44158314
answers question: http://stackoverflow.com/q/23806925
accepted answer of: http://stackoverflow.com/q/23806925
score: 0
type: AcceptedAnswer
has body: I think I have found a solution for this .. Also yes the cookie setting was enabled from the server ok. According to the Cookie specification(http://www.faqs.org/rfcs/rfc2965.html),sites may specify path to restrict the scope of their cookies.. Unfortunately,it may be so that some server do not follow the spec as it is . By default, HttpUnit is very strict about implementing the spec,and will reject such cookies. This behavior can be controlled by the class CookieProperties class as I did above. So setting CookieProperties.setPathMatchingStrict(false); (Specifies whether strict path name matching must be followed.) resolves the problem.

http://stackoverflow.com/comment/36721119
score: 0
comment on: http://stackoverflow.com/q/23858751
has text: @fmodos the list size is 0.. kind of a hint that the user will be null
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23823594
downvote count: 0
score: 1
has body: Of course it's possible. You need to look at File, Reader classes. A useful method is File#listFiles. Happy coding.
answers question: http://stackoverflow.com/q/23823547
upvote count: 1
type: Answer

nodelist
type: Tag
tags question: http://stackoverflow.com/q/23880718
tag name: nodelist

http://stackoverflow.com/q/23797596
favorite count: 0
answer count: 2
tagged with: android-library
upvote count: 1
has answer: http://stackoverflow.com/a/23811949
tagged with: android-fragments
has body: I want to use the Umano/SlidingUpPanel in my main activity This is my activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".DemoActivity" &gt; &lt;com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/lib/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" sothree:panelHeight="68dp" sothree:shadowHeight="4dp" sothree:paralaxOffset="100dp" sothree:dragView="@+id/name"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="?android:attr/actionBarSize"&gt; &lt;Button android:id="@+id/bigbutton_right" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignBaseline="@+id/bigbutton_middle" android:layout_alignBottom="@+id/bigbutton_middle" android:layout_marginLeft="7dp" android:layout_toRightOf="@+id/bigbutton_middle" android:onClick="selectFrag" android:background="@drawable/mainbutton_right" /&gt; &lt;Button android:id="@+id/bigbutton_left" android:layout_width="100dp" android:layout_height="100dp" android:onClick="selectFrag" android:layout_alignBaseline="@+id/bigbutton_middle" android:layout_alignBottom="@+id/bigbutton_middle" android:layout_marginRight="7dp" android:layout_toLeftOf="@+id/bigbutton_middle" android:background="@drawable/mainbutton_left" /&gt; &lt;Button android:id="@+id/bigbutton_middle" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="138dp" android:background="@drawable/mainbutton_middle" android:onClick="selectFrag" /&gt; &lt;fragment android:id="@+id/fragment_place" android:name="com.mainpackage.FragmentOne" android:layout_width="match_parent" android:lay…
has title: SlidingUpPanel crashing
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23811949
score: 1
has answer: http://stackoverflow.com/a/23797683
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/23797683

http://stackoverflow.com/comment/36683161
type: QuestionComment
comment on: http://stackoverflow.com/q/23839226
has text: Why do you think it should be anything other than `null` if you use `@Autowired`?
score: 0
type: Comment

http://stackoverflow.com/q/23920684
has body: I have a .zip(Meow.zip) and it has multiple files and folders, like so Meow.zip File.txt Program.exe Folder Resource.xml AnotherFolder OtherStuff MoreResource.xml I have looked everywhere but I could not find anything that works. Thanks in advance!
favorite count: 0
linked to: http://stackoverflow.com/q/981578
upvote count: 8
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23920752
duplicate of: http://stackoverflow.com/q/981578
has title: Java: Extracting zip file with multiple subdirectories
has comment: http://stackoverflow.com/comment/77858794
tagged with: java
has comment: http://stackoverflow.com/comment/36838581
score: 8
possible better answer: http://stackoverflow.com/a/23920746
has answer: http://stackoverflow.com/a/23920752
has answer: http://stackoverflow.com/a/23920746
type: AnsweredQuestion
tagged with: unzip
downvote count: 0

http://stackoverflow.com/a/23801203
score: 1
has comment: http://stackoverflow.com/comment/36610606
accepted answer of: http://stackoverflow.com/q/23801051
upvote count: 1
has comment: http://stackoverflow.com/comment/36610363
has comment: http://stackoverflow.com/comment/36610431
has body: Use this constructor set the boolean to false
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36610548
type: Answer
answers question: http://stackoverflow.com/q/23801051

http://stackoverflow.com/comment/38292284
has text: I have the same problem and try to fix it with "%JAVA%" -Djsse.enableSNIExtension=false %JAVA_OPTS% com.eviware.soapui.SoapUI %* but I still have the exception. Is my modification of soapui.bat ok? I use it on windows. Thanks.
comment on: http://stackoverflow.com/a/23949271
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23894944
has body: The evaluation of OGNL expressions is disabled by default since 2.3.14.1 because of security vulnerability (see S2-013 for more details). Of course you can enable evaluation by setting struts.ognl.enableOGNLEvalExpression to true. &lt;constant name="struts.ognl.enableOGNLEvalExpression" value="true" /&gt; But it is not recommended. Instead use: &lt;s:property value="#attr[some_var]"/&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/36796494
has comment: http://stackoverflow.com/comment/36832743
has comment: http://stackoverflow.com/comment/36796313
has comment: http://stackoverflow.com/comment/36793573
has comment: http://stackoverflow.com/comment/36794115
accepted answer of: http://stackoverflow.com/q/23893486
has comment: http://stackoverflow.com/comment/54118405
has comment: http://stackoverflow.com/comment/36793765
type: Answer
answers question: http://stackoverflow.com/q/23893486
has comment: http://stackoverflow.com/comment/36790372
has comment: http://stackoverflow.com/comment/36792177
has comment: http://stackoverflow.com/comment/36833502
score: 3
has comment: http://stackoverflow.com/comment/36832563
has comment: http://stackoverflow.com/comment/36795747
has comment: http://stackoverflow.com/comment/36794491
has comment: http://stackoverflow.com/comment/36793922
has comment: http://stackoverflow.com/comment/36832965
upvote count: 3
has comment: http://stackoverflow.com/comment/36833704
has comment: http://stackoverflow.com/comment/36811000
has comment: http://stackoverflow.com/comment/36796831
has comment: http://stackoverflow.com/comment/36833866
has comment: http://stackoverflow.com/comment/36793412
has comment: http://stackoverflow.com/comment/36792727
has comment: http://stackoverflow.com/comment/36790818
has comment: http://stackoverflow.com/comment/36833560
has comment: http://stackoverflow.com/comment/36811523
has comment: http://stackoverflow.com/comment/54118466
has comment: http://stackoverflow.com/comment/36797210
has comment: http://stackoverflow.com/comment/36833091
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36811260

http://stackoverflow.com/a/23837566
type: Answer
answers question: http://stackoverflow.com/q/23804655
score: 0
has body: You misunderstand the manual there. lastUpdated is not a built-in variable in FreeMarker. All the variables that you are using, like name, package, time, are provided by NetBeans. After all, FreeMarker is not specialized on generating source code (in fact, it's much more often used for generating Web pages). So check what variables are available in the NetBean documentation. Or, maybe try to list the available variables, like described here: does freemarker support show all variable in data-model?

http://stackoverflow.com/q/23822914
tagged with: java
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/40480
score: -1
has answer: http://stackoverflow.com/a/23822933
has title: Java is pass by value or pass by reference when collections or array is passed as parameter?
answer count: 2
upvote count: 0
has body: Question : Is Java Pass By Value or Pass By Reference? This was the question asked in one of the interview. Answer : In most of the Java books it is given that Java is pass by value. So I told this answer. But interviewer gave me an example of arraylist. Where we pass an arraylist to function() and in this function we remove an element and same is reflected back on original array. This means Java also supports pass by reference. I was confused so asking this Question to all of you. Example of ArrayList : public static void functionToRemoveAnElement(List&lt;String&gt;strs){ strs.remove(0); } public static void main(String args[]) { List&lt;String&gt; strs = new ArrayList&lt;String&gt;(); strs.add("nishant1"); strs.add("nishant2"); strs.add("nishant3"); strs.add("nishant4"); strs.add("nishant5"); strs.add("nishant6"); strs.add("nishant7"); for(String str : strs){ System.out.println("Before Calling Function : "+str); //here it will print all the values } functionToRemoveAnElement(strs); for(String str : strs){ System.out.println("After Calling Function : "+str); //here it will not print nishant1 after calling function() } } This is O/P for those who are saying the values will not change: Before Calling Function : nishant1 Before Calling Function : nishant2 Before Calling Function : nishant3 Before Calling Function : nishant4 Before Calling Function : nishant5 Before Calling Function : nishant6 Before Calling Function : nishant7 After Calling Function : nishant2 After Calling Function : nishant3 After Calling Function : nishant4 After Calling Function : nishant5 After Calling Function : nishant6 After Calling Function : nishant7 We can see that nishant1 is not present after the call as we are removing 1st element.
has answer: http://stackoverflow.com/a/23822932
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/36651780
has comment: http://stackoverflow.com/comment/36651821
has comment: http://stackoverflow.com/comment/36651760

http://stackoverflow.com/q/23811253
has answer: http://stackoverflow.com/a/23811286
type: AnsweredQuestion
has title: Syntax error on token "22f", delete this token
linked to: http://stackoverflow.com/q/17260417
score: 1
tagged with: java
tagged with: eclipse
type: Question
upvote count: 1
answer count: 1
tagged with: arraylist
duplicate of: http://stackoverflow.com/q/17260417
accepted answer: http://stackoverflow.com/a/23811286
favorite count: 0
downvote count: 0
has body: I'm trying to setup an ArrayList of Float, but in eclipse i keep have an error mark when i try to add something: import java.io.Serializable; import com.google.common.base.Objects; import java.util.ArrayList; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyClass extends BaseEntity implements Serializable { //[..] public static ArrayList<Float> vat_values = new ArrayList<Float>(); vat_values.add(22f); //[..] } doing vat_values.add(22f); i get this errors (red underline under the dot and under '22f'): Multiple markers at this line: Syntax error on token "22f", delete this token Syntax error on token(s), misplaced construct(s) but if i only type vat_values.add(); i get this error (red underline under the word "add"): Syntax error on token "add", Identifier expected after this token Thank you

http://stackoverflow.com/comment/36633969
score: 0
comment on: http://stackoverflow.com/q/23813352
has text: You might've been confused. it was modified when I answered the question and the bad code was removed and replaced with working code, but he switched it back. @TimCastelijns
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36745035
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23871931
has text: have you tried running your query on the database itself and see if it returns correct result?

http://stackoverflow.com/comment/36827071
score: 0
comment on: http://stackoverflow.com/q/23892179
type: QuestionComment
type: Comment
has text: I'm using version 3.2.3, and I'm not sure what you mean about the controller, as I'm fairly new to this. I'm aware of the `@RequestMapping` annotation, but since I'll be taking many parameters I'm trying to avoid it to keep the code a little cleaner. That's why I'm using the request instead of annotations.

http://stackoverflow.com/q/23904539
has answer: http://stackoverflow.com/a/23904558
tagged with: inheritance
has comment: http://stackoverflow.com/comment/62440426
has title: how to call a overridden method from subclass object in java
has answer: http://stackoverflow.com/a/23904615
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36808001
type: Question
linked to: http://stackoverflow.com/q/1032847
has body: Is there a way to call test() in class a from class b object created in class c ? class a { void test(){ System.out.println("in a"); } } class b extends a { void test(){ System.out.println("in b"); } } public class c{ public static void main(String[] args) { b refb = new b(); refb.test(); } }
tagged with: oop
tagged with: java
duplicate of: http://stackoverflow.com/q/1032847
score: 0
answer count: 2

spring-java-config
tags question: http://stackoverflow.com/q/23801056
type: Tag
tags question: http://stackoverflow.com/q/23912134
tag name: spring-java-config
tags question: http://stackoverflow.com/q/23873804
tags question: http://stackoverflow.com/q/23797033

http://stackoverflow.com/q/23827140
tagged with: char
has answer: http://stackoverflow.com/a/23827266
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23827306
has comment: http://stackoverflow.com/comment/36659527
has answer: http://stackoverflow.com/a/23827215
has answer: http://stackoverflow.com/a/23827227
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36659491
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/23827215
type: Question
has title: Last element of JAVA char array is not replaced
has answer: http://stackoverflow.com/a/23827180
tagged with: arrays
has answer: http://stackoverflow.com/a/23827298
answer count: 6
has comment: http://stackoverflow.com/comment/36659659
has body: In a JAVA 'char[] a' , I want to replace all the charachters by 'q', except 'x' and 'y'. I tried it by the JAVA code below. It works but fails to replace the last character. I need help to complete the replacement. public static void main( String[] args ) { char[] a ={'x','y','z','x','y','r','b'}; for(int i=0; i&lt;a.length; i++){ if ( a[i]=='x') { i=i+1; if ( a[i]=='y') { i=i+1; a[i]='q'; } System.out.println(a); } } }
tagged with: replace
accepted answer: http://stackoverflow.com/a/23827180

http://stackoverflow.com/a/23869060
type: Answer
has body: Either use the appropriate placehodler for int primitives which is %d: frameRate = String.format("FPS %d", frameCount); Or keep the current formatting rule and convert the int frameCount to a String to fit in the %s placeholder: frameRate = String.format("FPS %s", String.valueOf(frameCount)); //Useless overhead
answers question: http://stackoverflow.com/q/23868957
score: 0

http://stackoverflow.com/q/23843232
has answer: http://stackoverflow.com/a/23843297
favorite count: 0
has comment: http://stackoverflow.com/comment/36690435
tagged with: io
has answer: http://stackoverflow.com/a/70564801
accepted answer: http://stackoverflow.com/a/23843279
answer count: 4
has comment: http://stackoverflow.com/comment/36690489
downvote count: 1
has answer: http://stackoverflow.com/a/23843282
type: AnsweredQuestion
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/23843282
has title: System.out .write() executes but doesn't print
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23843279
has body: public class BRRead { public static void main(String[] args) { int b; b='A'; System.out .write(b); System.out .write('\n'); } } So when i execute the above program i get the expected output - A but when comment out the last line System.out.write('\n'); the program executes but doesn't print the output - A. Can any one explain what's exactly happening here? public class BRRead { public static void main(String[] args) { int b; b='A'; System.out .write(b); //System.out .write('\n'); } }

http://stackoverflow.com/comment/36626613
comment on: http://stackoverflow.com/q/23809492
type: QuestionComment
has text: Just inspect the html source of the site. In Firefox you can right click the price and click on "Inspect element" to get the source of the selected element.
score: 2
type: Comment

http://stackoverflow.com/comment/36841871
type: QuestionComment
has text: Look like you have a Problem in your Project. Look at the Problems tab what can you see there?
score: 1
comment on: http://stackoverflow.com/q/23922387
type: Comment

http://stackoverflow.com/q/23889749
has answer: http://stackoverflow.com/a/23889833
has title: create array of objects which have constructor function
has answer: http://stackoverflow.com/a/23889832
has answer: http://stackoverflow.com/a/23889830
has answer: http://stackoverflow.com/a/23889849
has body: i have this class public class customer { int id; int status ; customer(int value) { id = value; status = 0; } } i want to create an array consist of 100 objects of customer. how can i pass argument to constractor function of customer class ? public class barbershop { Queue WaitSeat ; Queue WaitRoom ; static barber [] bb ; static customer [] cc; barbershop(){ WaitSeat = new PriorityQueue(4); WaitRoom = new PriorityQueue(13); bb = new barber[3]; cc = new customer [100]{1}; // problem ! } }
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23889821
score: 0
tagged with: java
type: Question

http://stackoverflow.com/a/23896837
has body: In your java code that configures and submits your jobs (usually the run() method in a ToolRunner subclass), submit your first job with: job.waitForCompletion(true); before configuring and submitting the second job. This method will wait until the job completes before returning.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23896086
has comment: http://stackoverflow.com/comment/36797207

http://stackoverflow.com/q/23838349
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36681381
has answer: http://stackoverflow.com/a/23853838
has answer: http://stackoverflow.com/a/23838529
accepted answer: http://stackoverflow.com/a/23838529
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: Downloading xml data on very slow 2G internet
has comment: http://stackoverflow.com/comment/36681610
tagged with: android
has comment: http://stackoverflow.com/comment/36681563
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23853838
has comment: http://stackoverflow.com/comment/36681396
has body: i have successfully programmed an app that takes Traces of allot of system services (GPS location, Network Location, wifi, neighbouringcellinfo, sensors ....) in every 10 seconds which works very well, but as soon as i restrict the internet on my phone to use only 2G and turn off Wifi i get the app still works but start to lag. I have tried to find out where the Problem is coming from and i have noticed that it comes from this code line: XmlPullParser receivedData = XmlPullParserFactory.newInstance() .newPullParser().setInput(xmlUrl.openStream(), null); return receivedData; As soon as i delete this couple of code lines in my activity the app works without lagging, but seeing as they are essential for my app i would very much like to have them work (which they already do) but without causing lags. Can anyone please help me? I have printed the parsed result from the XML file and it is correct, so my only problem here is the lagging of the app. A typical XML file that i would be dealing with looks like this: &lt;rsp stat="ok"&gt; &lt;cell lat="49.88415658974359" lon="8.637537076923078" mcc="262" mnc="7" lac="41146" cellid="42404" averageSignalStrength="-79" samples="39" changeable="1"/&gt; &lt;/rsp&gt;
type: Question

http://stackoverflow.com/comment/36853619
score: 0
type: QuestionComment
type: Comment
has text: You read input.readLine() twice but use it only once. So, if you ahve 2 messages, your loop will run only once.
comment on: http://stackoverflow.com/q/23928745

http://stackoverflow.com/q/23904154
score: 1
has answer: http://stackoverflow.com/a/23906952
upvote count: 1
linked to: http://stackoverflow.com/q/17785307
type: Question
tagged with: java
has body: How can I profile my Java-based Akka application? I looked at the answer for this question. But I found it to be unsatisfactory. The answer says that Typesafe Activator released something called the 'Typesafe Console', but the link in the answer was a deadlink: Link and the other Link just redirects you back to This Location We're running into performance issues with our Akka-Java-based application and we want to identify whether it's an issue in the way we've modeled our actor hierarchy. For example, how can we profile the application in such a way that we can see how many messages are queued in any actor's mailbox at any given point in time? Thanks!
tagged with: akka
tagged with: profiling
downvote count: 0
answer count: 1
tagged with: typesafe
favorite count: 0
type: UnansweredQuestion
has title: How to profile Akka Java application mailboxes

http://stackoverflow.com/q/23780310
has title: hashCode() method using HashMap
type: Question
has comment: http://stackoverflow.com/comment/36571207
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23780378
has comment: http://stackoverflow.com/comment/36571228
has comment: http://stackoverflow.com/comment/36571322
has comment: http://stackoverflow.com/comment/36571295
has body: Do I have to override hashCode() method, if I'm going to customize HashMap? UPD: For example: import java.util.HashMap; import java.util.Objects; /** * * @author dolgopolov.a */ public class SaltEntry { private long time; private String salt; /** * @return the time */ public long getTime() { return time; } /** * @param time the time to set */ public void setTime(long time) { this.time = time; } /** * @return the salt */ public String getSalt() { return salt; } /** * @param salt the salt to set */ public void setSalt(String salt) { this.salt = salt; } public boolean equals(SaltEntry o) { if (salt.equals(o.getSalt()) &amp;&amp; time == o.getTime()) { return true; } else { return false; } } public int hashCode() { return Objects.hash(String.valueOf(salt + time)); } public static void main(String[] args) { SaltEntry se1 = new SaltEntry(), se2 = new SaltEntry(); se1.setSalt("1"); se2.setSalt("1"); se1.setTime(1); se2.setTime(1); HashMap&lt;String, SaltEntry&gt; hm = new HashMap&lt;String, SaltEntry&gt;(); hm.put("1", se1); hm.put("2", se2); System.out.println(hm.get("1").getSalt()); } }
accepted answer: http://stackoverflow.com/a/23780378
has comment: http://stackoverflow.com/comment/36571197
type: AnsweredQuestion
tagged with: hashmap
tagged with: hashcode
tagged with: java

http://stackoverflow.com/q/23787039
type: Question
score: 0
tagged with: unmarshalling
has comment: http://stackoverflow.com/comment/36675976
has comment: http://stackoverflow.com/comment/36586724
has comment: http://stackoverflow.com/comment/36586640
has body: I have a very very large xml file where each attribute occupies one line as shown below <?xml version="1.0"?> 1 CLOSED ABC Company ........ <?xml version="1.0"> ........... I want to modify it so that the entire roo attribute and its sub attributes occupy one line with the header changed as follows <?xml version="1.0"?> 1 CLOSED ........... This XML file is created by some other process. I don't have any control over how it is created. The file is very huge (~20GB) . so I cannot manually change it
has comment: http://stackoverflow.com/comment/36586567
tagged with: xjc
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has title: Pre Process XML file to be used in unmarshaller
has comment: http://stackoverflow.com/comment/36586679
has comment: http://stackoverflow.com/comment/36587841
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/36585714

http://stackoverflow.com/q/23893082
has title: Use jTextField text in one JFrame in a seperate JFrame
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36785945
answer count: 0
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36786546
tagged with: jtextfield
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/36786218
has comment: http://stackoverflow.com/comment/36787468
linked to: http://stackoverflow.com/q/18580000
has body: Two hours of google searches and I now do admit defeat. I am working on a simple java program but I just can't figure out how to get the text from one jTextField to equal the text of another jTextField in a separate jFrame. The variables in question are accNumber in NewJFrame.java and AccnDynamicLabel in NewFrame.java. I am looking to make the text within AccDynamicLabel equal to the text in accNumber when the user clicks the createBtn in NewJFrame.java. Here is my code for the two java files NewJFrame.java: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package bank; /** * * @author CJ */ public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { panel = new javax.swing.JPanel(); accnLabel = new javax.swing.JLabel(); accBal = new javax.swing.JLabel(); createBtn = new javax.swing.JButton(); accNumber = new javax.swing.JTextField(); accBalText = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); accnLabel.setText("Account Number"); accBal.setText("Initial Balance"); createBtn.setText("Create"); createBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createBtnActionPerformed(evt); } }); accNumber.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { accNumberInputMethodTextCha…
has comment: http://stackoverflow.com/comment/36791268

http://stackoverflow.com/q/23903873
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: selenium
accepted answer: http://stackoverflow.com/a/23909305
upvote count: 1
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/36806929
has comment: http://stackoverflow.com/comment/58154950
linked to: http://stackoverflow.com/q/2481350
answer count: 1
downvote count: 0
has body: I have this part of the code in my Selenium Webdriver test in java. I use this javascript code to scroll to a particular value i in the page. ((JavascriptExecutor) driver).executeScript("scroll(0,"+i+");"); scroll(0,y) doesn't return a value. Is there any way to know if this script has been executed ?
favorite count: 0
linked to: http://stackoverflow.com/q/5585343
has comment: http://stackoverflow.com/comment/36806824
has comment: http://stackoverflow.com/comment/36806906
has answer: http://stackoverflow.com/a/23909305
has comment: http://stackoverflow.com/comment/36806856
tagged with: selenium-webdriver
has title: How to know if the javascript code has been executed in Selenium Java?

http://stackoverflow.com/comment/36587841
comment on: http://stackoverflow.com/q/23787039
has text: How big would one of the individual XML documents be on their own?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23841705
score: 0
type: Answer
has body: you should use table name with there database name.. For example if you want to merge as union or join the use table name as: Select * from db_name1.table_name union select * from db_name2.table_name... Otherwise clarify your question.
answers question: http://stackoverflow.com/q/23838682

http://stackoverflow.com/comment/36761058
score: 2
comment on: http://stackoverflow.com/q/23880161
has text: You need to reword your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23931742
type: Question
has comment: http://stackoverflow.com/comment/36860792
has comment: http://stackoverflow.com/comment/36863918
has comment: http://stackoverflow.com/comment/36863595
tagged with: java-7
has comment: http://stackoverflow.com/comment/36863791
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23942216
has comment: http://stackoverflow.com/comment/36863655
favorite count: 0
has title: Stackoverflow error in Spring's (3.2.0) ConfigurationClassEnhancer after upgrading to Java 7
tagged with: spring-annotations
tagged with: spring
has body: We have a couple of @Configuration annotated classes, the application is working fine on sun-jdk-6,but after upgrading to oracle-jdk-7 a SO error happens. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManagerPeerProviderFactory' defined in class path resource [com/egnyte/filestore/cache/CacheManagerPeerProviderConfigurationProvider.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object com.egnyte.filestore.cache.CacheManagerPeerProviderConfigurationProvider.get()] threw exception; nested exception is java.lang.StackOverflowError at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1029) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:925) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.annotation.Config…
accepted answer: http://stackoverflow.com/a/23942216
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36863405
tagged with: configuration
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36861952

http://stackoverflow.com/q/23860661
type: Question
has answer: http://stackoverflow.com/a/23860891
downvote count: 1
has body: I have searched for this problem and found many answers regarding it but however i did not understand them , i would a clarification regarding my own code so hopefully it will makes sense i am trying to call the PrintList method in the main method but i get this error Cannot make a static reference to the non-static method PrintList() from the type Stack if i change the modifier of PrintList to static , it ruins the whole code. can anyone help me fix this issue please? Thanks public class Stack&lt;Item&gt; { public int N; // size of the stack public Node&lt;Item&gt; first; // top of stack public Node&lt;Item&gt; last; // top of stack // helper linked list class private static class Node&lt;Item&gt; { private Item item; private Node&lt;Item&gt; next; } public Stack() { first = null; last = null; N = 0; } public void PrintList() { Node&lt;Item&gt; current; current = first; while (current.next != null) { System.out.println(current.item); current = current.next; } } public static void main(String[] args) { // Declare the stack Stack&lt;String&gt; s = new Stack&lt;String&gt;(); s.push("Bob"); s.push("Mary"); s.push("David"); s.InsertBegin("George"); System.out.println("First item: " + s.peek()); Object current; PrintList(); // what is wrong here? } }
favorite count: 0
has answer: http://stackoverflow.com/a/23860675
answer count: 3
has comment: http://stackoverflow.com/comment/36724595
has comment: http://stackoverflow.com/comment/36724525
upvote count: 0
has answer: http://stackoverflow.com/a/23860674
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36724563
tagged with: java
score: -1
has title: Cannot make a static reference to the non-static method

http://stackoverflow.com/q/23797850
score: 1
tagged with: java
tagged with: jsf-2
has title: Error deploying MyFaces CODI + Weld + JSF in Apache Tomcat 7
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/23862251
tagged with: weld
has body: I'm new using JSF and I noticed that the JSF doesn't provide some useful annotations, like @ViewAccessScoped (CODI). For use the CODI, I need to use the CDI dependency, so I configured my project with Weld. Then, JSF + Weld + Tomcat 7 works fine, changing annotations scope to Weld annotations, @ManagedBean to @Named and @NamedProperty to @Inject. Otherwise, When I try to deploy my Tomcat server now with CODI, I have the following stack trace (using the CODI library like @ViewAccessScoped annotation or not) and the server shutdown: Mai 22, 2014 12:03:28 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib Mai 22, 2014 12:03:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BioRequestWeld' did not find a matching property. Mai 22, 2014 12:03:28 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Mai 22, 2014 12:03:28 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Mai 22, 2014 12:03:28 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 469 ms Mai 22, 2014 12:03:28 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Mai 22, 2014 12:03:28 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Mai 22, 2014 12:03:30 AM org.jboss.weld.environment.servlet.EnhancedListener onStartup INFO: Initialize Weld using ServletContainerInitializer Mai 22, 2014 12:03:30 AM org.jboss.weld.bootstrap.WeldStartup &lt;clinit&gt; INFO: WELD-000900: 2.2.1 (Final) Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.WeldStartup startContainer INFO: WELD-00…
type: AnsweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23862251
tagged with: codi

http://stackoverflow.com/q/23800114
accepted answer: http://stackoverflow.com/a/23800218
has answer: http://stackoverflow.com/a/23800401
type: AnsweredQuestion
has title: Callable and Future return exception
possible better answer: http://stackoverflow.com/a/23800401
tagged with: java
tagged with: callable
tagged with: concurrency
type: Question
score: 0
answer count: 2
has body: I have follwoing code. Future&lt;Integer&gt; future = Executor.execute(callable); Integer i; try { i = future.get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); return MESSAGE_INT_CODE; } catch (ExecutionException e) { // TODO Auto-generated catch block //e.printStackTrace(); } return i; where ExecutionException can contain other exception say ABCException. and my calling code is catching ABCException which is runtime exception, so if ExecutionException is occured how would I know it is because of ABCException? ExecutionException due to some exception when my public call() method run. and call method may have some ABCException should I write like this ? catch (ExecutionException e) { throw new ABCException(e.getMessage()); // TODO Auto-generated catch block //e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/36608596
tagged with: exception
has answer: http://stackoverflow.com/a/23800218
has comment: http://stackoverflow.com/comment/36608359
tagged with: future

http://stackoverflow.com/a/23897930
upvote count: 1
has body: Maven is probably not the best build tool to achieve this. I strongly suggest you to use gradle as it contains a built-in feature : the productFlavor allowing you to do exactly what you need.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36795779
has comment: http://stackoverflow.com/comment/36795489
answers question: http://stackoverflow.com/q/23897712

http://stackoverflow.com/q/23932200
has answer: http://stackoverflow.com/a/23932314
favorite count: 0
tagged with: arraylist
tagged with: nullpointerexception
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23932358
has answer: http://stackoverflow.com/a/23932225
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23932263
has body: My code is throwing a NullPointerException, when i select an null Arraylist this is the stack trace: javax.el.ELException: /jsf/projet/phases/viewPhases.xhtml @27,170 value="#{PhaseComponent.listPhaseTaches(PhaseComponent.phase.idphase)}": java.lang.NullPointerException at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178) at javax.faces.component.UIData.getValue(UIData.java:554) at org.primefaces.component.datatable.DataTable.getValue(DataTable.java:910) at org.primefaces.component.api.UIData.getDataModel(UIData.java:615) at javax.faces.component.UIData.getRowCount(UIData.java:339) at org.primefaces.component.api.UIData.calculateFirst(UIData.java:161) at org.primefaces.component.datatable.DataTableRenderer.preEncode(DataTableRenderer.java:107) at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:81) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879) at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:74) at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57) at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:204) at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:121) at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:58) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650) at javax.faces.render.Renderer.encodeChildren(Renderer.java:164) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849) at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:70) at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57) at org.primefaces.component…
accepted answer: http://stackoverflow.com/a/23932314
possible better answer: http://stackoverflow.com/a/23932225
upvote count: 0
has comment: http://stackoverflow.com/comment/36859466
has title: how to handle NullPointerException on ArrayList

http://stackoverflow.com/comment/36870276
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23937864
has text: oh sorry, in my `ManagedBean` after i press a button in the screen, in a actionListener.

http://stackoverflow.com/comment/36684969
type: QuestionComment
score: 0
has text: First, don't mix heavy (`Canvas`) with light weight (`JFrame`) components, there are z-order painting issues
comment on: http://stackoverflow.com/q/23839921
type: Comment

http://stackoverflow.com/q/23868182
has answer: http://stackoverflow.com/a/66428524
has answer: http://stackoverflow.com/a/23873637
has comment: http://stackoverflow.com/comment/36740833
type: UnansweredQuestion
tagged with: selenium
upvote count: 1
score: 1
tagged with: java
tagged with: webdriver
type: Question
answer count: 2
downvote count: 0
has title: How to locate element from the nested frames
favorite count: 0
has comment: http://stackoverflow.com/comment/36743799
has body: I need to click id="C4_W14_V15_ZSLS-ACC" under frame WorkAreaFrame1. But i was not able switch the frame. Getting error message as Unable to locate frame: WorkAreaFrame1. Pls do the needful. I have opened a new window from parent window. In child window i need to click id="C4_W14_V15_ZSLS-ACC" under frame WorkAreaFrame1. i was not able to clcik using below code. driver.switchTo().defaultContent(); driver.switchTo().frame("WorkAreaFrame1"); driver.findElement(By.id("C4_W14_V15_ZSLS-ACC")).click(); HTML Code #document Thanks Saravanan

http://stackoverflow.com/comment/36780541
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23876113
type: Comment
has text: Yeah, sorry, instead of 's' that should be 'Hex', and the BigInteger should be 'new BigInteger.' Edited code to reflect that.

http://stackoverflow.com/a/23879109
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36759930
has comment: http://stackoverflow.com/comment/36760582
type: Answer
has body: The deleteNode method seems to return the linked list. Here's what it does: If the first element of the linked list is the item that we seek (its data matches d), then we just return the list starting from the second element (head.next). There's nothing linking back to that first element, so the first element is gone. Just what we wanted. Look through all nodes. They do this by looking at n.next. If its data matches d, then this node should be removed. So then let the list skip that element: Set n.next to be n.next.next (which is the element after it) rather than the element that matched d. Normally these kinds of methods tend to return the element that was removed. Instead, this seems to return the list itself, which is represented by its head. That's why the method keeps returning head.
answers question: http://stackoverflow.com/q/23879016
accepted answer of: http://stackoverflow.com/q/23879016

http://stackoverflow.com/q/23932061
favorite count: 0
has comment: http://stackoverflow.com/comment/89207043
score: 531
has answer: http://stackoverflow.com/a/45310076
has comment: http://stackoverflow.com/comment/88756684
has answer: http://stackoverflow.com/a/23932216
tagged with: java-8
has comment: http://stackoverflow.com/comment/36859146
has comment: http://stackoverflow.com/comment/36859193
type: AnsweredQuestion
tagged with: java-stream
linked to: http://stackoverflow.com/q/20129762
linked to: http://stackoverflow.com/q/23114015
tagged with: java
possible better answer: http://stackoverflow.com/a/41672801
type: Question
answer count: 8
has title: Convert Iterable to Stream using Java 8 JDK
has comment: http://stackoverflow.com/comment/92234308
downvote count: 0
tagged with: iterable
has answer: http://stackoverflow.com/a/41672801
has answer: http://stackoverflow.com/a/36766889
has answer: http://stackoverflow.com/a/43322051
has answer: http://stackoverflow.com/a/47095341
upvote count: 531
has comment: http://stackoverflow.com/comment/36859175
has answer: http://stackoverflow.com/a/33549645
has answer: http://stackoverflow.com/a/23936723
accepted answer: http://stackoverflow.com/a/23936723
has body: I have an interface which returns java.lang.Iterable&lt;T&gt;. I would like to manipulate that result using the Java 8 Stream API. However Iterable can't "stream". Any idea how to use the Iterable as a Stream without converting it to List?

http://stackoverflow.com/q/23924773
has body: I have a simple JAVA program that I have written in Eclipse and I am using as a building block for a larger program, for some reason, I am getting an error with the System.out.println. Thanks in advance! Error: The method println(String) in the type PrintStream is not applicable for the arguments (String, String, String) Code: package UserInfo; import java.util.*; import java.util.Scanner.*; import java.awt.*; import javax.swing.*; import java.io.*; public class UserInfo { public UserInfo() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println ("This program will gather your personal information. \n\n"); Scanner userInput = new Scanner (System.in); System.out.println ("Enter your first name: "); String firstName = userInput.nextLine(); System.out.println ("Enter your last name: "); String lastName = userInput.nextLine(); System.out.println ("Enter your street address: "); String addressStreet = userInput.nextLine(); System.out.println ("Enter your city: "); String addressCity = userInput.nextLine(); System.out.println ("Enter your two letter state abbreviation (ex:TN): "); String addressState = userInput.nextLine(); System.out.println ("Enter your 5 digit zip code: "); Integer addressZip = userInput.nextInt(); /* System.out.printf ("Enter your phone number (ex: 1234567890): "); Integer addressPhone = userInput.nextInt(); */ String addressQualified = (addressStreet + "\n" + addressCity + "" + addressState + ", " + addressZip + "\n"); String nameQualified = firstName + "" + lastName + "\n"; System.out.println ("User: ", nameQualified, "\n"); **//Error here** System.out.println ("Users Address: ", addressQualified, "\n"); **//Error here** //System.out.printf ("User Phone: ", addressPhone, "\n"); } }
has answer: http://stackoverflow.com/a/23924804
has answer: http://stackoverflow.com/a/23924800
accepted answer: http://stackoverflow.com/a/23924794
answer count: 4
possible better answer: http://stackoverflow.com/a/23924800
has title: Error printing from user input
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23924794
score: -1
has comment: http://stackoverflow.com/comment/36846293
linked to: http://stackoverflow.com/q/3406703
tagged with: eclipse
upvote count: 0
has answer: http://stackoverflow.com/a/23924822
favorite count: 0

http://stackoverflow.com/comment/36851035
type: QuestionComment
has text: @StephenC Yes the source is present.
score: 0
comment on: http://stackoverflow.com/q/23925344
type: Comment

http://stackoverflow.com/a/23874350
has body: Think of the servlet as an entry point of your application (this is server programming, so no applets involved). Let's say your form gets submitted with POST, so the entry point to your servlet would look like this: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Here you can check through the request object every parameter the user has filled into your form. For example: String address = request.getParameter("address"); Do whatever business logic you need and then send back your answer. You have some options for that: You could write HTML straight to your response.getOutputStream() method, but we don't want that normally. Or you can forward your answer to a JSP. That is a special servlet taking the shape of an HTML template. Do it by calling request.getRequestDispatcher("/my_page.jsp").forward(request, response). This will make your application server start executing your JSP. One way to hand the business logic results to the JSP for its presentation is to use the request.setAttribute and request.getAttribute methods (since your servlet and your jsp share the request object). For example: Servlet: request.setAttribute("calculation_result", new Float(324324.45f)); JSP The result is <%= request.getAttribute("calculation_result") %> Here you can find some info about writing JSPs and packaging your web application: http://www.jsptut.com/ http://www.java-tips.org/other-api-tips/eclipse/how-to-make-war-file-in-eclipse.html
downvote count: 0
answers question: http://stackoverflow.com/q/23874131
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/23789444
has title: Automatic mapping URL to View Spring MVC without controller or mapping registration
has comment: http://stackoverflow.com/comment/36801072
type: Question
has comment: http://stackoverflow.com/comment/36994720
has comment: http://stackoverflow.com/comment/36806383
has comment: http://stackoverflow.com/comment/36605557
has comment: http://stackoverflow.com/comment/36593271
has comment: http://stackoverflow.com/comment/36729934
downvote count: 0
has comment: http://stackoverflow.com/comment/36591380
has comment: http://stackoverflow.com/comment/36807441
favorite count: 0
has body: I have a project build on top of Spring Boot, using starters: spring-boot-starter-web, spring-boot-starter-thymeleaf and spring-boot-starter-security. As such, the web and the thymeleaf starters use web and thymeleaf autoconfiguration which setup some basic stuff. All the configuration is done via java config. I have a bunch of Controllers, static files residing in classpath:/static/** and templates in classpath:/templates. The Spring Boot autoconfiguration takes care of serving annotated controllers, thymeleaf templates and static files. In the case of templates, I'm serving a bunch of them by using a WebMvcConfigurerAdapter overriding addViewControllers for direct URL to View mapping, for example, mapping URL /index to view index.html gets done by registry.addViewController("/index").setViewName("index"). What I need is to establish a hierarchy of URL to Resource resolution with fallback, for example, if I type the URL /x/y/z Spring should check: For a handler in a controller function x/y/z For a bean handling x/y/z For a thymeleaf template residing in x/y/z For a static resource x/y/z ELSE RETURN NOT_FOUND 404 SOLUTION #1. User M. Deinum suggested setup a UrlFilenameViewController as a default handler either in RequestMappingHandlerMapping or BeanNameHandlerMapping. CAVEAT. That redirects works by mapping ALL requests to UrlFilenameViewController, the view gets resolved correctly but static resources, controller URL and everything else gets treated as view and thymeleaf view resolver complains by throwing a 500 error because the template was not found, so there's no graceful fallback. SOLUTION #2. Use a SimpleUrlHandlerMapping add a mapping "**/*.html" and redirect such request to a UrlFilenameViewController. CAVEAT. That gets Controllers, static resources and templates correctly resolved because request get isolated by the *.html mapping BUT if I type a /x/y/foo-bar-view.html again thymeleaf view resolver complains for a non existent template, so again no gracef…
has comment: http://stackoverflow.com/comment/36650170
has comment: http://stackoverflow.com/comment/36836114
has comment: http://stackoverflow.com/comment/36963204
answer count: 0
has comment: http://stackoverflow.com/comment/36800947
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36699758
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/36636892
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36593039
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36799116

http://stackoverflow.com/comment/36575981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23782750
has text: is `item.getSub()` your own code? Post that code pls.
score: 0

http://stackoverflow.com/q/23813611
has title: Parsing messy texts with Stanford Parser
tagged with: stanford-nlp
possible better answer: http://stackoverflow.com/a/23818916
has answer: http://stackoverflow.com/a/23836216
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36658073
accepted answer: http://stackoverflow.com/a/23836216
tagged with: nlp
type: AnsweredQuestion
tagged with: java
tagged with: error-handling
tagged with: machine-learning
has body: I am running Stanford Parser on a large chunk of texts. The parser terminates when it hits a sentence it cannot parse, and gives the following runtime error. Is there a way to make Stanford Parser ignore the error, and move on to parsing the next sentence? One way is to break down the text into a myriad of one-sentence documents, and parse each document and record the output. However, this involves loading the Stanford Parser many many times (each time a document is parsed, the Stanford Parser has to be reloaded). Loading the parser takes a lot of time, but parsing takes much shorter time. It would be great to find a way to avoid having to reload the parser on every sentence. Another solution might be to reload the parser once it hits an error, and picking up the texts where it stopped and continue parsing from there. Does anyone know of a good way to implements this solution? Last but not least, does there exist any Java wrapper that ignores errors and keeps a Java program running until the program terminates naturally? Thanks! Exception in thread "main" java.lang.RuntimeException: CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!! at edu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser.considerCreatingArrays(ExhaustivePCFGParser.java:2190) at edu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser.parse(ExhaustivePCFGParser.java:347) at edu.stanford.nlp.parser.lexparser.LexicalizedParserQuery.parseInternal(LexicalizedParserQuery.java:258) at edu.stanford.nlp.parser.lexparser.LexicalizedParserQuery.parse(LexicalizedParserQuery.java:536) at edu.stanford.nlp.parser.lexparser.LexicalizedParserQuery.parseAndReport(LexicalizedParserQuery.java:585) at edu.stanford.nlp.parser.lexparser.ParseFiles.parseFiles(ParseFiles.java:213) at edu.stanford.nlp.parser.lexparser.ParseFiles.parseFiles(ParseFiles.java:73) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.main(LexicalizedParser.java:1535)
type: Question
has answer: http://stackoverflow.com/a/23818916

http://stackoverflow.com/comment/36732356
type: Comment
type: QuestionComment
has text: it is clear from the stacktrace what you missed: *nor current process has android.permission.ACCESS_WIFI_STATE*
score: 4
comment on: http://stackoverflow.com/q/23864947

http://stackoverflow.com/q/23779674
score: 2
type: AnsweredQuestion
has title: Marshalling with XSD choice field in class
upvote count: 2
tagged with: java
tagged with: jaxb
tagged with: marshalling
type: Question
has body: I use a Java class to generate the WSDL schema dynamically. I have this as one of my fields: @XmlElements({ @XmlElement(name = "A", type = String.class), @XmlElement(name = "B", type = Integer.class), @XmlElement(name = "C", type = String.class), @XmlElement(name = "D", type = String.class) }) protected Object aOrBOrCOrD; During marshalling, when the single choice property aOrBOrCOrD is set, which tag name(A, B, C or D) would be set in the XML? Since there's only one field which would contain the data. And String could also mean any 1 of the 3 choice elements. How to get around this? Can I split the single field in 4 and still maintain the choice property when the WSDL is generated somehow?
accepted answer: http://stackoverflow.com/a/23791067
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23791067
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/23833790
has body: Another idea could be: 1 - scale the picture down to a very small size (say 100 by 100 px). 2 - analyze each pixel color in a nested for loop (for y including for x - or vice versa). 3 - if all these 10000 px have an alpha of 0 (just use a counter you increment every time the examined pixel's alpha is 0), you can affirm with good approximation that the image is completely transparent.
has comment: http://stackoverflow.com/comment/36689322
has comment: http://stackoverflow.com/comment/36683933
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23832699
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23832699
has comment: http://stackoverflow.com/comment/36672698
type: Answer
has comment: http://stackoverflow.com/comment/36674361
score: 2
has comment: http://stackoverflow.com/comment/36881832
downvote count: 0

http://stackoverflow.com/q/23908210
has answer: http://stackoverflow.com/a/23908257
favorite count: 0
has answer: http://stackoverflow.com/a/23908392
upvote count: 2
has answer: http://stackoverflow.com/a/23908309
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23908298
has answer: http://stackoverflow.com/a/23908327
has comment: http://stackoverflow.com/comment/36814975
has comment: http://stackoverflow.com/comment/36816104
has title: Constructor implementation inside an abstract class (Java)
score: 1
has body: I'm trying to create a constructor inside an abstract class and then make two other classes extend it. But - I get this yellow line under some variable saying it never read locally, but if I delete it, I get compilation errors. It looks like this: public abstract class SizeFilters { private double value; // this one never read locally private int MIN_VALUE = 0; public SizeFilters(double value) { if (value &gt;= MIN_VALUE) { this.value = value; } else { throw new IllegalArgumentException( "Value must be a positive number."); } } And the class that extends: public class GreaterThanFilter extends SizeFilters { private double value; public GreaterThanFilter(double value) { super(value); } Should I ignore that warning or is there something I do wrong? Thanks a lot!!!
tagged with: java
has comment: http://stackoverflow.com/comment/36814927
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36816035
has comment: http://stackoverflow.com/comment/36815624
has comment: http://stackoverflow.com/comment/36815282
answer count: 6
has answer: http://stackoverflow.com/a/23908322

http://stackoverflow.com/comment/36577276
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23783437
score: 0
has text: do you mean, you want to get the last instance of banglore in your string if there are multiples?

http://stackoverflow.com/q/23914397
answer count: 1
type: UnansweredQuestion
has body: I'm trying to setup a simple UDP server using Netty following the example here but using Spring for wiring dependencies. My Spring config class: @Configuration @ComponentScan("com.example.netty") public class SpringConfig { @Value("${netty.nThreads}") private int nThreads; @Autowired private MyHandlerA myHandlerA; @Autowired private MyHandlerB myHandlerB; @Bean(name = "bootstrap") public Bootstrap bootstrap() { Bootstrap b = new Bootstrap(); b.group(group()) .channel(NioDatagramChannel.class) .handler(new ChannelInitializer&lt;DatagramChannel&gt;() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ch.pipeline().addLast(myHandlerA, myHandlerB); } }); return b; } @Bean(name = "group", destroyMethod = "shutdownGracefully") public NioEventLoopGroup group() { return new NioEventLoopGroup(nThreads); } @Bean public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } My server class: @Component public class MyUDPServer { @Autowired private Bootstrap bootstrap; @Value("${host}") private String host; @Value("${port}") private int port; @PostConstruct public void start() throws Exception { bootstrap.bind(host, port).sync().channel().closeFuture().await(); /* Never reached since the main thread blocks due to the call to await() */ } } During the blocking call to await(), I don't see my application listening on the specified interface. I've tried to run the sample (setting up the server directly from the main function) and it works. I didn't find examples for setting up a UDP server using Netty and Spring. Thanks, Mickael EDIT: In order to avoid blocking the Main thread (which is used for Spring configuration), I've created a new thread as follows: @Component public class MyUDPServer extends Thread { @Autowired private Bootstrap bootstrap; @Value("${host}") private String host; @Value("${port}") private int port; public MyUDPServer() { setName("UDP Server"); } @PostConstr…
tagged with: netty
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/23914768
type: Question
has title: UDP server using Spring+Netty
score: 0

http://stackoverflow.com/a/23891332
score: 2
has body: You can iterate over hashmap as: &lt;c:forEach items="${currentLoggedInUsersMap}" var="usersMap" varStatus="usersMapStatus"&gt; //Key Key: ${usersMap.key} //Iterate over values ,assuming vector of strings &lt;c:forEach items="${usersMap.value}" var="currentLoggedInUserValue" varStatus="valueStatus"&gt; Value: ${currentLoggedInUserValue} &lt;/c:forEach&gt; &lt;/c:forEach&gt; Here ${usersMap.key} is the list of keys present in the map and ${usersMap.value} is the vector which you have to iterate again in an inner loop as shown above. Make sure to import: &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23890503
type: Answer
has comment: http://stackoverflow.com/comment/36782595
has comment: http://stackoverflow.com/comment/100122598
has comment: http://stackoverflow.com/comment/36782419

http://stackoverflow.com/comment/36656297
type: AnswerComment
has text: But then why is: String architecture = (String) jsonObject.get("ansible_architecture"); System.out.println(architecture); returning null ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23825166

http://stackoverflow.com/comment/36691905
type: Comment
type: QuestionComment
has text: but what do you want to observe? you would need to setup a bunch of listeners for every child but it's what you wanted to avoid
comment on: http://stackoverflow.com/q/23843729
score: 0

http://stackoverflow.com/comment/36851611
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23927257
has text: @David, yes, _any_ known algorithm with known input (message and any keys used to make the metadata) can be faked. Digital signatures work because there is hidden info (the private key, for example). If you separate the message and the CRC and keep control of the CRC (such as publishing it on your safe website, like MD5SUMs for ISOs), it's safer. Not _totally_ safe since there's still ways to generate arbitrary messages giving the same CRC, but it's harder. You can make it harder still by using CRC _and_ message length as the signature. But, you're right, without a secret, it can be faked.
type: AnswerComment

http://stackoverflow.com/comment/36800983
comment on: http://stackoverflow.com/q/23900735
has text: when implementing operations you must specify which is the actual type i.e. operations<matrix>
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36586219
has text: @Manu I will check how 'inflater service' works
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787381

http://stackoverflow.com/comment/36732406
comment on: http://stackoverflow.com/a/23832719
has text: Hi, I know that with final I need to byte-substract the final modifier, and I've already included that in my code. Same with the `.setAccessible(true);` for the static one. I've put my current `getPrivateField method` separately, since this is the method where it's about in my question.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23853590
has comment: http://stackoverflow.com/comment/36710756
type: UnansweredQuestion
has body: I have been trying to access the arrayList from another file. However when i was running the size it was returning 0. However running it on the class it is on would return a value. It seems that i can't access it from another class and that i am accessing it wrongly. public void test() { ArrayList&lt;Events&gt; eventArrayList = ( new ReadFile()).getList(); System.out.println(eventArrayList.size()); } public class ReadFile { //Event arraylist public ArrayList&lt;Events&gt; eventArrayList = new ArrayList&lt;Events&gt;(); System.out.println(eventArrayList.get(0).events); public ArrayList&lt;Events&gt; getList() { ArrayList&lt;Events&gt; eventArrayList = new ArrayList&lt;Events&gt;(); return eventArrayList; } }
tagged with: java
has title: Accessing ArrayList of another class returning size 0
type: Question
answer count: 1
tagged with: arraylist
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36710825
favorite count: 0
has answer: http://stackoverflow.com/a/23853622

http://stackoverflow.com/q/23875766
has title: IResourceChangeListener being called twice with one change
has comment: http://stackoverflow.com/comment/36752993
tagged with: eclipse
downvote count: 0
favorite count: 0
tagged with: listener
tagged with: changelistener
has body: I'm using the IResourceChangeListener to listen for workspace/project changes. It's implemented as proposed by the Eclipse example: IWorkspace workspace = ResourcesPlugin.getWorkspace(); IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { System.out.println("Something changed!"); } }; workspace.addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_BUILD); // some time later on ... workspace.removeResourceChangeListener(resourceChangeListener); I implemented this code in a relatively new plugin project, but whenever changes are made in the workspace "Something changed!" is thrown twice? If helpful: The class implements org.eclipse.ui.IStartup. IResourceChangeListener and resourceChanged() are created and inside of earlyStartup().
type: UnansweredQuestion
tagged with: plugins
has comment: http://stackoverflow.com/comment/36752875
has comment: http://stackoverflow.com/comment/36753347
has comment: http://stackoverflow.com/comment/36753009
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36753282
has comment: http://stackoverflow.com/comment/36752151
upvote count: 1
type: Question

http://stackoverflow.com/comment/36676853
score: 0
type: AnswerComment
type: Comment
has text: It's honestly the only solution I could think of - very strange question indeed!
comment on: http://stackoverflow.com/a/23836148

http://stackoverflow.com/q/23900328
downvote count: 1
has comment: http://stackoverflow.com/comment/36839830
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36830997
tagged with: floating-point
has comment: http://stackoverflow.com/comment/36841513
type: Question
has comment: http://stackoverflow.com/comment/36800192
tagged with: encoding
has comment: http://stackoverflow.com/comment/36800307
answer count: 1
tagged with: floating-point-precision
has answer: http://stackoverflow.com/a/23900400
has title: Are Floats' Bit Patterns Ordered?
favorite count: 0
has comment: http://stackoverflow.com/comment/36800263
has comment: http://stackoverflow.com/comment/36814281
has body: Looking at the IEEE float/double representation [mantissa sign][signed exponent][unsigned mantissa] Am I correct to assume that sorting these values numerically always results in the same as sorting the bit patterns themselves lexicographically? My other question then is how do I obtain the bits (or rather bytes) of the bit pattern (of the IEEE representation) of a float/double in Java? (Or alternatively just on the HotSpot JVM, if the internal representation isn't specified.) How would I construct an IEEE-like representation for arbitrary-precision Decimals (like java.math.BigDecimal)?
score: 6
upvote count: 7
accepted answer: http://stackoverflow.com/a/23900400
has comment: http://stackoverflow.com/comment/36800222

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23839189
tags question: http://stackoverflow.com/q/23871094
tags question: http://stackoverflow.com/q/23853585
type: Tag

http://stackoverflow.com/comment/36857059
score: 1
has text: You don't appear to have any code writing the file out again after the changes - is it that simple?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23930664

state
tag name: state
tags question: http://stackoverflow.com/q/23899144
tags question: http://stackoverflow.com/q/23778810
type: Tag

http://stackoverflow.com/q/23840296
has comment: http://stackoverflow.com/comment/36685198
type: Question
answer count: 2
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/36685192
has answer: http://stackoverflow.com/a/23840313
downvote count: 6
type: UnansweredQuestion
tagged with: multithreading
score: -3
has body: I am struggling to understand why every time I use threads in java i have call the .sleep() method first. I would like someone to explain to me why is it useful to call the sleep method. And what could happen if it is not called.
has answer: http://stackoverflow.com/a/23840310
tagged with: java
has title: Could someone explain to me what is the importance of using the sleep method of the Thread class in java

http://stackoverflow.com/q/23889488
upvote count: 4
has body: I have java code that writes arabic characters with the help of itext 5.5 and xmlworker jars, but its writing left to right even after writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL) is used. Code used is: public class CreateArabic extends DefaultHandler { /** Paths to and encodings of fonts we're going to use in this example */ public static String[][] FONTS = { {"C:/arialuni.ttf", BaseFont.IDENTITY_H}, {"C:/abserif4_5.ttf", BaseFont.IDENTITY_H}, {"C:/damase.ttf", BaseFont.IDENTITY_H}, {"C:/fsex2p00_public.ttf", BaseFont.IDENTITY_H} }; /** Holds he fonts that can be used for the peace message. */ public FontSelector fs; public CreateArabic() { fs = new FontSelector(); for (int i = 0; i < FONTS.length; i++) { fs.addFont(FontFactory.getFont(FONTS[i][0], FONTS[i][1], BaseFont.EMBEDDED)); } } public static void main(String args[]) { try { // step 1 Rectangle pagesize = new Rectangle(8.5f * 72, 11 * 72); Document document = new Document();//pagesize, 72, 72, 72, 72);// step1 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("c:\\report.pdf")); writer.setInitialLeading(200.5f); //writer.getAcroForm().setNeedAppearances(true); //writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL); document.open(); FontFactory.registerDirectories(); Font font = FontFactory.getFont("C:\\damase.ttf", BaseFont.IDENTITY_H, true, 22, Font.BOLD); // step 3 document.open(); // step 4 XMLWorkerHelper helper = XMLWorkerHelper.getInstance(); // CSS CSSResolver cssResolver = new StyleAttrCSSResolver(); CssFile cssFile = helper.getCSS(new FileInputStream( "D:\\Itext_Test\\Test\\src\\test.css")); cssResolver.addCss(cssFile); // HTML XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(); // fontProvider.addFontSubstitute("lowagie", "garamond"); CssAppliers cssAppliers = new CssAppliersImpl(fontProvider); HtmlPipelineContext htmlContext = new HtmlPipelineContext( cssAppliers); htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory()); // // Pipelines PdfWriterPipel…
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: itext
tagged with: xmlworker
type: Question
has answer: http://stackoverflow.com/a/45017696
has title: RTL not working in pdf generation with itext 5.5 for Arabic text
accepted answer: http://stackoverflow.com/a/23889677
tagged with: arabic
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/23889677
favorite count: 0
possible better answer: http://stackoverflow.com/a/45017696
tagged with: right-to-left
has answer: http://stackoverflow.com/a/26808030

http://stackoverflow.com/q/23867622
score: 1
tagged with: macos
favorite count: 0
type: Question
upvote count: 1
answer count: 1
tagged with: java
downvote count: 0
tagged with: window-handles
type: UnansweredQuestion
tagged with: jna
has body: I am looking for a way to get(in z order), move and resize visible windows on OSX using Java and JNA. Goal of the project is to manage 3rd party windows, so I do not own the windows and cannot access them via simple java code. I already do this on windows7/8, which is an easy task with the user32.dll. I already wasted hours googling but I cannot find any documentation or anything about how to accomplish this on the latest OSX. So my question is - what is the OSX equivalence to the User32.dll with stuff like FindWindow, EnumWindows, SetWindowPos etc? Or any other advice on how to accomplish something like this.
has answer: http://stackoverflow.com/a/23867756
has title: JNA - getting all visible window handles on OSX
has comment: http://stackoverflow.com/comment/96452524

http://stackoverflow.com/q/23939271
type: UnansweredQuestion
score: 3
has body: &lt;cfdirectory action="list" directory="\\uncPath\test" sort="directory ASC" name="resultQry" /&gt; Result (in CF error object): access denied (java.io.FilePermission \uncPath\test read) null I found this article: http://coldfusion-tip.blogspot.in/2012/02/file-write-operation-on-shared-path-on.html (from coldfusion-tip.blogspot) Which mentions that you need to provide the main Coldfusion Service account that's running, a service account that has access to whatever network location you're trying to access. So I did that, I added AD group permissions (which included access to \uncPath\test) to a separate service account, and am using that instead of the default local service account for the CF Application Service. I verified that the account does indeed have access to this location, by logging into another machine and navigating to the path in Windows. Wrote a test text file and moved there to verify that I had both read/write access. I tried my code again (the CFDIRECTORY) call, and it fails with the same error as before. If I try to access the same path with an absolute path which is the same location as the UNC path, it works just fine &lt;cfdirectory action="list" directory="C:\ColdFusion10\cfusion\wwwroot\test" sort="directory ASC" name="resultQry" /&gt; So CF treats the two references differently it appears. I'm just trying to figure out how/why it does, and what work-around I can use to get it to function as desired. I should also mention that IF I set myself (as the CF service account user) with my AD creds, the UNC path works just fine and can access the UNC(\uncPath\test). So I'm not sure why there's a discrepancy there between myself, and a service account user w/ the same access rights to a UNC location on the network.
tagged with: java
type: Question
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/84097984
has comment: http://stackoverflow.com/comment/36900025
has comment: http://stackoverflow.com/comment/37068373
tagged with: unc
upvote count: 4
tagged with: coldfusion
answer count: 0
has title: Coldfusion File access using UNC path - access denied

http://stackoverflow.com/q/23871978
answer count: 0
has title: android conver video to bytearray
tagged with: java
has comment: http://stackoverflow.com/comment/36745515
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36746196
tagged with: arrays
has comment: http://stackoverflow.com/comment/36747507
type: UnansweredQuestion
tagged with: android
has body: i try to conver video from sd card in byte array.i wrote code ,but i am doing something wrong.what is a wrong in my code ? i have no idea what i am doing wrong this is a my source public byte[] readBytes(Uri uri) throws IOException { InputStream inputStream = getContentResolver().openInputStream(uri); ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int len = 0; while ((len = inputStream.read(buffer)) != -1) { byteBuffer.write(buffer, 0, len); } return byteBuffer.toByteArray(); } upload_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String fileName = "video.mp4"; String completePath = Environment.getExternalStorageDirectory() + "/" + fileName; File file = new File(completePath); Uri imageUri = Uri.fromFile(file); try { byte[] bytes = readBytes(imageUri); Log.e("Byte Array is", String.valueOf(bytes)); Toast.makeText(getApplicationContext(), String.valueOf(bytes), Toast.LENGTH_LONG).show(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); i run my app and result is small streang,not byte array

http://stackoverflow.com/q/23904263
answer count: 1
has comment: http://stackoverflow.com/comment/36807530
has comment: http://stackoverflow.com/comment/36863907
has comment: http://stackoverflow.com/comment/36807909
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-studio
type: AnsweredQuestion
has title: How to create fullscreen theme for ImageView in android?
tagged with: java
has comment: http://stackoverflow.com/comment/36807845
type: Question
has comment: http://stackoverflow.com/comment/36807824
has body: I want to put an ImageView in my application and then set it to fullscreen. I had tried following code in Android Studio.(and I also tried in Eclipse IDE) My minimum required SDK : API 8:Android 2.2 froyo, Target SDK : API 19:Android 4.4 KitKat, Compile With : API 19:Android 4.4 KitKat, Langauge Level :6.0-ovrrride in interface, Theme :Holo Light With Dark Action Bar. Then in activity_main.xml code is below: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.example.crystal.app.MainActivity"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_alignParentLeft="true" android:src="@drawable/ddd" /> </RelativeLayout> Where I set theme as Theme.Black.NoTitleBar.Fullscreen. and I changed AndroidManifest.xml code is below: <?xml version="1.0" encoding="utf-8"?> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Then I run the Application in AVD but when I open Application it shows the error like: Unfortunately,(app name) has Stopped (and OK button) So ,What is wrong with my code. and also tell that in how many ways I can do this. Thank you in advance.
has answer: http://stackoverflow.com/a/23931607
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/23931607
score: 0

http://stackoverflow.com/q/23901929
has comment: http://stackoverflow.com/comment/36829147
has answer: http://stackoverflow.com/a/23902332
has title: recording terminal inputs in java
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36803597
upvote count: 1
has answer: http://stackoverflow.com/a/23916194
score: 1
tagged with: java
has body: I am developing a tool for my school lab. In which Student uses terminal and I want to extract there input record for instructor (log file). I know file input output and so far I have been successful to open terminal. Using this in class data Process pr; In function String command= "/usr/bin/xterm"; Runtime rt = Runtime.getRuntime(); try { pr = rt.exec(command); } catch (IOException e1) { e1.printStackTrace(); } and to exit the terminal, I am using,(if condition because student might not have yet opened terminal and log out) if(pr!=null) pr.destroy(); Now in logout part I want to exit terminal and store the input log. Need some pointer on how to get out inputs.
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/36748293
comment on: http://stackoverflow.com/q/23873460
score: 0
type: QuestionComment
type: Comment
has text: Yes @reto I'm using Eclipse!

http://stackoverflow.com/a/23905919
type: Answer
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/36811232
answers question: http://stackoverflow.com/q/23905748
has comment: http://stackoverflow.com/comment/36810741
score: 3
accepted answer of: http://stackoverflow.com/q/23905748
has body: This is indeed valid code, without seeing everything, I can see some odditities: 'Incorrect' variable and method naming, using PascalCase sometimes. Instance variable token Static variable IDENTIFIER Then: label_23: while (true) { if (jj_2_17(2)) { ; } else { break label_23; } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); ret = new QualifiedNameExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, token.image); } This is an infinite loop that keeps running as long as jj_2_17(2) returns true, but appears to do nothing upon that result. It breaks out of label_23 when the expression was false. To confuse future readers even more, it then actually does things only if the expression is true (as it breaks on false), namely the last three lines. For futher information, the label_23 is simply a label that may only be used on while and for loops. You can then break out of that loop when using break labelName;. Example that breaks out of an outer loop from within an inner loop: outerLoop: for (int i = 0; i &lt; max; i++) { innerLoop: for (int j = 0; j &lt; max2 - i; j++) { if (something) { break outerLoop; } //... } } You can actually also use continue in combination with labels. Then we see a scoped block without guard that always returns ret: { if (true) { return ret; } } So it's all valid. I think we can also conclude with high chance that this code has been machine-generatd.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36810721

http://stackoverflow.com/comment/36759909
comment on: http://stackoverflow.com/q/23879414
score: 0
has text: @Vandale Thank you it actually worked! and made life easier!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23879058
has comment: http://stackoverflow.com/comment/36759138
answer count: 1
tagged with: facebook-graph-api
has comment: http://stackoverflow.com/comment/36759132
has comment: http://stackoverflow.com/comment/36759330
type: UnansweredQuestion
tagged with: facebook
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37268667
has comment: http://stackoverflow.com/comment/36759232
has answer: http://stackoverflow.com/a/43272557
has title: Get information about a page using facebook4j
has comment: http://stackoverflow.com/comment/36759063
tagged with: facebook-graph-api-v2.0
score: 0
has body: Is there a possibility to get the String of the page's information in the about section? An Example: https://www.facebook.com/FacebookDevelopers Here is the info: "Build, grow, and monetize your app with Facebook. https://developers.facebook.com/" I found out that the Facebook graph api supports this by the Field about on a Page. Thanks for help in advance! Best regards, Dominic
has comment: http://stackoverflow.com/comment/37268539
tagged with: facebook-page

http://stackoverflow.com/q/23934675
linked to: http://stackoverflow.com/q/21532761
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/36921821
has comment: http://stackoverflow.com/comment/36864202
has title: repeating animation using java.swingTimer
linked to: http://stackoverflow.com/q/22123266
score: 0
linked to: http://stackoverflow.com/q/21587972
answer count: 1
has answer: http://stackoverflow.com/a/23934958
linked to: http://stackoverflow.com/q/21289140
type: UnansweredQuestion
tagged with: animation
has body: I am writing the code of Game bean machine (Galton box) using animated graphics. I am using swing.Timer to make the red ball move, by letting the Timer object take an ActionListener. Here is the output: The red ball here is moving randomly : http://imgur.com/J9Xq0t5&amp;HIv1udp And here it reaches the bottom: http://imgur.com/J9Xq0t5&amp;HIv1udp#1 The problem is that I want to make several balls moving not only 1 but I actually cannot, I tried to put the Timer object in a loop but it only speeded up the ball motion. Here is the code I wrote: import java.awt.*; import java.awt.event.*; import java.util.Random; import java.util.Scanner; import javax.swing.*; public class GameBean extends JFrame{ private int nSlots; private int balls; public GameBean (int nSlots, int balls){ this.balls=balls; this.nSlots=nSlots; Timer timer=new Timer(500,new RandomListener()); timer.start(); JPanel panel = new JPanel(); this.add(canvas); } Ball canvas = new Ball(); public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Please enter number of slots: "); int nSlots=input.nextInt(); JFrame frame = new GameBean (nSlots, 5); frame.setTitle("Bean Game Machine"); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setSize(300, 500); frame.setVisible(true); } class RandomListener implements ActionListener { public void actionPerformed(ActionEvent e) { canvas.moveRandom(); } } class Ball extends JPanel{ Random rand=new Random(); private int n; private int raduis = 10; private int moveRaduis=12; private int L = 0; private int R = 0; private int D = 0; protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.RED); g.fillOval(getWidth()/2 -raduis/2 + R + L, 0 + D , moveRaduis, moveRaduis); repaint(); int i=0; int width=(getWidth()/8); int space=(getWidth()-nSlots*30)/2; g.setColor(Color.BLACK); for(i=0;i&lt;=nSlots;i++){ g.drawLine(space+(30*i),getHeight()-balls*(raduis) ,space+(30*i) ,getH…
linked to: http://stackoverflow.com/q/23964875
linked to: http://stackoverflow.com/q/21868170
linked to: http://stackoverflow.com/q/21800466
tagged with: java
tagged with: swing
linked to: http://stackoverflow.com/q/22283462
tagged with: javax.swing.timer

http://stackoverflow.com/q/23929617
has comment: http://stackoverflow.com/comment/36854870
score: 1
has comment: http://stackoverflow.com/comment/36854781
has comment: http://stackoverflow.com/comment/36854832
upvote count: 1
tagged with: methods
type: Question
has title: A sorta extentsion on a method java
tagged with: java
has answer: http://stackoverflow.com/a/23929822
has answer: http://stackoverflow.com/a/23929702
answer count: 3
downvote count: 0
has body: So i'm creating a API to java and i need a extention like thing on my method. Example: someMethod().getName(); Something like that. Anyone know how?
favorite count: 0
has comment: http://stackoverflow.com/comment/36854817
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23929695

http://stackoverflow.com/comment/36845087
comment on: http://stackoverflow.com/q/23921860
has text: I figured it out in the Action methods I declared OpType instead of opType..Thanks for the help!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23872602
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36746414
has answer: http://stackoverflow.com/a/23872711
has body: I have to simulate the activity of a postal office, where an office worker can offer many services like paying bills, send letters etc. I have created a separate application which simulates the incoming clients and store them in the database. The second application has to manage the "clients" from the database and assign to each office worker "clients" that have requested specific tasks. If the office worker is busy then the client should be added in a waiting queue. Each office worker should do the job in a new thread. The problem is that when i run the application only one thread is doing his job. Then the application stops. Anyone has any suggestions on how can i implement this application using multithreading? Office worker class import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Random; import ro.csm.database_access.OperationDatabaseAccess; import ro.csm.database_access.TaskDatabaseAccess; public class OfficeWorker { //each office worker has a queue of tasks, a list of supported operations, an office and a thread private Queue&lt;Task&gt; tasks; private List&lt;Operation&gt; supportedOperations; private Thread workingThread; private Office office; //constructor public OfficeWorker(Office office){ this.office = office; supportedOperations = OperationDatabaseAccess.getAllSupportedOperations(office.getId()); workingThread = new Thread(); workingThread.start(); setTasks(new LinkedList&lt;Task&gt;()); } //add task to the tasks queue public void addTask(Task task){ getTasks().add(task); } //finish the task public void work(){ while(true){ Task t = getTasks().poll(); if(t != null){ TaskDatabaseAccess.setTaskCompleted(t.getId()); try { Thread.sleep(getCompletionTime(t)); workingThread.stop(); } catch (InterruptedException e) { e.printStackTrace(); } } } } //generate a random completion time for each task considering the minimum time and the maximum time allocated for a task private int getCompletionTime(Task t){ Operation op = …
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has title: Java Multithreading application issue
accepted answer: http://stackoverflow.com/a/23872711
has comment: http://stackoverflow.com/comment/36844741

http://stackoverflow.com/a/23984139
has comment: http://stackoverflow.com/comment/36995122
has body: The @SuppressWarnings annotation can only be used at the point of a declaration. Even with the Java 8 annotation enhancements that allow annotations to occur in other syntactic locations, the @SuppressWarnings annotation can't be used where you need it in this case, that is, at the point where a deprecated interface occurs in the implements clause. You're right to want to avoid putting @SuppressWarnings on the class declaration, since that will suppress possibly unrelated warnings throughout the entire class. One possibility for dealing with this is to create an intermediate interface that extends the deprecated one, and suppress the warnings on it. Then, change the uses of the deprecated interface to the sub-interface: @SuppressWarnings("deprecation") interface SubBaz extends DeprecatedBaz { } public class Foo ... implements SubBaz ... This works to avoid the warnings because class annotations (in this case, @Deprecated) are not inherited.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23820581
answers question: http://stackoverflow.com/q/23820581
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36995621
score: 5
has comment: http://stackoverflow.com/comment/36997588

http://stackoverflow.com/comment/36765216
comment on: http://stackoverflow.com/q/23882057
has text: Thanks Hirak, but I am using downloaded 'protoc-1.0M4.jar' file. I am much unaware about changing or debugging it.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/23930117
has comment: http://stackoverflow.com/comment/36856737
downvote count: 1
accepted answer: http://stackoverflow.com/a/23936291
type: Question
has comment: http://stackoverflow.com/comment/36857397
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/41018271
tagged with: java
has answer: http://stackoverflow.com/a/41018271
linked to: http://stackoverflow.com/q/4096169
score: 0
answer count: 2
has title: Android app crashes after clearing RAM memory
has body: I've android app which works fine. But when i try to clean the memory and then try to open, it crashes and gives NullPointerException in several places. I know that when user clears memory then android clears all variables and sharedPreferences. Now my question is there a way we can know when user clears RAM memory in phone settings. Here is the Logcat 05-29 15:34:19.813: E/AndroidRuntime(4932): FATAL EXCEPTION: main 05-29 15:34:19.813: E/AndroidRuntime(4932): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.softwaysolutions.rcommunication/com.softwaysolutions.rcommunication.MainActivity}: java.lang.NullPointerException 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2113) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.app.ActivityThread.access$700(ActivityThread.java:139) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1224) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.os.Handler.dispatchMessage(Handler.java:99) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.os.Looper.loop(Looper.java:137) 05-29 15:34:19.813: E/AndroidRuntime(4932): at android.app.ActivityThread.main(ActivityThread.java:4918) 05-29 15:34:19.813: E/AndroidRuntime(4932): at java.lang.reflect.Method.invokeNative(Native Method) 05-29 15:34:19.813: E/AndroidRuntime(4932): at java.lang.reflect.Method.invoke(Method.java:511) 05-29 15:34:19.813: E/AndroidRuntime(4932): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 05-29 15:34:19.813: E/AndroidRuntime(4932): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 05-29 15:34:19.813: E/AndroidRuntime(4932): at dalvik.system.NativeStart.main(Native Method) 05-29 15:34:19.813: E/AndroidRuntime(4932): Caused by: java.lang.…
has comment: http://stackoverflow.com/comment/36855942
favorite count: 0
has answer: http://stackoverflow.com/a/23936291
has comment: http://stackoverflow.com/comment/36856579
tagged with: android
type: AnsweredQuestion
tagged with: ram
has comment: http://stackoverflow.com/comment/36855912
upvote count: 1

android-actionbar
tags question: http://stackoverflow.com/q/23852107
type: Tag
tags question: http://stackoverflow.com/q/23843910
tags question: http://stackoverflow.com/q/23810940
tags question: http://stackoverflow.com/q/23829913
tags question: http://stackoverflow.com/q/23862586
tags question: http://stackoverflow.com/q/23887667
tag name: android-actionbar
tags question: http://stackoverflow.com/q/23783496
tags question: http://stackoverflow.com/q/23871094

http://stackoverflow.com/q/23806825
has title: How to combine scanner and multimap?
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/23807049
type: Question
has comment: http://stackoverflow.com/comment/36620929
has comment: http://stackoverflow.com/comment/36620752
has comment: http://stackoverflow.com/comment/36620986
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23807726
favorite count: 0
tagged with: multimap
tagged with: java.util.scanner
accepted answer: http://stackoverflow.com/a/23807726
has comment: http://stackoverflow.com/comment/36621313
has comment: http://stackoverflow.com/comment/36621149
has answer: http://stackoverflow.com/a/23807049
type: AnsweredQuestion
has body: I have two files and am trying to read each file line by line by using scanner. Also, I would like to combine these two file with the same Key(name) by using multimap in order to combine these two file into one. Here is the script I have so far. Can someone please give me the suggestion? Thank you. 001.csv contains: David 188 Male doctor A Jacob 190 Male CEO A+ Sam 175 Male Engineer A- 002.txt contains: David 80kg US3000 Jacob 70kg US100000 Sam 65kg US80000 Source code: public class same_test{ public static void main (String[] args) throws FileNotFoundException { MultiMap multiMap = new MultiValueMap(); Scanner scanner1 = new Scanner(new File("001.csv")); Scanner scanner2 = new Scanner(new File("002.txt")); while (scanner1.hasNextLine()) { String line = scanner1.nextLine(); String[] array = line.split("\t",2); String TheName = array[0]; String score = array[1]; multiMap.put(TheName,score); } while (scanner2.hasNextLine()) { String line2 = scanner2.nextLine(); String[] array2 = line2.split("\t",2); String TheName2 = array2[0]; String rs = array2[1]; multiMap.put(TheName2,rs); } Set&lt;String&gt; keys = multiMap.keyset(); for (String key : keys){ System.out.println(key + "\t" + multiMap.get(key) ); } } }

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

http://stackoverflow.com/a/23927111
accepted answer of: http://stackoverflow.com/q/23923886
has comment: http://stackoverflow.com/comment/36874860
upvote count: 13
has comment: http://stackoverflow.com/comment/36886944
answers question: http://stackoverflow.com/q/23923886
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36874781
has comment: http://stackoverflow.com/comment/36886615
type: Answer
has comment: http://stackoverflow.com/comment/36886986
has body: You get the LazyInitializationException because after you get out of the stateRepository.findByName("New Delhi"), the Hibernate Session gets closed, and you are not able to fetch additional associations outside of a running Hibernate Session. Adding @Transactional to your test will fix this issue and you won't have to call: states.get(0).fetchLazyCollection(); It's best to fetch the lazy associations you need in the original entity query: select s from State s left join fetch s.constituencies where s.name = :stateName
has comment: http://stackoverflow.com/comment/36884391
has comment: http://stackoverflow.com/comment/36884427
score: 13

http://stackoverflow.com/q/23851301
has comment: http://stackoverflow.com/comment/36707259
accepted answer: http://stackoverflow.com/a/24029342
has comment: http://stackoverflow.com/comment/36706384
has answer: http://stackoverflow.com/a/24029492
has comment: http://stackoverflow.com/comment/36706523
possible better answer: http://stackoverflow.com/a/24029224
has title: NullPointer exception when connecting to a mySQL database in Java EE
has answer: http://stackoverflow.com/a/24029224
answer count: 4
has body: I am trying to connect to a mySql database from a servelet, but when i try to do that, i get a null pointer exception: Connection: try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql://localhost/bmistore", "bmiuser", "yMMECajG99yE4YWE"); } catch (Exception e) { System.out.println("No DB found"); connection = null; } } Usage: public List&lt;String&gt; getAllNames() { System.out.println("Test"); List&lt;String&gt; names = new ArrayList&lt;&gt;(); try { Statement statement = connection.createStatement(); ResultSet results = statement .executeQuery("SELECT name FROM patients"); System.out.println("TEST 2"); //Add all names to array while (results.next()) { String name = results.getString("name"); names.add(name); } } catch (SQLException e) { System.out.println("getAllNames: " + e.getMessage()); } return names; I have a .sql file in a Folder called RemoteSystemsTempFiles. I'm not sure why it is there, because I'm using an example provided by my lecturer. Thank you for your time. Exception Stack trace: May 25, 2014 11:38:09 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [Main] in context with path [/BMISystem] threw exception java.lang.NullPointerException at PatientManager.getAllNames(PatientManager.java:42) at Main.doGet(Main.java:48) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav a:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVa…
score: 0
has answer: http://stackoverflow.com/a/24029342
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23851952
tagged with: java
has comment: http://stackoverflow.com/comment/36707238
tagged with: mysql
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37041688

http://stackoverflow.com/comment/36719777
score: 0
has text: @Saphire Did you read the javadoc of `SortedMap` ?.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23858238

lwjgl
tags question: http://stackoverflow.com/q/23851320
tag name: lwjgl
tags question: http://stackoverflow.com/q/23856505
tags question: http://stackoverflow.com/q/23837446
tags question: http://stackoverflow.com/q/23846399
tags question: http://stackoverflow.com/q/23935973
tags question: http://stackoverflow.com/q/23795010
tags question: http://stackoverflow.com/q/23936701
tags question: http://stackoverflow.com/q/23859452
type: Tag
tags question: http://stackoverflow.com/q/23891763
tags question: http://stackoverflow.com/q/23796321

maven
tags question: http://stackoverflow.com/q/23780147
tags question: http://stackoverflow.com/q/23832192
tags question: http://stackoverflow.com/q/23792614
tags question: http://stackoverflow.com/q/23810502
tags question: http://stackoverflow.com/q/23923323
tags question: http://stackoverflow.com/q/23855807
tags question: http://stackoverflow.com/q/23804761
tags question: http://stackoverflow.com/q/23883939
tags question: http://stackoverflow.com/q/23914917
tags question: http://stackoverflow.com/q/23859080
tags question: http://stackoverflow.com/q/23888072
tags question: http://stackoverflow.com/q/23870654
tags question: http://stackoverflow.com/q/23867246
type: Tag
tags question: http://stackoverflow.com/q/23874002
tags question: http://stackoverflow.com/q/23778633
tags question: http://stackoverflow.com/q/23931718
tags question: http://stackoverflow.com/q/23814482
tags question: http://stackoverflow.com/q/23809704
tags question: http://stackoverflow.com/q/23835472
tags question: http://stackoverflow.com/q/23891586
tags question: http://stackoverflow.com/q/23805576
tags question: http://stackoverflow.com/q/23882961
tags question: http://stackoverflow.com/q/23831811
tags question: http://stackoverflow.com/q/23862279
tags question: http://stackoverflow.com/q/23786667
tags question: http://stackoverflow.com/q/23928128
tags question: http://stackoverflow.com/q/23866939
tags question: http://stackoverflow.com/q/23874328
tags question: http://stackoverflow.com/q/23913346
tags question: http://stackoverflow.com/q/23906737
tags question: http://stackoverflow.com/q/23903425
tags question: http://stackoverflow.com/q/23891067
tags question: http://stackoverflow.com/q/23804379
tags question: http://stackoverflow.com/q/23839001
tags question: http://stackoverflow.com/q/23816511
tags question: http://stackoverflow.com/q/23894887
tags question: http://stackoverflow.com/q/23916949
tags question: http://stackoverflow.com/q/23901735
tags question: http://stackoverflow.com/q/23791195
tags question: http://stackoverflow.com/q/23781719
tags question: http://stackoverflow.com/q/23866172
tags question: http://stackoverflow.com/q/23938000
tags question: http://stackoverflow.com/q/23871255
tags question: http://stackoverflow.com/q/23784617
tags question: http://stackoverflow.com/q/23877521
tags question: http://stackoverflow.com/q/23938146
tags question: http://stackoverflow.com/q/23873482
tags question: http://stackoverflow.com/q/23825768
tags question: http://stackoverflow.com/q/23834167
tags question: http://stackoverflow.com/q/23849944
tags question: http://stackoverflow.com/q/23806343
tags question: http://stackoverflow.com/q/23783657
tags question: http://stackoverflow.com/q/23916403
tags question: http://stackoverflow.com/q/23901666
tags question: http://stackoverflow.com/q/23881074
tags question: http://stackoverflow.com/q/23785861
tags question: http://stackoverflow.com/q/23778201
tags question: http://stackoverflow.com/q/23815817
tags question: http://stackoverflow.com/q/23899295
tags question: http://stackoverflow.com/q/23873041
tags question: http://stackoverflow.com/q/23915658
tags question: http://stackoverflow.com/q/23820725
tags question: http://stackoverflow.com/q/23933256
tags question: http://stackoverflow.com/q/23919541
tags question: http://stackoverflow.com/q/23894804
tags question: http://stackoverflow.com/q/23874693
tags question: http://stackoverflow.com/q/23916211
tags question: http://stackoverflow.com/q/23869027
tags question: http://stackoverflow.com/q/23806410
tags question: http://stackoverflow.com/q/23895663
tags question: http://stackoverflow.com/q/23834809
tags question: http://stackoverflow.com/q/23787943
tags question: http://stackoverflow.com/q/23814921
tags question: http://stackoverflow.com/q/23909213
tags question: http://stackoverflow.com/q/23830740
tags question: http://stackoverflow.com/q/23823106
tags question: http://stackoverflow.com/q/23847934
tags question: http://stackoverflow.com/q/23938633
tags question: http://stackoverflow.com/q/23887323

http://stackoverflow.com/q/23829896
has answer: http://stackoverflow.com/a/23875888
has title: Call multiple time JNI in single Tread
type: UnansweredQuestion
tagged with: java-native-interface
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36711002
has comment: http://stackoverflow.com/comment/36683876
score: 0
has body: I need to call some methods from a jar using JNI in c++.But i need to call it a lot of times in different instances of thesame class. My JNI is something like this JavaVM *jvm; /* denotes a Java VM */ JNIEnv *env; /* pointer to native method interface */ JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */ jmethodID Sim_constr = NULL; jmethodID Read_XML = NULL; jmethodID configure = NULL; jmethodID initial = NULL; jmethodID results = NULL; jint step = 60; JavaVMOption* options = new JavaVMOption[1]; options[0].optionString = "-Djava.class.path=&lt;My jar&gt;"; vm_args.version = JNI_VERSION_1_8; vm_args.nOptions = 1; vm_args.options = options; vm_args.ignoreUnrecognized = JNI_TRUE; /* load and initialize a Java VM, return a JNI interface * pointer in env */` long status = JNI_CreateJavaVM(&amp;jvm, (void**)&amp;env, &amp;vm_args); if (status == JNI_ERR){ exit(10); } //Some Java method Calls... ` I need to set once the JNI and then just call 3-4 methods OR to kill/delete completely the JNI parameters and then create it again.
tagged with: c++

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23827757
tags question: http://stackoverflow.com/q/23880272
tags question: http://stackoverflow.com/q/23813727
type: Tag

http://stackoverflow.com/a/23923542
has body: Don't use a @SessionScoped bean to back a page; it's a JSF design-smell (if there's such a thing) Use the preRenderView event to trigger (or check) whatever validation logic you choose on page load. As a start: &lt;f:event type="preRenderView" listener="#{bean.validate}" rendered="#{facesContext.postBack}" /&gt; The &lt;f:event/&gt; tag registers an event listener on your page. The type="preRenderView" attribute stipulates that the event should be executed just before the page is loaded rendered="#{facesContext.postBack}" is going to ensure that the event is loaded only when the same page is being refreshed, and not when it's being loaded for the first time listener will refer to a backing bean method in which you carry out the validation that you require. In this listener, you can throw a ValidationException and also queue FacesMessages appropriately Alternatives: You can reference the component's value in a viewParam and attach the same validator to that component: &lt;f:metadata&gt; &lt;f:viewParam name="theParam" rendered="#{facesContext.postBack}" value="param['form:input2']" validator="customValidator"/&gt; &lt;/f:metadata&gt; What this would do is attempt to resubmit the value of the input2 component as a view parameter. A view parameter (in this usage) is a UIComponent like any other, and is subject to the same conversion/validation semantics. You could also pass the entire component as an attribute on the viewParam, if you want a more involved handling of the content of that component. First bind the input2 component to the page scope: &lt;h:inputText id="input2" binding="#{input2}" value="#{bean.property}"&gt; &lt;f:validator validatorId="customValidator" /&gt; &lt;f:ajax execute="@form" render="@this" /&gt; &lt;/h:inputText&gt; Then pass the component as an attribute: &lt;f:metadata&gt; &lt;f:viewParam name="theParam" rendered="#{facesContext.postBack}" validator="customValidator"/&gt; &lt;f:attribute name="input2" value="#{input2}"/&gt; &lt;/f:metadata&g…
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36972693
type: Answer
has comment: http://stackoverflow.com/comment/37006489
has comment: http://stackoverflow.com/comment/36970018
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37020407
has comment: http://stackoverflow.com/comment/36973697
has comment: http://stackoverflow.com/comment/36893108
accepted answer of: http://stackoverflow.com/q/23831706
answers question: http://stackoverflow.com/q/23831706
has comment: http://stackoverflow.com/comment/36892428
has comment: http://stackoverflow.com/comment/36891118

http://stackoverflow.com/comment/36642057
score: 0
type: Comment
type: QuestionComment
has text: what is your desired JSON format?
comment on: http://stackoverflow.com/q/23816143

http://stackoverflow.com/q/23821265
has title: Exception in hibernate
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23821635
tagged with: eclipse
type: Question
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23821389
has body: I am trying to develop a dynamic web project in Eclipse. I am using hibernate 3, tomcat 6 . My web page has a simple registration form. It accepts the user data and adds it to the db. I am using hibernate to do that part. I am getting this error. Have tried the solutions given in some of the similar questions asked but could not solve the issue. The error that I get is log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. May 23, 2014 10:20:30 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet NavigationController threw exception 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.pkg.dao.UserDAO.registeruser(UserDAO.java:58) at com.pkg.controller.NavigationController.doPost(NavigationController.java:60) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 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:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Htt…
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/23842066

http://stackoverflow.com/q/23876964
answer count: 1
has title: Comparing elements in an 2D array
favorite count: 0
has comment: http://stackoverflow.com/comment/36754898
has comment: http://stackoverflow.com/comment/36755316
has body: I created the following table using jtextUtils Now I want to do the following for every row, if every column, starting at column 3 are equal to each other, write an "x" to the "False?" column. This is the 2D array I have, it is already filled with elements: String [][] cPosTags = new String[x][y];
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36754585
accepted answer: http://stackoverflow.com/a/23876995
score: -4
has comment: http://stackoverflow.com/comment/36755302
has comment: http://stackoverflow.com/comment/36754844
has comment: http://stackoverflow.com/comment/36754968
type: Question
has comment: http://stackoverflow.com/comment/36754769
tagged with: java
downvote count: 4
has comment: http://stackoverflow.com/comment/36755207
has comment: http://stackoverflow.com/comment/36755051
has answer: http://stackoverflow.com/a/23876995
upvote count: 0

http://stackoverflow.com/a/23840918
type: Answer
has comment: http://stackoverflow.com/comment/36686648
has comment: http://stackoverflow.com/comment/36686704
downvote count: 0
score: 1
has body: even though B is derived from A. You have to be careful here -- Java's generics are invariant, meaning that Something&lt;Superclass&gt; is not a superclass of Something&lt;Subclass&gt; (e.g. List&lt;Number&gt; is not a superclass of List&lt;Integer&gt;). There are plenty of questions on SO about this, so I won't repeat information that other people can explain much more effectively, like here and here. As for your second signature, it seems to me that the T in (parameters, T) is unnecessary. public &lt;T&gt; List&lt;T&gt; getAllSuitableInstance(parameters); should work, unless I'm misunderstanding your requirements. The disadvantage of this is that T could be anything, so you're somewhat limited in the methods you can invoke on objects of type T, but if you aren't doing that then no concern is warranted. If the methods in your interfaces are necessary to get your method working (doesn't seem like it, but just in case), you can always add bounds (e.g. public &lt;T extends A&gt; List&lt;T&gt;...) to your generic type, so the compiler knows that all instances of T inside your method are type A or subtypes of A. If you need to use the type of T in your method (say for instanceof checks), one option is passing in a Class object and using its methods to perform the runtime equivalent of instanceof checks and casting (among other options): public &lt;T&gt; List&lt;T&gt; getAllSuitableInstance(parameters, Class&lt;? extends T&gt; clazz); // Might be able to use just Class&lt;T&gt; too Hopefully that helps. Let me know if I got something wrong about what you needed.
accepted answer of: http://stackoverflow.com/q/23840887
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23840887
upvote count: 1

http://stackoverflow.com/comment/36647189
has text: @user3580294 at Apps.addPrerequisite(Apps.java:160) and at guiStyle$act.actionPerformed(guiStyle.java:666)
comment on: http://stackoverflow.com/q/23820282
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23935958
has comment: http://stackoverflow.com/comment/36873359
has comment: http://stackoverflow.com/comment/36866706
tagged with: java
has comment: http://stackoverflow.com/comment/36873090
has answer: http://stackoverflow.com/a/23939518
downvote count: 0
has body: I have seen in a post https://stackoverflow.com/a/23934422/2194456 class Test { String s = "1"; } ... MyClassLoader cl = new MyClassLoader(); Object obj = cl.loadClass("Test").newInstance(); obj = null; cl = null; // now "1" is eligible for GC if no other class or object references it Does this really work ?
score: 1
tagged with: string
has comment: http://stackoverflow.com/comment/36867042
accepted answer: http://stackoverflow.com/a/23939518
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36875711
has title: Can String Literals become eligible for garbage collection. In this manner?
has comment: http://stackoverflow.com/comment/36880855
linked to: http://stackoverflow.com/q/23933912
favorite count: 0
has comment: http://stackoverflow.com/comment/36875873
tagged with: garbage-collection
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36860186
comment on: http://stackoverflow.com/a/23932116
score: 0
type: AnswerComment
type: Comment
has text: can you remove the binding part, and work with `movimientoBean.movimientoCab.fechaContable` property ?

http://stackoverflow.com/comment/36729889
comment on: http://stackoverflow.com/a/23852789
has text: @WaseemFarooqui what fixed the issue?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36755944
comment on: http://stackoverflow.com/q/23877549
score: 0
has text: Are you saying that just by _initializing_ a TextArea the buttons dissapear? Or is your code incomplete?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23790514
has answer: http://stackoverflow.com/a/23790624
downvote count: 0
favorite count: 0
tagged with: lambda
has title: Java 8 Lambda Replacement for Apache Commons CollectionsUtils.select
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23790624
tagged with: java-stream
upvote count: 2
has body: I have the following code using Apache Commons lib: public static List&lt;Address&gt; addressesHasType(final List&lt;Address&gt; addresses, final AddressType... types) { return (List&lt;Address&gt;) CollectionUtils.select(addresses, new Predicate() { @Override public boolean evaluate(final Object object) { boolean isContains = false; for (int i = 0; i &lt; types.length &amp;&amp; !isContains; i++) { isContains = ((Address) object).getTypes().contains(types[i]); } return isContains; } }); } I trying to make to refactor it to use only lambda and Java 8 without Apache Commons lib, something like this: List&lt;Address&gt; addressList = addresses.stream() .filter(a -&gt; a.getTypes().contains(types)).collect(Collectors.toList()); But the list become empty in the end. I tried using findFirst() to but it does not returns a List but a Optional object. addressList2 = addresses.stream() .filter(a -&gt; a.getTypes().contains(types)).findFirst(); How I can do this?
tagged with: java-8
type: Question
tagged with: apache-commons
tagged with: java
possible better answer: http://stackoverflow.com/a/23790571
has answer: http://stackoverflow.com/a/23790571
answer count: 2

http://stackoverflow.com/comment/36843237
has text: If you would do a simple maze, what code would you use?
comment on: http://stackoverflow.com/a/23923047
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/37285535
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24098467
score: 1
has text: Its javac, but that wasn't the problem. I remembered that I had set up a cygwin 64 on another computer. I went through all of it again and somehow the problem is not present anymore?!

http://stackoverflow.com/a/23903652
type: Answer
has body: Solved this problem by using joda-time
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23902492
answers question: http://stackoverflow.com/q/23902492

http://stackoverflow.com/q/23813131
has answer: http://stackoverflow.com/a/35998888
answer count: 2
possible better answer: http://stackoverflow.com/a/23815139
downvote count: 0
has title: Can JAX-RS construct an object using only @*Param annotations?
tagged with: jax-rs
has answer: http://stackoverflow.com/a/23815139
favorite count: 0
tagged with: resteasy
accepted answer: http://stackoverflow.com/a/35998888
type: AnsweredQuestion
has body: Is it possible to get a JAX-RS implementation such as RESTEasy to automatically construct an object containing only @*Param annotations, such as @MatrixParam? I have the following class representing pagination: public class Pagination { @MatrixParam("after") public String afterKey; @MatrixParam("from") public String fromKey; @MatrixParam("to") public String toKey; @MatrixParam("before") public String beforeKey; @MatrixParam("count") public int count; } I'd like to pass it to JAX-RS methods such as this: @GET @Produces("text/html") Response asHtml(Pagination pagination); I was hoping RESTEasy would call the default constructor and then inject the field values, but I get a "Could not find message body reader" error. Obviously, there is no message body, and adding a dummy String constructor did not help. Do I need to create my own @Provider for this? If so, could such a thing be made generic and leverage the built-in @*Param injection features?
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/5875772
type: Question

http://stackoverflow.com/a/27609909
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23937578
type: Answer
answers question: http://stackoverflow.com/q/23937578
has body: This problem was caused because to add a context menu to all children, you simply add a context menu to the parent. However, this is only supported with other views (e.g. ListView), not layouts.
upvote count: 1

http://stackoverflow.com/comment/61431160
comment on: http://stackoverflow.com/a/23941394
type: Comment
has text: Always forgetting about that
type: AnswerComment
score: 0

http://stackoverflow.com/a/23838865
has body: I'm not sure whether it helps (sorry but your code is too large and bad formatted, so I cannot understand it), but you can try to revalidate and repaint the root pane or content pane of JFrame each time when you update your GUI. Something like this public static void updateRootPane(JComponent aComponent) { Window w = SwingUtilities.windowForComponent(aComponent); if (w instanceof JFrame) { ((JFrame) w).getRootPane().revalidate(); ((JFrame) w).getRootPane().repaint(); } else if (w instanceof JDialog) { ((JDialog) w).getRootPane().revalidate(); ((JDialog) w).getRootPane().repaint(); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23838543

http://stackoverflow.com/comment/36723344
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23860009
has text: @user3674464 Interesting...

http://stackoverflow.com/comment/36784742
has text: Try with classname.this or put getContext()
type: Comment
comment on: http://stackoverflow.com/q/23892347
type: QuestionComment
score: 1

http://stackoverflow.com/a/23862585
answers question: http://stackoverflow.com/q/23862279
score: 0
has body: Getting the JDBC drivers is a bit tricky. Please check this article for directions. Due to Oracle license restriction, there is NO public Maven repository provides Oracle JDBC driver. To use Oracle jdbc drive with Maven, you have to install it manually into your Maven local repository.
type: Answer

http://stackoverflow.com/comment/36863999
comment on: http://stackoverflow.com/q/23934079
type: QuestionComment
has text: It's not a matter of being dumb. It's about putting time in to asking a question as well as you can. If you can't be bothered to present the question clearly, why would you expect anyone to bother to present an *answer* clearly?
score: 0
type: Comment

http://stackoverflow.com/comment/36629865
score: 1
has text: How does this answer (and the others answers) address the enforcement of "only in one container" rule?
type: AnswerComment
comment on: http://stackoverflow.com/a/23811387
type: Comment

http://stackoverflow.com/q/23838481
accepted answer: http://stackoverflow.com/a/23838516
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36681615
has answer: http://stackoverflow.com/a/23838626
possible better answer: http://stackoverflow.com/a/23838525
score: 0
has answer: http://stackoverflow.com/a/23839136
has title: Android replaceAll() removes wrong chars from String
tagged with: android
has answer: http://stackoverflow.com/a/23838525
tagged with: regex
answer count: 4
has body: My 'replaceAll()' method removes wrong chars from string. Below the the String String i = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" if I want to remove '2,' from i its removes the '2,' from 12 also. so the new string is now; String i = "1,3,4,5,6,7,8,9,10,11,113,14,15" here is the current code that I'm using: String filter = temp.replaceAll(itemClicked + ",",""); how can i correct this? Any help or guidance on this would be greatly appreciated
has answer: http://stackoverflow.com/a/23838516

http://stackoverflow.com/a/23849510
type: Answer
accepted answer of: http://stackoverflow.com/q/23849497
downvote count: 2
upvote count: 1
score: -1
answers question: http://stackoverflow.com/q/23849497
type: AcceptedAnswer
has body: Is there a modifier to make a variable visible but not modifiable outside of it's class Make it private and expose only getter method for other classes to access. If its public then you can't stop it to make modifiable by other class. If a class can access it then it can modify it also. Try to avoid using public modifies for instance variables. Always access it using public getter &amp; setter methods that give you more control. For e.g. in setter method you can check for the validity of the passed value. Class level access modifiers (java classes only) Only two access modifiers is allowed, public and no modifier If a class is ‘public’, then it CAN be accessed from ANYWHERE. If a class has ‘no modifer’, then it CAN ONLY be accessed from ‘same package’. Member level access modifiers (java variables and java methods) All the four public, private, protected and no modifer is allowed. public and no modifier – the same way as used in class level. private – members CAN ONLY access. protected – CAN be accessed from ‘same package’ and a subclass existing in any package can access. For better understanding, member level access is formulated as a table:

http://stackoverflow.com/q/23918707
answer count: 1
has title: Understanding ConcurrentModificationException
has comment: http://stackoverflow.com/comment/36836130
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36834602
has comment: http://stackoverflow.com/comment/36834782
has comment: http://stackoverflow.com/comment/36834563
has comment: http://stackoverflow.com/comment/36834575
has body: I have a ArrayList of Metricas. Each Metrica has some properties and another ArrayList lForms. What I want to to is check in the db to see if the form has been filled, and update the lForms. When I do so, I get a ConcurrentModificationException, I don't know how to get rid of it... public ArrayList&lt;Metrica&gt; addAllForms(ArrayList&lt;Metrica&gt; lMetricas) { ArrayList&lt;Metrica&gt; newlMet = lMetricas; ArrayList&lt;Formulario&gt; lForms = null; ArrayList&lt;Formulario&gt; newlForms; Metrica newMetrica; Formulario f; for (Iterator&lt;Metrica&gt; it = lMetricas.iterator(); it.hasNext();) { Metrica metrica = it.next(); newlForms = new ArrayList&lt;Formulario&gt;(); lForms = metrica.getlForms(); for (Iterator&lt;Formulario&gt; it2 = lForms.iterator(); it2.hasNext();) { Formulario form = it2.next(); f = getForm(form); if (f == null) { addForm(form, metrica.getId()); Log.e("log", "adding form"); } else form = f; Log.e("log", "Getting adding form"); newlForms.add(form); } newMetrica = new Metrica(); newMetrica.setlForms(newlForms); newMetrica.setClienteId(metrica.getClienteId()); newMetrica.setDatoValido(metrica.getDatoValido()); newMetrica.setDescription(metrica.getDescription()); newMetrica.setId(metrica.getId()); newMetrica.setProyectoProductoId(metrica.getProyectoProductoId()); newMetrica.setTipo(metrica.getTipo()); newlMet.add(newMetrica); } return lMetricas; }
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3184883
has comment: http://stackoverflow.com/comment/36834557
has answer: http://stackoverflow.com/a/23919374
tagged with: java
duplicate of: http://stackoverflow.com/q/3184883
type: Question
accepted answer: http://stackoverflow.com/a/23919374
has comment: http://stackoverflow.com/comment/36836422

http://stackoverflow.com/comment/36762803
type: Comment
score: 0
type: AnswerComment
has text: I already moved myPanel.repaint() outside the `k` and `l` loops. Now what? Should I store each BufferedImage inside an array, then paint them?
comment on: http://stackoverflow.com/a/23880863

http://stackoverflow.com/comment/36738840
type: AnswerComment
score: 0
has text: Thank you, for the link. But as the comments below mentioned correctly its not that satisfing. E.g. from JPA it not allowed to use an Id on a field which can be null. But I cannot find the same restriction for EmbeddedId. All i need is if there is a workaround without adding another artificial Id or a link to a source which says that nullable field in a EmbeddedId are not allowed.
type: Comment
comment on: http://stackoverflow.com/a/23868166

http://stackoverflow.com/comment/36671579
type: AnswerComment
has text: Except that I do see a stack trace if I do `new Exception().printStackTrace()`.
comment on: http://stackoverflow.com/a/23833423
type: Comment
score: 0

http://stackoverflow.com/comment/36697730
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23846999
has text: Thanks, but I already changed it. Just a typo

http://stackoverflow.com/q/23843262
tagged with: java
duplicate of: http://stackoverflow.com/q/208736
has body: How to remove line breaks after JSP tags? For example, if in JSP page has code with tag like this &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;${pageTitle}&lt;/title&gt; &lt;/head&gt; Than in output result will be one line break at line one. !HERE_LINE_BREAK! &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; How I can remove unneeded line break at the first line? JSP processed with Spring Web MVC. Thanks.
has title: How to remove line breaks after JSP tags?
score: 5
answer count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/23843452
upvote count: 6
type: AnsweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/208736
type: Question
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/23843452

http://stackoverflow.com/q/23910795
tagged with: java
tagged with: mysql
type: Question
has body: I am working on a Java application which should read stored data from a matlab generated file containing a database. I want the database to be in SQL format with columns and rows, so that I can retrieve values in the database with Java using SQL queries. I already searched for possibilities but seem to find none. I know that matlab can generate .mat files but can it also generate something like a .db file containing data in SQL format so that it can be read with Java using SQL queries? Some kind of embedded database for matlab maybe?
has comment: http://stackoverflow.com/comment/36819391
tagged with: sql-server
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/36820613
has comment: http://stackoverflow.com/comment/36821105
answer count: 0
type: UnansweredQuestion
has title: How does matlab save it's database, if it has one?
tagged with: matlab

http://stackoverflow.com/a/23833048
accepted answer of: http://stackoverflow.com/q/23832922
answers question: http://stackoverflow.com/q/23832922
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36671591
has body: You have a problem filling your array. you are getting java.lang.ArrayStoreException: java.lang.String at Arrays.fill(row, arraytext); That is cause you are trying to add a String when is expected an String[][]. And for printing you can use Arrays.deepToString() is your answer. System.out.println(Arrays.deepToString(arrays)); Example: public static void main(String[] args) { String[][][] array3d = new String[10][10][10]; for(String [] [] array2d : array3d){ for(String[] array : array2d){ Arrays.fill(array, "hello"); } } System.out.println(Arrays.deepToString(array3d)); }
score: 5
upvote count: 5

http://stackoverflow.com/q/23850725
answer count: 2
has comment: http://stackoverflow.com/comment/36707514
has comment: http://stackoverflow.com/comment/36705281
has comment: http://stackoverflow.com/comment/36705336
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36707570
type: Question
has answer: http://stackoverflow.com/a/23853062
tagged with: algorithm
tagged with: data-structures
possible better answer: http://stackoverflow.com/a/23850764
accepted answer: http://stackoverflow.com/a/23853062
has title: what's the algorithm about how to get all subsets from a char string without cover all distinct letters?
has answer: http://stackoverflow.com/a/23850764
score: 0
has body: I've been struggling with a Subset algorithm question recently. How to get all subsets from a char string? Condition: each subset cannot cover all the distinct letters of the original char string. For instance, abbc, [a,b,c] -> output-> a, b, c, ab, abb, bbc, bb, bc Subset: {abc}, and {abbc} should be removed! My initial thought is to preprocess the original string into a1b2c1, then go recursively, each recursive layer process one distinct letter. In the last layer, like here, we need process c, whether we should put c in the subset depends on the information passed down by previous layers. I am not sure my idea is good, does anyone has ideas about this question?

http://stackoverflow.com/comment/36751825
type: QuestionComment
has text: Do you want me to post whole LogCat?
type: Comment
comment on: http://stackoverflow.com/q/23875442
score: 0

http://stackoverflow.com/comment/36610830
has text: check out 2.00-1.10 ;)
comment on: http://stackoverflow.com/q/23801463
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23908575
type: Answer
score: 9
downvote count: 1
has body: Because most operations don't require the array to resize, particularly once the queue has reached a stable size and isn't growing any more. Every time you add an item Stack has to allocate new objects update the links, etc. ArrayDeque just needs to put an object in the array and update an index.
upvote count: 10
answers question: http://stackoverflow.com/q/23908511
has comment: http://stackoverflow.com/comment/75402668

http://stackoverflow.com/comment/36731512
type: QuestionComment
comment on: http://stackoverflow.com/q/23864439
has text: On every OS :S I did it with a Robot, but I can't use it because it's only on Windows..
score: 0
type: Comment

http://stackoverflow.com/comment/72337414
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23828628
has text: GS Collections has migrated to the Eclipse Foundation and is now Eclipse Collections - http://www.eclipse.org/collections/
type: AnswerComment

http://stackoverflow.com/q/23788450
accepted answer: http://stackoverflow.com/a/23788607
upvote count: 1
has title: Any way to programatically distinguish between final-param array and final-param ellipsis?
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javadoc
tagged with: methods
type: Question
tagged with: arrays
downvote count: 0
tagged with: ellipsis
has comment: http://stackoverflow.com/comment/36586304
has answer: http://stackoverflow.com/a/23788607
has body: I'm writing some code to create JavaDoc links based on its java.lang.reflect.Method or Constructor objects. I don't understand how javadoc.exe knows the difference between functions that have a final array parameter public static final void doSomething(boolean b, int[] ai, String[] as) { } and ones that have an ellipsis parameter public static final void doSomethingElse(String... as) { } Given there's no "ellipsis" indication in a class object. It's either an array or not an array. The name of a class also includes this indication, via its [ prefix, but again, only "array-or-not-array", there's no information about ellipses. Last-param-arrays must have a JavaDoc link ending with []), and last-param-ellipsis links must end with ...). Is there any way to programatically distinguish between this? import java.lang.reflect.Method; public class Test { public static final void main(String[] ignored) { Method m = null; try { m = Test.class.getDeclaredMethod("doSomething", boolean.class, int[].class, String[].class); } catch(Exception x) { throw new RuntimeException(x); } System.out.println(m); } public static final void doSomething(boolean b, int[] ai, String... as) { } } Output: public static final void Test.doSomething(boolean,int[],java.lang.String[])
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23889824
accepted answer of: http://stackoverflow.com/q/23889572
has comment: http://stackoverflow.com/comment/36790508
upvote count: 1
has comment: http://stackoverflow.com/comment/36790471
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23889572
has comment: http://stackoverflow.com/comment/36789327
has comment: http://stackoverflow.com/comment/36782372
type: Answer
has comment: http://stackoverflow.com/comment/36783557
has body: As others have answered, you are: 1- Printing the array itself. 2- Using toString() without an override. 3- Printing an Airport Object. If you want to print specific things about the Airport, you need to use the properties explicitly. Also, read the documentaion https://flightwise.com/documentation/39/PlaneXML_API_Reference.html#Airport It reads: Provides basic information on an airport. Ident As String ICAO As String Location As String Lat As Double Lon As Double Elev As Int32 GMTOffset As Short DST As Short
has comment: http://stackoverflow.com/comment/36779888
downvote count: 0
score: 1

http://stackoverflow.com/comment/36737170
type: Comment
has text: What he wants is generalize one Asyntask that is called from many Activities into one. Check http://stackoverflow.com/questions/3291490/common-class-for-asynctask-in-android/3291713#3291713 It makes sense have the interface
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23867623

http://stackoverflow.com/comment/36810721
has text: Does it appear that this class was done manually given its size and having to manually code all the labels?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23905919
type: Comment

http://stackoverflow.com/comment/36756219
has text: Nothing no question at all :)
score: 0
comment on: http://stackoverflow.com/a/23877604
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36727389
comment on: http://stackoverflow.com/q/23862076
has text: Yes all code is in single file.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36663418
has text: Have you looked at the JTextField class? go there. Google 'JTextField java' You'll find it. Do research before coming to SO.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23829219

http://stackoverflow.com/q/23785962
tagged with: java
tagged with: javascript
type: UnansweredQuestion
has title: How to compile Java code online?
has comment: http://stackoverflow.com/comment/36588480
has answer: http://stackoverflow.com/a/23786454
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36583865
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36582222
has comment: http://stackoverflow.com/comment/36584070
has body: Making a site, comparing the performance of lambda expressions in Java 8 vs. Non-lambda expressions, using html and javascript. Got most of the site done, right now the example code gets displayed by using iframes that display the .java files, then I embedded java applets that run the .class files. What I'm not sure how to do is, how can I display the code in pre tags for example and then compile the code online? That way the user can modify source code to test different stuff such as stream() vs parallelStream().
has comment: http://stackoverflow.com/comment/36582050
has comment: http://stackoverflow.com/comment/36583570
upvote count: 2
has comment: http://stackoverflow.com/comment/36585489
answer count: 1
has comment: http://stackoverflow.com/comment/36582399

http://stackoverflow.com/comment/36601391
comment on: http://stackoverflow.com/q/23796154
has text: Might want to post this in the game development site
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36655671
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23824930
has text: I would create three regexes: one for #1, one for #2 and one for #3.

http://stackoverflow.com/comment/36612058
has text: You will have to synchronize on counter.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23801968
type: Comment

http://stackoverflow.com/comment/36673383
comment on: http://stackoverflow.com/a/23811715
type: Comment
has text: Hi Peter, let me write down what I understood from your answer. For example the default buffer size is 8K in java IO. So if you read just 10-20 bytes after marking, it doesn't matter because the point is still in the buffer. However, if the read size is larger, maybe 8197 bytes, the data of marked point is erased and filled with new data. That's when the mark becomes invalid. Is this understanding correct?
score: 1
type: AnswerComment

http://stackoverflow.com/q/23859231
type: Question
downvote count: 4
answer count: 1
accepted answer: http://stackoverflow.com/a/23860044
tagged with: resultset
tagged with: sql
favorite count: 0
score: -1
has body: I have a ResultSet object which returns n* number of rows, and so now I want to get a specific row defined by me from that n number of records. If I can get last row only, that would do. while(rs.next()){ if(rs.last()){ double tempTotal = rs.getDouble("openingBalance"); } }
has answer: http://stackoverflow.com/a/23860044
type: AnsweredQuestion
tagged with: row
has title: How to get data from a specific row in using a ResultSet object?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36721641

http://stackoverflow.com/a/23782072
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54430501
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23781771
has body: Sorry, it doesn't work that way (although I understand why you think it would). The T[] Component.getListeners(Class&lt;T&gt; listenerType) method only returns the listeners that has been added using the corresponding addXxxListener(...) method. I believe this method was implemented this way for convenience of the API designers/implementers, not for API users. I recommend using the getXxxListeners() rather than getListeners(XxxListener.class). Anyway, here's an example: JComponent comp = new JPanel(); MouseListener ml = new MouseAdapter() { /* Custom impl */ } comp.addMouseListener(ml); // ml is returned MouseListener[] mls = comp.getListeners(MouseListener.class); // Nothing is returned, as there's no support for adding listeners // for generic EventListeners to a component EventListener[] els = comp.getListeners(EventListener.class); PS; If you are curious, it's probably easier to understand how this works, if you look at the source code. The important class is javax.swing.event.EventListenerList. :-)
accepted answer of: http://stackoverflow.com/q/23781771
upvote count: 2
has comment: http://stackoverflow.com/comment/36575943

http://stackoverflow.com/comment/36680271
type: QuestionComment
comment on: http://stackoverflow.com/q/23837784
type: Comment
score: 0
has text: errors are shown in the image link (the last one).

http://stackoverflow.com/q/23841976
favorite count: 0
tagged with: google-play
tagged with: android
has answer: http://stackoverflow.com/a/23846119
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: libgdx
tagged with: google-play-services
accepted answer: http://stackoverflow.com/a/23846119
has title: GameHelper crashing at application start
answer count: 1
downvote count: 0
has body: So, I guess it'd help to say that I'm using LibGDX. Code: package com.fmeg.tapout.android; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.applifier.impact.android.ApplifierImpact; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.fmeg.tapout.ActionResolver; import com.fmeg.tapout.TapoutGame; import com.google.android.gms.games.Games; import com.google.example.games.basegameutils.GameHelper; import com.google.example.games.basegameutils.GameHelper.GameHelperListener; public class AndroidLauncher extends AndroidApplication implements GameHelperListener, ActionResolver { private static final String EVERPLAY_GAME_ID = "14234"; private GameHelper gameHelper; public AndroidLauncher() { } @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); ApplifierImpact.setDebugMode(false); ApplifierImpact.setTestMode(false); ApplifierImpact impact = new ApplifierImpact((Activity)this, EVERPLAY_GAME_ID); ApplifierImpact.instance.changeActivity(this); gameHelper = new GameHelper(this, GameHelper.CLIENT_ALL); gameHelper.setup(this); initialize(new TapoutGame(impact, this), config); } @Override public void onStart() { super.onStart(); // gameHelper.onStart(this); } @Override public void onStop() { super.onStop(); // gameHelper.onStop(); } @Override public void onActivityResult(int request, int response, Intent data) { super.onActivityResult(request, response, data); // gameHelper.onActivityResult(request, response, data); } @Override public void onSignInFailed() { // TODO Auto-generated method stub } @Override public void onSignInSucceeded() { // TODO Auto-generated method stub } @Override public void unlockAchievement(String achievementID) { Games.Achievements.unlock(gameHelper.getApiClient(), achievementID); } @Override…

http://stackoverflow.com/q/23822079
has answer: http://stackoverflow.com/a/23822210
has comment: http://stackoverflow.com/comment/36650410
has comment: http://stackoverflow.com/comment/36650303
type: Question
has comment: http://stackoverflow.com/comment/36650227
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23822139
has comment: http://stackoverflow.com/comment/36650719
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23822139
has title: Add a new string in between existing string
possible better answer: http://stackoverflow.com/a/23822174
has answer: http://stackoverflow.com/a/23822174
has body: I have read the content of HTML into string, now I need to add a new attribute inside the body tag, I was thinking of using StringBuilder for this. But I am unable to frame the logic. Any help would be really appreciated. Existing HTML &lt;body class="temporaryrevision"&gt; HTML that I want to create &lt;body class="temporaryrevision" bgcolor="#FFFFFF"&gt;
tagged with: java

http://stackoverflow.com/comment/36860341
type: Comment
type: QuestionComment
has text: timestamp is not what you think it is - use DateTime
comment on: http://stackoverflow.com/q/23932650
score: 1

http://stackoverflow.com/q/23877491
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/8783091
has answer: http://stackoverflow.com/a/23877659
accepted answer: http://stackoverflow.com/a/23877659
type: Question
has comment: http://stackoverflow.com/comment/36755836
tagged with: mediarecorder
tagged with: camera
upvote count: 1
answer count: 1
has body: I have an application that calls a custom activity within it for the purpose of recording audio and video. It uses the MediaRecorder and the Camera classes. My issue is that when the user hits the back button or cancel while the video is recording, the activity always hangs on Camera.release(), but if the stop button is pressed first, there's no problem. Here's my code: Stop button code: mRecorder.stop(); // Stop recording mRecorder.reset(); // Reset recorder camera.stopPreview(); onDestroy(): mRecorder.reset(); // Release media recorder mRecorder.release(); if (camera != null) { camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); } mRecorder = null; camera = null; I tried adding mRecorder.stop() to onDestroy() as well but that didn't solve it. I checked here but none of the answers worked. I'm really stumped with this one.
has title: App hangs on Camera.release()
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36755990

http://stackoverflow.com/comment/38117679
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23995535
type: AnswerComment
has text: Another [stronger](http://www.outerthoughts.com/files/doclet-javadoc/com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.html) example: "This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice."

http://stackoverflow.com/q/23857638
tagged with: security
has body: I have this issue about java cryptography. I take a password from the user then I product a private key and a public key.From the public key I create the cipher and then I store the private key and the cipher. Then from my second application I read the password again from the user , the cipher file and the private key and then I try to match the password with the decryption of the cipher and the private Key. My first application: private static byte[] encrypt(byte[] inpBytes, PublicKey key, String xform) throws Exception { Cipher cipher = Cipher.getInstance(xform); cipher.init(Cipher.ENCRYPT_MODE, key); return cipher.doFinal(inpBytes); } String xform = "RSA"; // Generate a key-pair KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("RSA"); } catch (NoSuchAlgorithmException ex) { Logger.getLogger(Efarmogi_1.class.getName()).log(Level.SEVERE, null, ex); } kpg.initialize(512); // 512 is the keysize. KeyPair kp = kpg.generateKeyPair(); /create public and private key PublicKey pubk = kp.getPublic(); PrivateKey prvk = kp.getPrivate(); //password from user String password = T_Password.getText(); byte[] dataBytes = password.getBytes(); //create cipher byte[] encBytes = null; try { encBytes = encrypt(dataBytes, pubk, xform); } catch (Exception ex) { Logger.getLogger(Efarmogi_1.class.getName()).log(Level.SEVERE, null, ex); } //storing //cipher FileOutputStream cipher = null; try { cipher = new FileOutputStream( "Xrhstes\\"+T_Username.getText()+"\\hash_"+T_Username.getText()); cipher.write(encBytes);//write with bytes cipher.close(); } catch (IOException ex) { Logger.getLogger(Efarmogi_1.class.getName()).log(Level.SEVERE, null, ex); } //private key byte[] key2 = prvk.getEncoded(); FileOutputStream keyfos2 = null; try { keyfos2 = new FileOutputStream("Xrhstes\\"+T_Username.getText()+"\\private_"+ T_Username.getText()+".pem"); keyfos2.write(key2); keyfos2.close(); and this is the second application: private static byte[] decrypt(byte[] inpBytes, PrivateKey key…
has answer: http://stackoverflow.com/a/23860820
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
tagged with: java
tagged with: rsa
has title: Can't restore privateKey RSA
downvote count: 1
type: Question
tagged with: private-key
upvote count: 0
answer count: 1
score: -1

http://stackoverflow.com/comment/36789310
comment on: http://stackoverflow.com/a/23894752
score: 0
type: AnswerComment
has text: please add comment before making it negative
type: Comment

http://stackoverflow.com/q/23902764
has title: How to configure and tune Akka Dispatchers
has answer: http://stackoverflow.com/a/23907477
score: 12
tagged with: akka
accepted answer: http://stackoverflow.com/a/23907477
answer count: 1
downvote count: 0
favorite count: 0
tagged with: executorservice
type: AnsweredQuestion
tagged with: java
tagged with: forkjoinpool
type: Question
has body: I'm looking over the documentation here: http://doc.akka.io/docs/akka/2.3.3/java/dispatchers.html We're using Akka in such a way where we have two separate dispatchers (default fork-join executors) for different actors. We're now running into some performance issues and we're looking into how we can tune the dispatcher configuration parameters and see how they affect the performance of the application. I've looked over the documentation but don't really understand the configuration parameters. For example, just for the simple default, fork-join-executor dispatcher: What are these and how should we configure them to see how they affect application performance? # Min number of threads to cap factor-based parallelism number to parallelism-min = 2 # Parallelism (threads) ... ceil(available processors * factor) parallelism-factor = 2.0 # Max number of threads to cap factor-based parallelism number to parallelism-max = 10 Thanks!
upvote count: 12

http://stackoverflow.com/comment/36608435
comment on: http://stackoverflow.com/a/23799360
type: Comment
score: 0
type: AnswerComment
has text: Yup, that's what I did before. No error, able to upload file to website but the website still doesn't capture the data I entered in the excel.

http://stackoverflow.com/a/23821255
upvote count: 3
answers question: http://stackoverflow.com/q/23821202
type: Answer
has body: Why not class FooParser extends Parser&lt;FooException&gt; { public void parse(File file) throws FooException { throw new FooException("Not Supported"); } }
downvote count: 0
score: 3

http://stackoverflow.com/q/23869930
favorite count: 0
possible better answer: http://stackoverflow.com/a/23870787
tagged with: java-8
has body: In Java 8, Stream has a method reduce: T reduce(T identity, BinaryOperator&lt;T&gt; accumulator); Is the accumulator operator allowed to modify either of its arguments? I presume not since the JavaDoc says the accumulator should be NonInterfering, though all examples talk of modifying the collection, rather than modifying the elements of the collection. So, for a concrete example, if we have integers.reduce(0, Integer::sum); and suppose for a moment that Integer was mutable, would sum be allowed to modify its first parameter by adding to it (in place) the value of its second parameter? I presume not, but I would also like an example of where this Interfering causes a problem.
type: AnsweredQuestion
tagged with: accumulator
downvote count: 0
tagged with: java-stream
tagged with: java
accepted answer: http://stackoverflow.com/a/23870740
score: 17
linked to: http://stackoverflow.com/q/23658956
type: Question
tagged with: reduce
has answer: http://stackoverflow.com/a/23870740
has title: Is the accumulator of reduce in Java 8 allowed to modify its arguments?
answer count: 2
upvote count: 17
has answer: http://stackoverflow.com/a/23870787

http://stackoverflow.com/q/23915910
tagged with: java
type: Question
upvote count: 4
has title: Java Generic wild card bounds not working
has body: I have encountered a situation where I fail to understand the reasoning behind the exhibited compiler behavior. I have written following code snippet- public class OutgoingStub&lt;T&gt; { public OutgoingStub&lt;T&gt; tryThis(T val){ return new OutgoingStub&lt;T&gt;(); } public void f(Set&lt;? extends Number&gt; set){ } public static void main(String[] args) { Set&lt;? extends Number&gt; set = new HashSet&lt;Integer&gt;(); **OutgoingStub&lt;Set&lt;? extends Number&gt;&gt; stub = Mocktest.mock(set);** //Unable to assign the reuturn value in a variable. compiler complains. } } class Mocktest { public static &lt;T&gt; OutgoingStub&lt;T&gt; mock(T val){ return new OutgoingStub&lt;T&gt;(); } }
has answer: http://stackoverflow.com/a/23915950
answer count: 1
tagged with: generics
favorite count: 0
type: UnansweredQuestion
downvote count: 2
score: 2

http://stackoverflow.com/q/23784881
accepted answer: http://stackoverflow.com/a/23784956
has comment: http://stackoverflow.com/comment/36580033
has title: Specify the timeout of a java object
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23785036
has body: I would like to create an object that dies when its timeout is reached. How can I achieve this ? For instance in pseudo code: MyObject O = new MyObject(3000) ; // object created will be null after 3 seconds wait(4000) ; if (O == null) print("success") ; Is it possible ? Edit : Actually I'm using a large map of MyObjects. Each one should die after 1 min of its creation. Now I am thinking about adding a creationDate to MyObject and a method that would check my map of MyObject when its size becomes too large... and put null to the timeout objects references. That would be another approach considering the fact I don't need all objects to be null as soon as they should (ie, they should be null after 1 min but it's not so important as long as my map isn't huge).
has answer: http://stackoverflow.com/a/23785899
has answer: http://stackoverflow.com/a/23785036
has comment: http://stackoverflow.com/comment/36579760
has answer: http://stackoverflow.com/a/23784956
has comment: http://stackoverflow.com/comment/36618926
type: AnsweredQuestion
tagged with: java
tagged with: timeout
has comment: http://stackoverflow.com/comment/36581440
has comment: http://stackoverflow.com/comment/36580266
type: Question
has comment: http://stackoverflow.com/comment/36583031

http://stackoverflow.com/q/23872945
has answer: http://stackoverflow.com/a/23875102
has body: I'm developing a frequency map for counting the frequency of lemmata in a text, while saving their flexions. My data structure looks like this: HashMap&lt;List&lt;String&gt;, HashMap&lt;List&lt;String&gt;, Long&gt;&gt; frequencyMap = ... ; The first list contains a sequence of lemmata, the second one contains the flexions of the words and their frequency. Is there a way to sort this data structure by the frequency counts? Or would you suggest another data structure to store those values, which is e.g. easier to sort. Any help is appreciated.
has comment: http://stackoverflow.com/comment/36746891
tagged with: list
has comment: http://stackoverflow.com/comment/36746903
has answer: http://stackoverflow.com/a/23873471
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23873434
has title: How to sort a complex HashMap structure in Java?
has comment: http://stackoverflow.com/comment/36747275
tagged with: hashmap
has comment: http://stackoverflow.com/comment/36748073
has comment: http://stackoverflow.com/comment/36746943
tagged with: java
has comment: http://stackoverflow.com/comment/36747022
type: Question
score: 0
has answer: http://stackoverflow.com/a/23873233
has comment: http://stackoverflow.com/comment/36746937
tagged with: sorting
has comment: http://stackoverflow.com/comment/36746867
tagged with: frequency
linked to: http://stackoverflow.com/q/12947088
linked to: http://stackoverflow.com/q/8725387
answer count: 4
has comment: http://stackoverflow.com/comment/36747062

http://stackoverflow.com/a/23987592
has comment: http://stackoverflow.com/comment/36963816
accepted answer of: http://stackoverflow.com/q/23929880
answers question: http://stackoverflow.com/q/23929880
type: AcceptedAnswer
score: 0
has body: The possible reason for java.rmi.MarshalException may be because the local class and the remote class are of different versions. Because of this conflict during marshall/unmarshall the receiver does not accept the protocol version of the invoker. I would recommend you to recompile all your local/remote classes. Hope this helps!
type: Answer

http://stackoverflow.com/a/30922045
score: 109
has comment: http://stackoverflow.com/comment/109020034
upvote count: 111
has comment: http://stackoverflow.com/comment/140007202
has comment: http://stackoverflow.com/comment/108945283
has comment: http://stackoverflow.com/comment/84165995
type: Answer
answers question: http://stackoverflow.com/q/23860533
has comment: http://stackoverflow.com/comment/135008365
has body: You can use a local variable with a Supplier to set up common parts of the stream pipeline. From http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/: Reusing Streams Java 8 streams cannot be reused. As soon as you call any terminal operation the stream is closed: Stream<String> stream = Stream.of("d2", "a2", "b1", "b3", "c") .filter(s -> s.startsWith("a")); stream.anyMatch(s -> true); // ok stream.noneMatch(s -> true); // exception Calling `noneMatch` after `anyMatch` on the same stream results in the following exception: java.lang.IllegalStateException: stream has already been operated upon or closed at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:229) at java.util.stream.ReferencePipeline.noneMatch(ReferencePipeline.java:459) at com.winterbe.java8.Streams5.test7(Streams5.java:38) at com.winterbe.java8.Streams5.main(Streams5.java:28) To overcome this limitation we have to to create a new stream chain for every terminal operation we want to execute, e.g. we could create a stream supplier to construct a new stream with all intermediate operations already set up: Supplier<Stream<String>> streamSupplier = () -> Stream.of("d2", "a2", "b1", "b3", "c") .filter(s -> s.startsWith("a")); streamSupplier.get().anyMatch(s -> true); // ok streamSupplier.get().noneMatch(s -> true); // ok Each call to get() constructs a new stream on which we are save to call the desired terminal operation.
downvote count: 2
has comment: http://stackoverflow.com/comment/136572260

http://stackoverflow.com/tag/r
tags question: http://stackoverflow.com/q/23840304
tag name: r
type: Tag
tags question: http://stackoverflow.com/q/23860477

http://stackoverflow.com/q/23823470
has comment: http://stackoverflow.com/comment/36667591
answer count: 1
type: UnansweredQuestion
tagged with: java.util.scanner
tagged with: java
tagged with: event-listener
has title: Event listener/ Scanner in Gridworld
type: Question
has body: I'm trying to control Bugs in GridWorld. I have tried two ways of doing this, neither of which have actually moved or turned the bug. They both compile but nothing happens. Here is the Bug that will be controlled: package info.gridworld.actor; import info.gridworld.grid.*; import info.gridworld.grid.Location; import java.awt.Color; public class MazeBug extends Bug { public MazeBug() { super(Color.blue); } public void forward(){ Grid&lt;Actor&gt; gr = getGrid(); if (gr == null) return; Location loc = getLocation(); Location next = loc.getAdjacentLocation(getDirection()); if (gr.isValid(next)) moveTo(next); else removeSelfFromGrid(); } public void turnRight(){ setDirection(getDirection() + Location.RIGHT); } public void turnLeft(){ setDirection(getDirection() + Location.LEFT); } } Here is the first way that I tried controlling the bugs with the keys W,A, and D using Scanner (not sure if I used scanner correctly) package info.gridworld.actor; import java.util.Scanner; import info.gridworld.grid.*; public class KeyTests extends Actor { public static ActorWorld world = new ActorWorld(new BoundedGrid&lt;Actor&gt;(20, 20)); public static MazeBug currentBug; public static void main(String[] args) { world.show(); world.add(new Location(1,11),new MazeBug()); while(true){ Scanner k = new Scanner(System.in); String buttonpress = k.nextLine(); if (buttonpress.equals("w")) currentBug.forward(); if (buttonpress.equals("d")) currentBug.turnRight(); if (buttonpress.equals("a")) currentBug.turnLeft(); } } } Here is the 2nd way I tried to control the bug package info.gridworld.actor; import info.gridworld.grid.*; public class KeyTests extends Actor { public static ActorWorld world = new ActorWorld(new BoundedGrid&lt;Actor&gt;(20, 20)); public static MazeBug currentBug; public static void main(String[] args) { world.add(new Location(1,11),new MazeBug()); java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new java.awt.KeyEventDispatcher() { public boole…
tagged with: gridworld
has answer: http://stackoverflow.com/a/23832605
score: 0

http://stackoverflow.com/q/23836328
tagged with: java
downvote count: 1
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/23836617
score: -1
tagged with: tiles
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: LibGDX change tile onclick
has body: So I'm just creating a Tower-Defence Game. Now I'm trying to configure, that the player can click on a tile, and by doing that, an object gets attatched to this tile, and the texture of this object is used for the tile. And I don't know how to do that. I don't know how to take onclick events, since you cant set those on tiles, maps, cells etc. ... (I tried to create an Actor in the size of the tiledmap, but I don't know how to convert the x and y position to the correct tile...) I thought about working with MapObjects, but I just don't understand those and I couldn't find a good explenation online.
tagged with: onclick

http://stackoverflow.com/q/23915446
tagged with: swig
tagged with: java
has answer: http://stackoverflow.com/a/24006585
accepted answer: http://stackoverflow.com/a/24006585
has body: swig.i %typemap(jtype) bool foo "byte[]" %typemap(jstype) bool foo "byte[]" %typemap(jni) bool foo "jbyteArray" %typemap(javaout) bool foo { return $jnicall; } %typemap(in, numinputs=0) std::string&amp; out (std::string temp) "$1=&amp;temp;" %typemap(argout) std::string&amp; out { $result = JCALL1(NewByteArray, jenv, $1-&gt;size()); JCALL4(SetByteArrayRegion, jenv, $result, 0, $1-&gt;size(), (const jbyte*)$1-&gt;c_str()); } // Optional: return NULL if the function returned false %typemap(out) bool foo "" %inline %{ struct Bar { bool foo(std::string&amp; out) { std::string s; s.push_back('H'); s.push_back('o'); s.push_back(0); s.push_back('l'); s.push_back('a'); out = s; return true; } }; %} Java public byte[] foo() { return NativeISecurityProviderJNI.Bar_foo(swigCPtr, this); } Till here everything fine, but what I am trying to get is this java return (byte[]) as an argument. like public void foo(byte[] example) {} I've tried a lot of possible modifications in order to get that, but there is no way and I've ran out of imagination. I would appreciate whatever suggestion. Thanks you very much.
score: 0
linked to: http://stackoverflow.com/q/12497175
answer count: 1
has title: SWIG wrap a c++ string into a byte[] in java
tagged with: c++
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/36759758
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23879387
has text: @Sotirios Delimanolis Apart from that error I am also facing the new issue, where if I change methods to private, I get the following error. No enclosing instance of type Basics6 is accessible. Must qualify the allocation with an enclosing instance of type enclosingClass.
score: 0

http://stackoverflow.com/q/23934095
downvote count: 0
favorite count: 0
has title: ConcurrentException when trying clear JavaFX ObservableMap
possible better answer: http://stackoverflow.com/a/23934970
tagged with: javafx-8
type: Question
tagged with: concurrentmodification
score: 1
answer count: 2
has answer: http://stackoverflow.com/a/24080393
has comment: http://stackoverflow.com/comment/36863078
upvote count: 1
has comment: http://stackoverflow.com/comment/37091439
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/36906036
has body: I'm adding some accelerators to my JavaFX 8 applications and I'm fighting with a ConcurrentModificationException when I try clear the accelerators of the scene. Let me explain, instead use one scene for each dialog, I've created a pseudo dialog, it is simply a pane with overlay. When the pane is added the accelerators of the old pane are removed and the accelerators of the new one are added. When the dialog is closed the old accelerators are restored: public abstract class DialogController{ private Map&lt;KeyCombination, Runnable&gt; accelerators; . . . protected final void loadMainPane() throws IOException { . . . pane.sceneProperty().addListener(new ChangeListener&lt;Scene&gt;() { @Override public void changed(ObservableValue&lt;? extends Scene&gt; observableValue, Scene oldScene, Scene newScene) { if (newScene != null) enableAccelerators(); else disableAccelerators(oldScene); } }); } protected void enableAccelerators() { accelerators = new HashMap&lt;KeyCombination, Runnable&gt;(pane.getScene().getAccelerators()); pane.getScene().getAccelerators().clear(); pane.getScene().getAccelerators().put(new KeyCodeCombination(KeyCode.ENTER, KeyCombination.ALT_DOWN), new Runnable() { @Override public void run() { submit(null); } }); } protected void disableAccelerators(Scene scene) { scene.getAccelerators().putAll(accelerators); } } When a subclass need add new accelerators they only need override enableAccelerators() method, call super and add the new accelerators desired. However, sometimes, when the enableAccelerators try clear accelerators of the scene, this exceptions is thrown: java.util.ConcurrentModificationException: null at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429) at java.util.HashMap$EntryIterator.next(HashMap.java:1463) at java.util.HashMap$EntryIterator.next(HashMap.java:1461) at com.sun.javafx.collections.ObservableMapWrapper$ObservableEntrySet$1.next(ObservableMapWrapper.java:588) at com.sun.javafx.collections.ObservableMapWrapper$Observable…
has comment: http://stackoverflow.com/comment/37135813
has answer: http://stackoverflow.com/a/23934970
accepted answer: http://stackoverflow.com/a/24080393
type: AnsweredQuestion

http://stackoverflow.com/q/23915695
has body: I'm using an AnalyzingInfixSuggester in my Solr app like this: suggest org.apache.solr.spelling.suggest.Suggester org.apache.solr.spelling.suggest.fst.AnalyzingInfixLookupFactory suggestAnalyzer Suggestions string dict_ac 0.005 true The storeDir parameter tells it where to store a disk copy of the suggest index so it doesn't have to rebuild the in memory index every time the application starts. The "dict_ac" directory is created with an empty file inside called iwfsta.bin. I'm running Solr on Tomcat through eclipse, and this is the log message: "SEVERE: Store Lookup build from index on field: Suggestions failed reader has: 100 docs" The in-memory suggester index is working fine in the application. I've tried giving RW permissions to all on this file, but that didn't solve it. The questions are What is wrong with my setup? How would I debug such a problem? EDIT: Inside my eclipse install dir (not workspace), it is creating a folder called analyzingInfixSuggesterDir, which contains several files comprising a Lucene index.
type: UnansweredQuestion
tagged with: solr
tagged with: java
has comment: http://stackoverflow.com/comment/36867298
type: Question
tagged with: spell-checking
score: 2
downvote count: 0
has title: How to save suggester index
favorite count: 0
has comment: http://stackoverflow.com/comment/36849557
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/36732644
comment on: http://stackoverflow.com/a/23864989
type: Comment
has text: My manifest file is :
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36785720
type: QuestionComment
comment on: http://stackoverflow.com/q/23889657
has text: do you resize the iframe after load ?
score: 0
type: Comment

http://stackoverflow.com/q/23862344
has answer: http://stackoverflow.com/a/23862453
tagged with: android-adapter
has answer: http://stackoverflow.com/a/23862441
score: 0
has title: ListView and Adapter Guidance
has body: At a crossroads with ListView and Adapter issues. The idea is to display a list of soccer teams followed by the goals they scored and points they attained in a ListView that were brought in (as arrays) to the Activity using an Intent. However, I can only display club names and having issues with displaying integer arrays that contain the points and goals scored. I have looked around and found topics pertaining to custom adapters but I am new to Android development and do not fully understand them. I have tried converting the integer arrays to strings with no success. I do not know where to go from here so any advice would be welcome. My code is: package com.example.wmcpapersoccer; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class ResultsActivity extends Activity { TextView txtShow; TextView txtGF; ListView listview; String team_0; String team_1; String team_2; String team_3; String team_4; String team_5; String team_6; String team_7; int goalsFor_0 = 0; int goalsFor_1 = 0; int goalsFor_2 = 0; int goalsFor_3 = 0; int goalsFor_4 = 0; int goalsFor_5 = 0; int goalsFor_6 = 0; int goalsFor_7 = 0; int points_0 = 0; int points_1 = 0; int points_2 = 0; int points_3 = 0; int points_4 = 0; int points_5 = 0; int points_6 = 0; int points_7 = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_results); Intent intent_team_data = getIntent(); String[] club_names = intent_team_data.getStringArrayExtra("footballClubs"); int[] team_points = intent_team_data.getIntArrayExtra("clubPoints"); int[] club_goals = intent_team_data.getIntArrayExtra("clubGoals"); listview = (ListView)findViewById(R.id.listClubs); ArrayAdapter&lt;String&gt; myAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.custom_list_view, club_names); listview.set…
possible better answer: http://stackoverflow.com/a/23862441
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36727792
accepted answer: http://stackoverflow.com/a/23862453
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36728189
has answer: http://stackoverflow.com/a/23862635
answer count: 3
tagged with: android-listview
tagged with: android

http://stackoverflow.com/a/36136449
has body: to open the launch configuration double click on the server and click "Open launch configuration"
type: Answer
answers question: http://stackoverflow.com/q/23858817
score: 0

http://stackoverflow.com/a/23960808
score: 1
has body: You can't just create new String (Java is too fancy for that). Use public static String byteToString(byte[] bytes) { StringBuilder b = new StringBuilder(); for (byte c : bytes) { b.append((char) (c &gt;= 0 ? c : 256 + c)); } return b.toString(); } Using your example HttpEntity params = MultipartEntityBuilder.create() .addTextBody("data", byteToString(data)) .build();
upvote count: 1
has comment: http://stackoverflow.com/comment/36968661
has comment: http://stackoverflow.com/comment/36967482
answers question: http://stackoverflow.com/q/23806344
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23806344

http://stackoverflow.com/comment/36688148
has text: Which book, and what was the context? "Implemented more efficiently" can mean many things. It's absolutely easier to **implement** a core class like String in an immutable way: requires less code, avoid headaches with data races in multi-threaded programming, reliable security checks are easier to implement, etc. Or do you mean more efficient to *execute* ?
comment on: http://stackoverflow.com/q/23841560
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23864534
has body: Specifically a class annotation to apply a NotNull annotations(like those presented in Which @NotNull Java annotation should I use?) by default to all fields, method return and parameters in the class. Or a package annotation to apply NotNull annotations to every fields, method return and parameters in every class in the package.
tagged with: notnull
tagged with: java
has comment: http://stackoverflow.com/comment/36731584
has title: Is there a way to annotate a class to apply an annotation to every inner element in java?
score: 0
has comment: http://stackoverflow.com/comment/36732032
linked to: http://stackoverflow.com/q/4963300
answer count: 0
type: UnansweredQuestion
tagged with: package
type: Question

http://stackoverflow.com/comment/36884192
has text: Thanks for confirming I will review your code further. Can you please add in your view code, that is the page from where you call this and expect the data to return to.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23925632

http://stackoverflow.com/q/23920323
score: 2
type: AnsweredQuestion
has body: The List&lt;String&gt; Mylist is org.hibernate.collection.PersistentBag... and i want to delete this Mylist... How i can do it?? QriteriaBuilder criteriaBuilder = em.getCriteriaBuilder(); CriteriaQuery&lt;A_entity&gt; criteriaQuery = criteriaBuilder.createQuery(A_entity.class); criteriaQuery.from(A_entity.class); Query query = em.createQuery(criteriaQuery); List&lt;A_entity&gt; queryList = query.getResultList(); for (A_entity a:queryList) { if(....) { List&lt;String&gt; Mylist = a.func(); ???How delete Mylist???? } } Thank you very much!!
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23930146
linked to: http://stackoverflow.com/q/23914149
type: Question
tagged with: jpa
tagged with: persistence
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23930146
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36841200
has comment: http://stackoverflow.com/comment/36839951
has title: How to delete data from org.hibernate.collection.PersistentBag? | Hibernate (Jpa)

http://stackoverflow.com/q/23920714
has comment: http://stackoverflow.com/comment/36838664
tagged with: ios7
tagged with: ios
has title: How can I fire a Conversion Pixel / Tracking Pixel from a native iOS and/or Android app?
tagged with: iphone
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23920889
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I have a conversion pixel from an affiliate marketing company which I need fired when a sale takes place in my iOS and Android apps. Is there a way to launch the pixel programmatically from inside the app? The pixel is in an HTML IMG SCR tag.
tagged with: java
upvote count: 1
type: Question

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/23855779
tags question: http://stackoverflow.com/q/23859139
tags question: http://stackoverflow.com/q/23828277
tags question: http://stackoverflow.com/q/23851203
tags question: http://stackoverflow.com/q/23856340
tags question: http://stackoverflow.com/q/23872483
type: Tag
tags question: http://stackoverflow.com/q/23790333

http://stackoverflow.com/a/23875921
downvote count: 0
type: Answer
score: 1
has body: Dev mode emulates the app behavior, so it may be different from the production environment. Most likely this onFailure() comes from your GWT plugin, because you tried to launch an app while the "previous" app was waiting for a callback. When you refresh the app page in production, the browser closes all open connections that the page had. So your server will not be able to send any response - successful or otherwise.
answers question: http://stackoverflow.com/q/23872607
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23872607
type: AcceptedAnswer

http://stackoverflow.com/q/23803760
has comment: http://stackoverflow.com/comment/36615171
linked to: http://stackoverflow.com/q/7606077
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/8888654
has body: I have a string which has huge data String string = "afsa fd fdsfdsfdsfdsfdsfds fdsfds fdsf dsfds fdsfds fdsf dsfdsf dsfdsfsdfsdf JsonStr [{\"apk_name\":\"Android System\",\"apk_package\":\"android\",\"apk_versioncode\":17},{\"apk_name\":\"Bubble\",\"apk_package\":\"bz.ktk.bubble\",\"apk_versioncode\":21},{\"apk_name\":\"Kingsoft Office\",\"apk_package\":\"cn.wps.moffice_eng\",\"apk_versioncode\":74},{\"apk_name\":\"Math Workout\",\"apk_package\":\"com.akbur.mathsworkout\",\"apk_versioncode\":118},{\"apk_name\":\"Apollo\",\"apk_package\":\"com.andrew.apollo\",\"apk_versioncode\":2},{\"apk_name\":\"Tags\",\"apk_package\":\"com.android.apps.tag\",\"apk_versioncode\":101},{\"apk_name\":\"com.android.backupconfirm\",\"apk_package\":\"com.android.backupconfirm\",\"apk_versioncode\":17},{\"apk_name\":\"Bluetooth Share\",\"apk_package\":\"com.android.bluetooth\",\"apk_versioncode\":17},{\"apk_name\":\"Browser\",\"apk_package\":\"com.android.browser\",\"apk_versioncode\":17},{\"apk_name\":\"Calculator\",\"apk_package\":\"com.android.calculator2\",\"apk_versioncode\":17},{\"apk_name\":\"Calendar\",\"apk_package\":\"com.android.calendar\",\"apk_versioncode\":17},{\"apk_name\":\"Cell Broadcasts\",\"apk_package\":\"com.android.cellbroadcastreceiver\",\"apk_versioncode\":17},{\"apk_name\":\"Certificate Installer\",\"apk_package\":\"com.android.certinstaller\",\"apk_versioncode\":17},{\"apk_name\":\"Chrome\",\"apk_package\":\"com.android.chrome\",\"apk_versioncode\":1916122},{\"apk_name\":\"Contacts\",\"apk_package\":\"com.android.contacts\",\"apk_versioncode\":17},{\"apk_name\":\"Package Access Helper\",\"apk_package\":\"com.android.defcontainer\",\"apk_versioncode\":17},{\"apk_name\":\"Clock\",\"apk_package\":\"com.android.deskclock\",\"apk_versioncode\":203},{\"apk_name\":\"Dev Tools\",\"apk_package\":\"com.android.development\",\"apk_versioncode\":1},{\"apk_name\":\"Basic Daydreams\",\"apk_package\":\"com.android.dreams.basic\",\"apk_versioncode\":17},{\"apk_name\":\"Photo Sc…
type: Question
has title: Java string is terminated when its printed
has answer: http://stackoverflow.com/a/23803792
score: 0
upvote count: 1
downvote count: 1
answer count: 1

http://stackoverflow.com/q/23832786
has title: Identyfying Advertisements on a webpage using selenium
has comment: http://stackoverflow.com/comment/36680325
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36670696
type: Question
tagged with: selenium-webdriver
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36687448
tagged with: selenium
has comment: http://stackoverflow.com/comment/36670384
has body: I'm working on a project that has to detect advertisements on a web page using selenium . I tried understanding adblock plus code but couldn't understand much . I have taken a filter list and started pattern matching the DOM elements ids and classes with each entry in the filter list . This is taking a lot of time . Could some one please suggest an efficient way or improve the code . Sample code snippet WebDriver wd = new FirefoxDriver(); wd.get("http://celebslam.celebuzz.com/"); for ( WebElement e : wd.findElements(By.tagName("div")) ) { for (String add :list) if(e.getAttribute("id").toLowerCase().matches(".*"+add+".*")) System.out.println(e.getAttribute("id")); } I'm doing the same for class attibute as well sample List of patterns looks like this list.add("zMSplacement3"); list.add("zMSplacement4"); list.add("zoneAdvertisment"); list.add("zone_b_ad"); list.add("zone_c_ads"); Using around 1500 patterns to identify all advertisements tags.

http://stackoverflow.com/q/23861287
has comment: http://stackoverflow.com/comment/36726224
has body: I have a program that creates a dynamic amount of jpanels and components based on selection at the start of the program that is user-defined. having said that each jpanel and component is created with a loop making them all the same, and they are then put into a list (the JPanel's are put into a list). Having said that I have been able to get the jpanel out and then grab the componenets and display them using System.out. but they are in a component object. How can I get the values of the components? Or am I doing this wrong? Basically I am trying to have the tabs/jpanels based on user-definition automatically generate, which works. Then the user fills out some information and hits "Generate" which is where I then need to iterate through the tabs/jpanels/componenents and put them into the correct object. Below is a working example of my program in a simplified for, with less tyteps of tabs (I only let the AP tab be created) and less options for the object classes: There are two object classes APObject is extending Generic Object. MVCE is the start of the main program where it asks you a few user-defined questions which generate the Tabs/Panels. It then goes from InfoGathering.java to DataGathering where it creates the tabs and panels. The GenerateActionPerformed(ActionEvent evt) method is where I am trying to grab the information from the panel components and put them into the APObject or whichever object they need to go into. MVCE: public class MVCE extends javax.swing.JFrame { int numGenerate[]; private javax.swing.JComboBox cb; /** * Creates new form MVCE */ public MVCE() { this.numGenerate = new int[3]; initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jComboBox1 = new javax.…
has comment: http://stackoverflow.com/comment/36726507
has comment: http://stackoverflow.com/comment/36726184
answer count: 0
has title: Automatically traverse a dynamically created jPanels for component values
type: UnansweredQuestion
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36725907
tagged with: java
score: 0

http://stackoverflow.com/comment/36705997
type: QuestionComment
comment on: http://stackoverflow.com/q/23846411
has text: @kajacx thanks for the suggestion! i will use that :)
score: 0
type: Comment

http://stackoverflow.com/comment/135929749
comment on: http://stackoverflow.com/a/24441534
has text: @sscarduzio thank you for the detailed answer. I have one question . Can you also share some number on production where you measured scale of the application written using vert.x? I understand there are many factor that plays role in scale. Also what is reliability of HA and Clustering and message passing between nodes in production env. Your insights will be really helpful.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23856388
has body: I have this class: public class SayingsHolder extends Application{ ArrayList&lt;String&gt; SayingsList = new ArrayList&lt;String&gt;(){{ SayingsList.add("1"); SayingsList.add("2"); }}; public ArrayList&lt;String&gt; getSayingsList() { return SayingsList; } } Now I'm trying to call it in my activity's ScreenSlidePagerAdapter by: private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { String[] displayText; final SayingsHolder holder = (SayingsHolder).getApplication(); String names[] = {"1","2","3"}; public ScreenSlidePagerAdapter(FragmentManager fm,String[] displayText) { super(fm); this.displayText=displayText; } @Override public Fragment getItem(int position) { System.out.println(position); ScreenSlidePageFragment fragment = new ScreenSlidePageFragment(); fragment.setText(names[position]); return fragment; } @Override public int getCount() { return NUM_PAGES; } } But it gives me this error: SayingsHolder cannot be resolved to a variable What am I missing here? I know that I'm referring wrong to the class, but I can't find a way to fix it. Can someone give me a small clue?
favorite count: 0
tagged with: android
has title: Can't call a class inside of my activity
type: AnsweredQuestion
tagged with: android-fragments
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: class
has answer: http://stackoverflow.com/a/23856456
accepted answer: http://stackoverflow.com/a/23856456
answer count: 1
downvote count: 0
tagged with: android-activity

http://stackoverflow.com/q/23833109
tagged with: internet-explorer
tagged with: jsf
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23834463
accepted answer: http://stackoverflow.com/a/23834463
answer count: 1
linked to: http://stackoverflow.com/q/7685146
score: 0
has title: IE Autofill Problems with JSF
has body: In my JSF application, I have input fields that take in numbers. And ajax renders to add this number to a total. This all works fine. However, while doing testing multiple times. The IE Autofill would suggest the same numbers I have been using. Now, wanting to save time I use them and notice that the total doesn't change. I was curious if anyone else has had this problem, and if so; how did they fix it? P.S. I emulate IE7 compat mode through my servlet being sent with the header Thank you in advance!
type: AnsweredQuestion

http://stackoverflow.com/a/23911366
has body: Try This : File yourFile= new File("C:/File/File1/A10301A0003174228I_20140528080958095/A10301A0003174228I.xml"); yourFile.renameTo(new File("E:/FileDest/File1/A10301A0003174228I.xml" ));
has comment: http://stackoverflow.com/comment/36820769
has comment: http://stackoverflow.com/comment/36824565
has comment: http://stackoverflow.com/comment/36820529
upvote count: 0
has comment: http://stackoverflow.com/comment/36820549
type: Answer
has comment: http://stackoverflow.com/comment/36821049
score: -1
has comment: http://stackoverflow.com/comment/36850639
downvote count: 1
answers question: http://stackoverflow.com/q/23911244
has comment: http://stackoverflow.com/comment/36820689

http://stackoverflow.com/q/23789271
has answer: http://stackoverflow.com/a/63215412
tagged with: junit
favorite count: 0
score: 24
has title: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z
has body: Am very new to spring and JUnit. Am trying to run a simple JUnit test case for spring service class, but it fails and I get this exception.I didnt write any test yet, but trying to run through before implementing. Using tomcat v7.0. And I dont think have any spring conflicting versions. Please help. java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:126) at org.springframework.test.context.MetaAnnotationUtils.findAnnotationDescriptor(MetaAnnotationUtils.java:96) at org.springframework.test.context.ContextLoaderUtils.resolveActiveProfiles(ContextLoaderUtils.java:499) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:722) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:656) at org.springframework.test.context.DefaultTestContext.<init>(DefaultTestContext.java:93) at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:119) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:120) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:109) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Run…
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/39168202
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77344133
has answer: http://stackoverflow.com/a/23789416
tagged with: java
has comment: http://stackoverflow.com/comment/36592313
upvote count: 24
type: Question
has answer: http://stackoverflow.com/a/23791840
downvote count: 0
has answer: http://stackoverflow.com/a/25288017
answer count: 6
possible better answer: http://stackoverflow.com/a/23791840
accepted answer: http://stackoverflow.com/a/23789416
linked to: http://stackoverflow.com/q/34085233

http://stackoverflow.com/comment/36692003
score: 0
has text: Yes, they all are part of the same class of which I make only one object. So they are safe?
type: Comment
comment on: http://stackoverflow.com/a/23844127
type: AnswerComment

http://stackoverflow.com/comment/36662303
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23828593
has text: .+#.+ is what you need

http://stackoverflow.com/comment/36720236
has text: @DaviArimateia unfortunatelly I think yes, because that is not a single join table... you have a field that needs an Entity to reflect its value.
comment on: http://stackoverflow.com/a/23851911
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23845766
tagged with: terminal
duplicate of: http://stackoverflow.com/q/3976342
has body: When I've tried to open a jar file in terminal (OS X 64 bit), I got the next message : What should I do in order to open the file? software1 bktomer$ java -jar MusicTunes.jar ***WARNING: Display must be created on main thread due to Cocoa restrictions. Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source) at org.eclipse.swt.widgets.Display.create(Unknown Source) at org.eclipse.swt.graphics.Device.&lt;init&gt;(Unknown Source) at org.eclipse.swt.widgets.Display.&lt;init&gt;(Unknown Source) at org.eclipse.swt.widgets.Display.&lt;init&gt;(Unknown Source) at org.eclipse.swt.widgets.Display.getDefault(Unknown Source) at il.ac.tau.cs.sw1.musictunes.ui.GraphicalMusicTunesViewer.createShell(GraphicalMusicTunesViewer.java:63) at il.ac.tau.cs.sw1.musictunes.ui.GraphicalMusicTunesViewer.show(GraphicalMusicTunesViewer.java:55) at il.ac.tau.cs.sw1.musictunes.ui.GraphicalMusicTunesViewer.showViewer(GraphicalMusicTunesViewer.java:38) at il.ac.tau.cs.sw1.musictunes.ui.GraphicalMusicTunesViewer.main(GraphicalMusicTunesViewer.java:33)
linked to: http://stackoverflow.com/q/12267949
type: AnsweredQuestion
has title: How to Successfully open a SWT jar file in Terminal
has answer: http://stackoverflow.com/a/23846698
tagged with: swt
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23846698
tagged with: osx-mavericks
tagged with: java
score: -1
upvote count: 0
answer count: 1
tagged with: jar
favorite count: 0
linked to: http://stackoverflow.com/q/3976342

http://stackoverflow.com/a/23856063
type: Answer
has body: Try using this way.. ImageIcon icon = new ImageIcon(TestOptionPane04.class.getResource(path for image file)); JOptionPane.showMessageDialog(this,"Hello world","Hello", JOptionPane.INFORMATION_MESSAGE, icon);
has comment: http://stackoverflow.com/comment/36715422
score: 0
answers question: http://stackoverflow.com/q/23856021
has comment: http://stackoverflow.com/comment/36715445

transactional
tags question: http://stackoverflow.com/q/23906236
tag name: transactional
type: Tag

http://stackoverflow.com/q/23837218
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23837343
has title: Recursion in java and maintaining states of variables across stacks
tagged with: pass-by-value
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/23837343
has body: I was trying to solve a problem in BST where the question was "Check if all leaves are at same level" In this question, I need to keep incrementing the level per stack call but also maintain a value across all calls, the maximum level. Along with this, I need to return a boolean with the result. It is simple enough to solve, I need to keep doing down the tree, I did this int maxlevel = 0; public boolean allAtSameLevel(Node root, int level){ if(root== null){ return false; } if(root.left== null &amp;&amp; root.right == null){ if(maxlevel == 0){ maxlevel = level; } return(level== maxlevel); } return allAtSameLevel(root.left, level+1) &amp;&amp; allAtSameLevel(root.right, level+1) ; } My problem is that for a value that needs to be shared, I have to maintain an instance variable in java. Is there a better way to do this? My confusion is that since, it's going to go all the way to the right leaf first and then go up, passing the value won't help. Any ideas?
tagged with: tree
tagged with: recursion
score: 2

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/23845957
type: Tag

http://stackoverflow.com/comment/36710913
has text: @user3198603 Well, you typically don't select on a file basis, but on a project basis, see "coverage tab" in http://www.eclemma.org/userdoc/launching.html. To get rid of the colours, see "Remove all sessions" in http://www.eclemma.org/userdoc/coverageview.html (The icon with two X)
type: Comment
comment on: http://stackoverflow.com/a/23846512
type: AnswerComment
score: 0

http://stackoverflow.com/a/29408567
answers question: http://stackoverflow.com/q/23890414
type: Answer
has body: I think this issue is caused by a few reason: 1. You site is required login. And I checked the code of SyncProxy(0.5), it doesn't support if a site is secure. 2. SyncProxy will download some files from server side, for example: compilation-mappings.txt *.nocache.js *.cache.html *.gwt.rpc If SyncProxy cannot download them, this error may occur, please check it these files can be download and the uri and name format of them is as default. I was contacting with the owner of SyncProxy to improve this feature to support basic cookie/sessionid checking of auth. https://github.com/jcricket/gwt-syncproxy/issues/46#issuecomment-89271311
score: 0

http://stackoverflow.com/comment/36850797
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23908225
type: AnswerComment
has text: my actual requirement is i need to run with out installing libwebkitgtk in my system...bcoz this code is going to be executed in hundreds of production machines as it is a retail project

http://stackoverflow.com/comment/36597197
type: AnswerComment
type: Comment
has text: Actualy, I am using JSP approach exactly as you stated. I serve this JSP as `application/javascript` and it has `url` function: `function url(path){return '<spring:url value="/">' + path}`. Well, if nothing better invented, I am happy with this!
comment on: http://stackoverflow.com/a/23793059
score: 1

http://stackoverflow.com/comment/36859608
has text: phaseDao.findPhaseByPrimaryKey(idphaseKey) dont returns null but when i add phaseDao.findPhaseByPrimaryKey(idphaseKey).getTaches() that returns null because this list dont have any record
comment on: http://stackoverflow.com/a/23932263
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36572947
comment on: http://stackoverflow.com/q/23780700
score: 0
type: QuestionComment
has text: I read it. But couldn't find what line in my code is creating this error. Hence asked for your help !
type: Comment

http://stackoverflow.com/comment/36604993
has text: I see. It makes sense if it's the GC and the Main threads. How many GC thread a java program can have?
comment on: http://stackoverflow.com/q/23798162
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23787943
has comment: http://stackoverflow.com/comment/43448574
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/51192416
has comment: http://stackoverflow.com/comment/36585875
has title: "Invalid maximum heap size" when running Maven
has answer: http://stackoverflow.com/a/45917953
has comment: http://stackoverflow.com/comment/36585539
type: Question
has answer: http://stackoverflow.com/a/71330219
has comment: http://stackoverflow.com/comment/36585371
downvote count: 0
has comment: http://stackoverflow.com/comment/36590350
has comment: http://stackoverflow.com/comment/36585785
has comment: http://stackoverflow.com/comment/36586105
has comment: http://stackoverflow.com/comment/44553678
has answer: http://stackoverflow.com/a/32139893
tagged with: jvm
answer count: 4
favorite count: 0
has body: I'm having problems setting up maven. I'm using windows 7 64 bit with 4 GB of RAM. I get this error when trying to run mvn: Invalid maximum heap size: -Xmx512m. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Here are my user variables: JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55 M2=%M2_HOME%\bin M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.2.1 MAVEN_OPTS=-Xms256m -Xmx512m Path=%M2%;%JAVA_HOME%\bin
tagged with: heap-memory
type: UnansweredQuestion
tagged with: maven
upvote count: 7

http://stackoverflow.com/q/23817247
tagged with: google-visualization
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/23817445
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/3607010
favorite count: 0
type: UnansweredQuestion
has title: How to parse a reader in Java before sending to a method who use this reader
score: 1
tagged with: java
upvote count: 1
type: Question
has body: Here is the code and what I want to do Reader reader = new BufferedReader (new InputStreamReader (new URL (url).openStream())); /* * I want to do this code before sending to CsvDataSourceHelper * but Reader has no method replace ^^ * * reader.replace("+", "").replace("%", ""); */ DataTable dataTable = CsvDataSourceHelper.read(reader, column, false); url is a string with a url of a csv file column is an ArrayList of ColumnDescription DataTable and CsvDataSourceHelper are classes created by Google reader is a csv file DataTable Documentation CsvDataSourceHelper Documentation reader receives a csv file from the internet I must send this csv file to CsvDataSourceHelper The problem is that the csv file is incorrectly formatted, I would remove the + and % before sending to CsvDataSourceHelper I could do it after, with a for loop on dataTable, but the problem is that the file is incorrectly formatted so CsvDataSourceHelper does not give me the right result Thank you

http://stackoverflow.com/comment/36761538
type: AnswerComment
comment on: http://stackoverflow.com/a/23878890
type: Comment
score: 0
has text: There should be a file in the `modules` directory within the compressed file called `javax.persistence_2.0.jar` that contains the implementation of Entity, Id, Column, etc.

http://stackoverflow.com/a/23835524
score: 0
has body: My take with composition: public interface IDItf { abstract int getId(); abstract void setId(int id); } class IDSupport implements IDItf { int id; public IDSupport(int id) { super(); this.id = id; } public int getId() { return id; } public void setId(int id) { this.id = id; } } public interface PriorityItf { abstract int getPriority(); abstract void setPriority(int priority); } ... (PrioritySupport class) public interface ActivityItf { abstract boolean isActive(); abstract void setActive(boolean active); } ... (ActivitySupport class) class Employee implements IDItf, PriorityItf, ActivityItf, Comparable&lt;Header&gt; { private IDSupport idSupport; private PrioritySupport prioritySupport; private ActivitySupport activitySupport; public Employee(int id) { super(); idSupport = new IDSupport(id); prioritySupport = new PrioritySupport(0); activitySupport = new ActivitySupport(false); } @Override public int compareTo(Header o) { return Integer.compare(o.prioritySupport.getPriority(), prioritySupport.getPriority()); } // Delegate methods (create them with Eclipse or other IDE's features) public int getId() { return idSupport.getId(); } public void setId(int id) { idSupport.setId(id); } ... } The ...Support classes are rather trivial, but if they require a little more logic, they make more sense. The fields in class Employee could use a final keyword. I found the composition helpful in the past. Having the boilerplate code doesn't feel good initially. However, the delegate methods can be generated by the IDE. The Support classes could also mostly be generated (create the field, let the IDE create the constructor and the getters/setters). The downside may be a big slump of generated code which still has to be maintained. However, I prefer simpler code in the long run, even it is boring to read. In the past 25 years more than once I looked at my code from some time ago and wondered what I was thinking. Sometimes even comments don't help if one didn't document the crucial hint …
type: Answer
answers question: http://stackoverflow.com/q/23833127

http://stackoverflow.com/q/23889867
tagged with: java
tagged with: import
type: Question
tagged with: coordinate
score: 0
answer count: 1
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/23889989
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23889989
has title: Java disutil CoordinateConversions import problems
has body: I'm writing a Java class that will be used to send PDUs across a network- to do this, I am following the tutorial at: Tutorial In the example, the line: double lla[] = CoordinateConversions.xyzToLatLonDegrees(c); appears towards the end of the class, and I see that CoordinateConversions has been imported with the line: import edu.nps.moves.disutil.CoordinateConversions; I have tried using the xyzToLatLonDegrees(); method in the class that I am writing- calling it in the same way as is done in the example. However, for some reason, I get a compile error that says: CoordinateConversions cannot be resolved on the line where I'm trying to use it, and The import edu.nps.moves.disutil.CoordinateConversions cannot be resolved on the line where I am importing it. Does anyone know why this is, and how I can fix the import, so that I can use the xyzToLatLonDegrees() method?

http://stackoverflow.com/comment/36698501
has text: @PradeepSimha How would you do it without regular expressions? Just curious.
score: 1
comment on: http://stackoverflow.com/q/23847379
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23916947
has comment: http://stackoverflow.com/comment/36831356
has comment: http://stackoverflow.com/comment/36831830
has comment: http://stackoverflow.com/comment/36832180
has body: Your regular expression for the title ([0-9][a-z][A-Z]+) is for sure not correct since the + refers to the [A-Z] only. In addition to this the - your are mentioning in the question is missing. You could try this instead: ([0-9a-zA-Z\-]+)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36831583
accepted answer of: http://stackoverflow.com/q/23916595
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36831900
answers question: http://stackoverflow.com/q/23916595

http://stackoverflow.com/comment/36697547
score: 0
type: Comment
type: QuestionComment
has text: What do you mean ? Presence of double quotes will be a problem, or it will parse, I am not doing it the correct way ?
comment on: http://stackoverflow.com/q/23846926

http://stackoverflow.com/comment/36800222
type: QuestionComment
has text: Just for starters, negative numbers have a 1 in the high order bit, so they would sort AFTER the positive numbers.
score: 0
comment on: http://stackoverflow.com/q/23900328
type: Comment

http://stackoverflow.com/q/23809650
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/17334122
has body: I'm developing a new web application using Spring MVC with Spring Security 3.1.1 via Spring Tools Suite 3.4. My application is being written in java 1.6, it is authenticating against an Active Directory system, and it will be deployed to a Tomcat 7 server. I will be deploying the application via WAR file to three different environments: dev, qa, and prod. What I normally do for settings that are unique for each environment, such as database connection strings (there's a separate database for each environment), is configure the Tomcat server's context.xml file, read that via jndi lookup in my Spring application and inject those settings into my DAO classes. The challenge that I have now is to figure out how to do something similar for my Active Directory settings that need to be injected into my spring-security-context.xml file. As of right now, I've got my Active Directory domain and url hardcoded in my spring-security-context.xml file, but I don't want to leave it like that as there is a different Active Directory system for each of my environments. I guess what's confusing me about this is that I'm injecting constructor and property values into my ActiveDirectoryLdapAuthenticationProvider class from the spring-security-context.xml file, but how do I inject those settings into the spring-security-context.xml file from my Tomcat server's context.xml file? Here's my spring-security-context.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:security="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <security:http pattern="/login" security="none" /> <security:http pattern="/logerror" security="none"…
possible better answer: http://stackoverflow.com/a/23809990
has title: How to inject values from context.xml
has answer: http://stackoverflow.com/a/23809990
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24458496
linked to: http://stackoverflow.com/q/2161054
tagged with: java
type: Question
tagged with: context.xml
tagged with: tomcat
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/24458496

http://stackoverflow.com/comment/36733914
score: 1
comment on: http://stackoverflow.com/q/23864947
type: QuestionComment
type: Comment
has text: @blackbelt who cares about a stacktrace? It is way cooler to just ask a question here and abuse the time others spend to help people who really want to evolve into a better programmer... don't be a sissy about it! (if you find irony/sarcasm, keep it to yourself!)

http://stackoverflow.com/comment/36802734
score: 0
type: AnswerComment
has text: Teaching you to use ant is well beyond the scope of a SO answer. You need to go google for some ant tutorials.
comment on: http://stackoverflow.com/a/23896611
type: Comment

http://stackoverflow.com/comment/36653042
comment on: http://stackoverflow.com/a/23823166
type: Comment
score: 0
type: AnswerComment
has text: The code i have written in question is a part of android library which is using generic list to handle all lists with all types (even custom). I am passing my List<MyClass> to this library which converts its to List<?>

http://stackoverflow.com/a/23846698
answers question: http://stackoverflow.com/q/23845766
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: You must specify the -XstartOnFirstThread option when running an SWT program on OS X: java -XstartOnFirstThread -jar MusicTunes.jar
accepted answer of: http://stackoverflow.com/q/23845766
type: AcceptedAnswer

udp
tags question: http://stackoverflow.com/q/23847905
tags question: http://stackoverflow.com/q/23876580
tag name: udp
type: Tag
tags question: http://stackoverflow.com/q/23783457

http://stackoverflow.com/a/23785899
has comment: http://stackoverflow.com/comment/36618865
score: 1
has comment: http://stackoverflow.com/comment/36618516
has comment: http://stackoverflow.com/comment/36620143
answers question: http://stackoverflow.com/q/23784881
has body: Edit Perhaps what would fit your needs the best is a cache. Consider Guava's Cache. A Cache can have a limited size (removing LRU elements as necessary), expire elements after a certain time, etc. An example from their docs: LoadingCache&lt;Key, Graph&gt; graphs = CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(10, TimeUnit.MINUTES) .removalListener(MY_LISTENER) .build( new CacheLoader&lt;Key, Graph&gt;() { public Graph load(Key key) throws AnyException { return createExpensiveGraph(key); } }); You could implement your own class similar to Java's Reference implementations. For example: import java.util.Objects; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; public class TimeoutReference&lt;T&gt; { public final AtomicReference&lt;T&gt; reference; /** * Create new instance * @param referent The reference * @param timeout minimum length of time the reference is guaranteed to not * be {@code null}. * @param unit the units of {@code timeout} * @throws NullPointerException if any parameter is {@code null}. */ public TimeoutReference(T reference, long timeout, TimeUnit unit) { this.reference = new AtomicReference&lt;&gt;( Objects.requireNonNull(reference)); ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.schedule(() -&gt; { this.referent.set(null); service.shutdown(); }, timeout, unit); } /** * Returns the reference or {@code null} if the time has expired. */ public T get() { // perhaps throw a checked exception for clarity. return reference.get(); } } Which seems to work reasonably well, public static void main(String[] args) throws InterruptedException { // object created will be null after 3 seconds TimeoutReference&lt;String&gt; o = new TimeoutReference&lt;&gt;( "My non-null value", 3, TimeUnit.SECONDS); System.out.println("Before: " + o.get()); Thread.sleep(4000) ; System.out.pri…
has comment: http://stackoverflow.com/comment/36619141
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38645689
has comment: http://stackoverflow.com/comment/36618380
downvote count: 0
has comment: http://stackoverflow.com/comment/36618205

http://stackoverflow.com/comment/36758448
has text: @NguyenStorm give a complete example: All inputs to the Android encode and the output (there is probably an iv in the output. Also any other information about `SecretKeySpec` and `Cipher` that you know. Key size, mode, etc.
comment on: http://stackoverflow.com/q/23861877
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23912317
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23911911
has body: I found a solution. This code made me realize it: String cypher = "CREATE (versionNode:Version {previousVersions: [4,3,2,1]}) " + "RETURN versionNode.previousVersions AS versions"; ExecutionResult result = new ExecutionEngine(db).execute(cypher); System.out.println(result.iterator().next().get("versions").getClass()); this outputted the strange symbol: class [J According to the Java docs for Class#getName() it means the type of the object returned is a primitive long array. So now I can do this and get my numbers returned into a collection: Collection&lt;Long&gt; versionsCollection = new ArrayList&lt;&gt;(); long[] versions = (long[]) result.iterator().next().get("versions"); for (long v : versions) { versionsCollection.add(v); }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23911911

http://stackoverflow.com/q/23820489
score: -1
linked to: http://stackoverflow.com/q/326699
has comment: http://stackoverflow.com/comment/36647687
tagged with: security
tagged with: decode
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23820538
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9316437
tagged with: encryption
has title: What is the quivalent decrypt code
linked to: http://stackoverflow.com/q/1240852
has body: Please let me know equivalent code to decrypt. I have encrypted my password using this encode method and now i want to decrypt now. MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(password.getBytes()); BASE64Encoder encoder = new BASE64Encoder(); byte hashedBytes[] = (new String(digest.digest(), "UTF-8")).getBytes(); System.out.println(encoder.encode(hashedBytes))
duplicate of: http://stackoverflow.com/q/9316437
duplicate of: http://stackoverflow.com/q/1240852
has comment: http://stackoverflow.com/comment/36660282
tagged with: java
downvote count: 1
type: Question
tagged with: passwords

http://stackoverflow.com/q/23830889
has title: Android studio devices
has comment: http://stackoverflow.com/comment/36666735
has answer: http://stackoverflow.com/a/24147679
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24147679
tagged with: android-studio
has comment: http://stackoverflow.com/comment/36666828
tagged with: adb
has answer: http://stackoverflow.com/a/23837596
has comment: http://stackoverflow.com/comment/36702261
has comment: http://stackoverflow.com/comment/36666698
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23837596
type: Question
answer count: 2
has body: Once or twice a day Android Studio doesn't recognize any devices attached to my computer. Even adb devices doesn't show anything. The only thing that makes my devices reappear is restarting my computer. Even adb kill-server adb start-server doesn't show any devices. Does anybody know why and how I can make adb recognise my devices without restarting my computer?

http://stackoverflow.com/q/23938879
tagged with: java
has answer: http://stackoverflow.com/a/25934701
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25934701
has body: Can you modify the darkness you get on screen when using a ray handler in libgdx with box2d world? Also when I put lights over sprites they look different because the light is on top of them. Can you render lights so that the color of the sprite is the same, even though it is lighted up by a source?
tagged with: light
type: AnsweredQuestion
has title: box2d - How do I render lights in a proper way?
score: 1
upvote count: 1
tagged with: box2d
type: Question
tagged with: libgdx

android-volley
tags question: http://stackoverflow.com/q/23784558
type: Tag
tag name: android-volley
tags question: http://stackoverflow.com/q/23833977

http://stackoverflow.com/a/23797341
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/23792749
has body: What I'm trying to avoid is to declare many beans in an xml file by using the @Service annotation What you are doing is fine. Mapping from annotations instead of XML is not what is giving you the NullPointerException. When I deploy this application to jboss 6.1 I get a NullPointerException. I guess it is because Spring is not able to Autowire the service to the Component but I'm not sure why this is happening Yes, JBoss is not able to inject because JAX-RS (in your case RESTEasy) does not know about Spring beans. They are not integrated out of the box. It is happening because the JAX-RS implementation wont look from @Autowired in its resources (resources in this context are @Path annotated classes). You need extra work for using Spring Beans inside a Java EE container. Any help will be appreciated All the options you have that I could find are: Get your Spring Bean from an ApplicationContext Use @Inject convention (I think it is not supported for JBoss 6, not sure) Declare your RESTful API with Java Interfaces I didnt test these examples btw. Another options are: Just go with Spring MVC as you mentioned. Use EJB instead of Spring Beans, which would make sense since you are under a Java EE server. Maybe try Jersey. Keep in mind that Spring's Transaction is independant from Java EE transaction. You are mixing JAX-RS with Spring. Transaction will need extra love. If I were you I would consider using EJB instead of Spring Beans if it is an option. I'm having some issues trying to configure an app to use RESTEasy + Spring 3 + Maven Check out another answer of mine about this topic. Maybe it will help you decide which engine of RESTful is more appropriate for your solution. Spring annotations for GET requests
type: Answer
upvote count: 1

orm
tags question: http://stackoverflow.com/q/23904429
tags question: http://stackoverflow.com/q/23867435
tags question: http://stackoverflow.com/q/23900976
tag name: orm
tags question: http://stackoverflow.com/q/23856058
tags question: http://stackoverflow.com/q/23909344
tags question: http://stackoverflow.com/q/23835442
tags question: http://stackoverflow.com/q/23828073
type: Tag
tags question: http://stackoverflow.com/q/23807143
tags question: http://stackoverflow.com/q/23825060
tags question: http://stackoverflow.com/q/23798971
tags question: http://stackoverflow.com/q/23888237
tags question: http://stackoverflow.com/q/23925322
tags question: http://stackoverflow.com/q/23940320
tags question: http://stackoverflow.com/q/23862969
tags question: http://stackoverflow.com/q/23881319
tags question: http://stackoverflow.com/q/23782304

http://stackoverflow.com/a/23910232
type: Answer
answers question: http://stackoverflow.com/q/23893080
has comment: http://stackoverflow.com/comment/36818307
upvote count: 1
score: 1
downvote count: 0
has body: As I see it, you have a few options, depending on exactly what you want to achieve in your tests now, and what you might want to be able to do in the future. 1) If your test does not need the websocket configuration at all, change it to point at a custom context configuration that does not include the WebSocketConfig. 2) If your test needs the websocket config, but you don't need the broker relay (I can't see why it would be required in a test), you could add another Configuration for testing that uses registry.enableSimpleBroker("/topic", "/queue/") instead of enableStompBrokerRelay. Then there will be no TCP connection to the broker. The obvious disadvantage with this approach is that you are not testing your actual config, and that you are duplicating the destination prefixes. 3) Run an embedded STOMP broker for your tests. I'm not 100% certain such a thing exists - I know ActiveMQ has STOMP support and some support for running inside a VM, but I haven't tried this with STOMP. If possible, the advantage of this approach is that your tests would be testing something very close to the real code. 4) You could customise the STOMP broker relay to such an extent that you have full control over what your application receives from the broker. You can customise the StompBrokerRelayMessageHandler which manages the connection to the relay broker by adding a Configuration class that extends DelegatingWebSocketMessageBrokerConfiguration in order to override the stompBrokerRelayMessageHandler() method. For example, you can set the TCP client it uses to your own implementation of TcpOperations. Below is an example TCP client that simply does nothing, i.e. makes the Handler think it is connected, but cannot receive or send messages. @Override public AbstractBrokerMessageHandler stompBrokerRelayMessageHandler() { AbstractBrokerMessageHandler handler = super.stompBrokerRelayMessageHandler(); if (handler instanceof StompBrokerRelayMessageHandler) { StompBrokerRelayMessageHandler st…
has comment: http://stackoverflow.com/comment/36819929

http://stackoverflow.com/q/23844659
has comment: http://stackoverflow.com/comment/40041561
tagged with: java
has body: I am coding up a relatively simple GUI application in Java using widgets from the Swing library. What is the common practice for 'conditionally' displaying certain items? Is it to .setVisible(false) on things that we want to temporarily hide; or is it to .add items as they are needed and then removing them when they are not to be shown any more?
has answer: http://stackoverflow.com/a/23845128
has comment: http://stackoverflow.com/comment/36692965
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/36692906
has comment: http://stackoverflow.com/comment/36692910
tagged with: user-interface
favorite count: 0
upvote count: 5
has title: Java GUI better to remove or setVisible(false)?
has answer: http://stackoverflow.com/a/23844991
accepted answer: http://stackoverflow.com/a/23844991
has comment: http://stackoverflow.com/comment/36692968
possible better answer: http://stackoverflow.com/a/23845128
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36693042
downvote count: 0
linked to: http://stackoverflow.com/q/14170257
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36692967

http://stackoverflow.com/q/23850855
accepted answer: http://stackoverflow.com/a/23850917
tagged with: static
tagged with: abstract
has body: I am writing a 2048 game and self-solver in Java. My most important class is a Board, which contains the main game functionality. For efficiency reasons, many aspects of the game are encoded in arrays, such as the transformations for each possible row when moved left or right. In a static initialization block, I call static void generateTables(), which creates the tables once. Boards with solving capabilities extend Board and implement Solver, an interface containing high-level methods getDirection() and getWorstLocation() which are used by the interface classes to run the solver and to get hints. The main type of solver I am interested in records a list of heuristic values for all possible rows, then runs expectiminimax search using these values. So I have the class: public class HeuristicBoard extends Board implements Solver { private static int[] heuristic; // Lookup table /* ... methods omitted ... */ private int heuristic() {...} // Calculates a heuristic value for the entire board based // on calls to the following method // This method's code could change depending on algorithm implementation. private static int heuristic(short row) {...} // Checks the lookup table for the row provided private static void generateHeuristicTable() {...} // Generates the lookup table based on calls to the following method private static int heuristic(byte[] row) {...} // Calculates the heuristic value for a single row. // This method's code could change depending on algorithm implementation. } Now, I would like to test multiple different heuristics, but with the same expectiminimax algorithm. Therefore, the implementations of int heuristic() and static int heuristic(byte[] row) would change, while the others would remain the same. What is the best way to abstract the functionality of the HeuristicBoard class so as to have multiple child(?) classes that implement int heuristic() and static int heuristic(byte[] row)? Preferably they would have a common ancestor so I could have: C…
type: AnsweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36705626
tagged with: oop
has answer: http://stackoverflow.com/a/23850917
score: 1
tagged with: java
has title: Proper Java inheritance structure
answer count: 1
downvote count: 0
tagged with: inheritance
favorite count: 0

http://stackoverflow.com/q/23869929
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23870542
has title: Unique constraint in OneToOne bi-directional mapping
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: one-to-one
accepted answer: http://stackoverflow.com/a/23870542
tagged with: hibernate-mapping
has body: Is unique=true required in bi-directional one-to-one mapping in the owner of the relationship? @Entity public class Customer { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; @OneToOne(cascade={CascadeType.PERSIST}) @JoinColumn(name="passport_id", unique=true) //is unique=true required for bi-directional one-to-one mapping private Passport passport; public Passport getPassport() { return passport; } } @Entity public class Passport { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @Column(name="passport_number") private String passportNumber; @OneToOne(mappedBy="passport") private Customer customer; public Customer getCustomer() { return customer; } } Hibernate documentation says that FK column in the database should be constrained unique to simulate one-to-one multiplicity, but it doesn't add the unique=true in the bi-directional mapping.
type: AnsweredQuestion

http://stackoverflow.com/a/23937606
has body: Assuming that a "camel case word" is defined as follows: "Camel case word" definition: Consists of only upper and lower case letters; [A-Za-z]. Must begin with a lower case letter; [a-z]. Must contain at least one upper case letter; [A-Z]. The following tested Java program contains a fully commented regex that may be helpful: // TEST.java 20140529_0900 import java.util.regex.*; public class TEST { public static void main(String[] args) { String data = "This has one camelCase word."+ "This hasTwo camelCaseWords."+ "NON CamelCase withDigits123 words."; Pattern re_camel_case_word = Pattern.compile( " # Match one camelCase word.\n" + " \\b # Anchor to word boundary. \n" + " [a-z]+ # Begin with one or more lowercase alphas. \n" + " (?: # One or more parts starting with uppercase. \n" + " [A-Z] # At least one uppercase alpha \n" + " [a-z]* # followed by zero or more lowercase alphas. \n" + " )+ # One or more parts starting with uppercase. \n" + " \\b # Anchor to word boundary.", Pattern.COMMENTS); Matcher matcher = re_camel_case_word.matcher(data); while (matcher.find()) System.out.println(matcher.group(0)); } } Note that with this definition, digits and other non-alpha chars are not allowed. The pattern would need to be modified to accommodate other "camel case word" definitions.
score: 2
answers question: http://stackoverflow.com/q/23936280
upvote count: 2
type: Answer
downvote count: 0

http://stackoverflow.com/a/64952015
type: Answer
has body: To add constraint over the rows, you should transpose the matrix and apply the constraint over the lines : transposed = ArrayUtils.transpose(x); for(int i=0; i&lt;n; ++i){ model.sum(transposed[i], &quot;=&quot;, 1); }
answers question: http://stackoverflow.com/q/23794115
score: 0

http://stackoverflow.com/comment/37232586
has text: Your bounty was too tempting so I started my frenetic search to solve your issue, but... sigh... unfortunately for me it already has an answer here: http://stackoverflow.com/a/12744437/2164109 such question is updated for version 12, but checking in my IntelliJ IDE (v13) there are just minor differences, so it isn't worth a new answer...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23923304

http://stackoverflow.com/comment/36631061
comment on: http://stackoverflow.com/q/23812142
score: 0
has text: What do you mean by "_count the loop_"?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36734882
score: 0
comment on: http://stackoverflow.com/q/23827960
type: Comment
type: QuestionComment
has text: @basin File is written directly in `etc/xdg/autostart`. When I open with `xdg-open`, the script opens in Libre office

http://stackoverflow.com/comment/36739359
type: Comment
type: QuestionComment
has text: If you create a DTO (or perhaps just use your entity class) and use it in the controller method, Spring will try to bind the request parameters to the properties of the DTO. Perhaps that is what you are looking for
comment on: http://stackoverflow.com/q/23868547
score: 0

http://stackoverflow.com/a/23854120
type: AcceptedAnswer
downvote count: 0
has body: Yes, its possible to configure multiple spring portlets in a single plugin project in such a way that single .war file contains multiple portlets. In web.xml contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener view-servlet org.springframework.web.servlet.ViewRendererServlet 1 view-servlet /WEB-INF/servlet/view In applicationContext.xml You can specify common bean configuration for all portlets here. <context:annotation-config /> <property name="cache" value="false"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/jsp/"/> <property name="suffix" value=".jsp"/> <property name="contentType" value="text/html; charset=UTF-8" /> In portlet.xml You can specify multiple entries of <portlet> in this file. For spring portlet, you should specify and as below. org.springframework.web.portlet.DispatcherPortlet contextConfigLocation classpath:myportlet-context.xml In myportlet-context.xml Place your portlet controller classes in my.portlet.package and specify it in this file. <context:component-scan base-package="my.portlet.package" /> In liferay-portlet.xml Even this file contains multiple <portlet> tags. In Your portlet controller class Add annotations to specify controller and to map with portlet mode. You can see here various other mappings available in spring documentation. @Controller @RequestMapping(value = PortletModeVal.VIEW) public class MyPortletControll implements PortletConfigAware
type: Answer
score: 4
answers question: http://stackoverflow.com/q/23853729
accepted answer of: http://stackoverflow.com/q/23853729
upvote count: 4

http://stackoverflow.com/comment/36651532
comment on: http://stackoverflow.com/q/23822624
type: Comment
has text: @user3667783 there are some correct answers below these comments.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23921640
has comment: http://stackoverflow.com/comment/36843583
accepted answer of: http://stackoverflow.com/q/23921389
answers question: http://stackoverflow.com/q/23921389
score: 0
type: AcceptedAnswer
has body: Look into url rewriting, for instance with Tuckey, and you can get rid of this whole procedure for your external urls, and keep it on the backend. You can create rules to have your url be like www.example.com/product/THEPRODUCTID/i on the user end and get translated to www.example.com/?id=THEPRODUCTID#i in the backend.
has comment: http://stackoverflow.com/comment/36843740
type: Answer

http://stackoverflow.com/q/23813174
has answer: http://stackoverflow.com/a/23813372
favorite count: 0
possible better answer: http://stackoverflow.com/a/23813441
has answer: http://stackoverflow.com/a/23813441
has body: I have a Java web application and currently I have two controllers. One controller for REST calls and the other controller to pass ModelAndView (using Spring MVC) objects to a view. My concern is that both of these methods are referencing the same service layer calls. Should I perhaps create an abstract class that contains the code that interacts with the service layer? Should the REST controller be merged in with the other controller?
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/36633060
accepted answer: http://stackoverflow.com/a/23813372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36633684
score: 1
tagged with: java
type: Question
answer count: 2
has title: Should I have a separate controller for my REST methods?
downvote count: 0
tagged with: rest

http://stackoverflow.com/comment/36665444
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23830040
has text: @user3580294 This is why you should write a harnessed benchmark. There are plenty examples deployed with the JMH. But do not forget that a harness does neither guarantee you a specific measurement. You need a tool like *JIT watch* if you want to know for sure what happens under the covers.

http://stackoverflow.com/comment/36745600
score: 0
type: Comment
type: QuestionComment
has text: `startActivity` is not defined in your view and Not in `WebViewClient`. That is a method from `Activity`
comment on: http://stackoverflow.com/q/23872245

http://stackoverflow.com/a/23824682
accepted answer of: http://stackoverflow.com/q/23823551
score: 0
type: AcceptedAnswer
has body: if i'm getting you correctly, you need to get rid off field for serialization, to json format, if im right, then make your field transient other solution is to make super class with field which you want to serialize, and make A to extend it but modifying class on fly, it is not right way to go
type: Answer
has comment: http://stackoverflow.com/comment/37203606
answers question: http://stackoverflow.com/q/23823551

http://stackoverflow.com/comment/36593310
score: 0
type: AnswerComment
type: Comment
has text: OMG NICK! WE DID IT! I am so over the moon excited! wahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh I changed [this] to MainActivity.class and it works! You are AWESOME! Should I update the original code to show the working code? How do I thumbs you up? lol This is my first time posting a question, so I'm not sure how this works now! Thank you so much! I have spent a MONTH on trying to figure this out!!!!!!!!!!!!!!
comment on: http://stackoverflow.com/a/23789009

http://stackoverflow.com/comment/36695044
type: Comment
score: 0
type: AnswerComment
has text: can you share the snippet where its called second time? Calling this method results in adding more and more tables to the container. Still that shouldn't cause a problem like you mentioned. It might depend on the way you call it.
comment on: http://stackoverflow.com/a/23828742

http://stackoverflow.com/q/23890783
score: 0
has answer: http://stackoverflow.com/a/27660194
tagged with: xml-serialization
has body: I have been using XMLEncoder to transform POJOs into XML and back again. Apart from storing POJOs, some XML output will also be used by other applications to generate other forms of data, such as reports. So far this has worked well. Even as the POJOs evolve there have been no problems. Recently I realised that not all values are actually output. Properties whose default values have not been altered will not be written. This is a problem for me. From the Javadoc: "The XMLEncoder class uses a redundancy elimination algorithm internally so that the default values of a Bean's properties are not written to the stream" For me, it is important that the bean is output in its' entirety - including all default values. Is there any way to disable this feature of XMLEncoder?
type: UnansweredQuestion
tagged with: xmlencoder
has comment: http://stackoverflow.com/comment/65710916
tagged with: java
has answer: http://stackoverflow.com/a/24007085
type: Question
answer count: 2
has title: How to disable the redundancy elimination feature of XMLEncoder to ensure POJOs completely serialised?

http://stackoverflow.com/comment/36781394
comment on: http://stackoverflow.com/q/23888072
score: 0
has text: Are you using spring? When CXF detects Spring in your application .... maybe id decides to use CXF+Spring implementation instead of CXF alone. https://community.jboss.org/thread/194685
type: Comment
type: QuestionComment

selenium-webdriver
tags question: http://stackoverflow.com/q/23913101
tags question: http://stackoverflow.com/q/23905216
tags question: http://stackoverflow.com/q/23897265
tags question: http://stackoverflow.com/q/23831166
tags question: http://stackoverflow.com/q/23869735
tags question: http://stackoverflow.com/q/23903873
tags question: http://stackoverflow.com/q/23921149
tags question: http://stackoverflow.com/q/23927510
tags question: http://stackoverflow.com/q/23888764
tags question: http://stackoverflow.com/q/23913197
tags question: http://stackoverflow.com/q/23822046
tags question: http://stackoverflow.com/q/23786319
tags question: http://stackoverflow.com/q/23828893
tags question: http://stackoverflow.com/q/23871161
tags question: http://stackoverflow.com/q/23804123
tags question: http://stackoverflow.com/q/23912120
tags question: http://stackoverflow.com/q/23935976
tags question: http://stackoverflow.com/q/23930585
tags question: http://stackoverflow.com/q/23890306
tags question: http://stackoverflow.com/q/23930440
tags question: http://stackoverflow.com/q/23849234
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/23885014
tags question: http://stackoverflow.com/q/23835506
tags question: http://stackoverflow.com/q/23833029
tags question: http://stackoverflow.com/q/23788738
tags question: http://stackoverflow.com/q/23832786
tags question: http://stackoverflow.com/q/23863425
tags question: http://stackoverflow.com/q/23818909
tags question: http://stackoverflow.com/q/23784876
tags question: http://stackoverflow.com/q/23800792
tags question: http://stackoverflow.com/q/23799986
type: Tag
tags question: http://stackoverflow.com/q/23834258
tags question: http://stackoverflow.com/q/23831875
tags question: http://stackoverflow.com/q/23856765

http://stackoverflow.com/a/23923606
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23922276
type: Answer
answers question: http://stackoverflow.com/q/23922276
downvote count: 0
score: 1
has body: You're basic problem is, you're adding a new JTabbedPane to your existing JTabbedPane. Instead of your NewTab returning a new JTabbedPane, you should have it return the component that is to act as the view for the tab and the tabs name, for example... public class NewTab { private String tabName = "New Tab"; // Creates a new tabbed pane with a text area protected JComponent createTab() { JTextArea ta = new JTextArea(10, 20); JScrollPane sp = new JScrollPane(ta); return ta; } public String getTabName() { // Could be used to hold the file name, for example return tabName; } } Then you would use this to add the view to an existing JTabbedPane

http://stackoverflow.com/q/23837535
has comment: http://stackoverflow.com/comment/36680453
has comment: http://stackoverflow.com/comment/36680197
type: Question
tagged with: do-while
answer count: 2
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/36680488
has answer: http://stackoverflow.com/a/23837974
has answer: http://stackoverflow.com/a/23839268
has body: I'm fairly new at this programming, so please do bear with me. In teaching myself I'm attempting to write a Batteleships game; not OO at the moment, but rather procedural - little steps at a time. I have a method to read the coordinates to fire at, these coordinates I want to then validate to make sure that, well, they're valid. There is one method that checks that they are numbers and within the correct range, the other method is 'supposed' to check through what has already been entered. The issue I'm finding is that I'm not breaking out of the do while loop to progress, the while bit is using logical OR on the two aforementioned methods. In writing these methods, they both do what they're supposed to do, well I'm not entirely sure about the method that checks whether a coordinate has already been fired at. Some pointers would be really appreciated (on any aspect of it), thanks! Code: public static String inputCoords(List&lt;String&gt; coordsFired){ Scanner sc = new Scanner(System.in); //Console c = System.console(); String coordsEntered; do { System.out.println("in do\\while"); System.out.println("Enter coordinates as 'x, y': "); coordsEntered = sc.nextLine(); System.out.println("end of do\\while loop"); } while(!validateCoords(coordsEntered) || !coordsFiredAt(coordsEntered, coordsFired)); coordsFired.add(coordsEntered); System.out.println("contents of List&lt;String&gt; coordsFired" + coordsFired); return coordsEntered; } public static boolean validateCoords(String coordsEntered){ boolean results; int x, y; String strx = splitCoordsString(coordsEntered, 'x'); String stry = splitCoordsString(coordsEntered, 'y'); if (numericCheckCoordsFire(strx) &amp;&amp; numericCheckCoordsFire(stry)) { x = Integer.parseInt(strx); y = Integer.parseInt(stry); if (x &gt; 25 || y &gt; 25) { results = false; System.out.println("The dimensions of the board are 25 x 25, 'x,y' entered must be less than this. You entered '" + strx + "' for x and '" + stry + "' for y."); } else { results =…
has comment: http://stackoverflow.com/comment/36680324
has title: Java - using logical OR in do while
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/36679810
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36680112
has comment: http://stackoverflow.com/comment/36679576

http://stackoverflow.com/a/23785252
type: Answer
has comment: http://stackoverflow.com/comment/36580928
has comment: http://stackoverflow.com/comment/36583271
has comment: http://stackoverflow.com/comment/36582658
has comment: http://stackoverflow.com/comment/36582906
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36580363
has comment: http://stackoverflow.com/comment/36580664
accepted answer of: http://stackoverflow.com/q/23785030
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23785030
has body: First, please don't use the System console for your logging. Second, add a call to flush(). Finally, make sure you add the same cast you used before (or just save it to a variable). int payload = (int) ls.get(i).data; bw.write(payload); System.out.println("Written out " + payload); // Or, // System.out.println("Written out " + ((int) ls.get(i).data)); System.out.flush();
has comment: http://stackoverflow.com/comment/36580478

http://stackoverflow.com/comment/36585368
score: 0
has text: I've got the same error. But when I deleted the part of code which was giving the error , I got same error in the above for loop(in which string is split)
type: Comment
comment on: http://stackoverflow.com/a/23783612
type: AnswerComment

http://stackoverflow.com/a/23875209
has comment: http://stackoverflow.com/comment/36776543
has comment: http://stackoverflow.com/comment/36809513
type: Answer
has body: I suspect you don't have a memory leak. Instead you have having premature promotion of large objects. If you are creating large objects, e.g. byte[], these go straight in the tenured space. These are only cleaned up on a major or full collections. Most likely you are only triggering minor collections do the large objects are not being freed until a full collection is triggered.
has comment: http://stackoverflow.com/comment/36752852
answers question: http://stackoverflow.com/q/23875078
has comment: http://stackoverflow.com/comment/36756046
has comment: http://stackoverflow.com/comment/36755352
score: 0
has comment: http://stackoverflow.com/comment/36927213
has comment: http://stackoverflow.com/comment/36803551
has comment: http://stackoverflow.com/comment/36796263
has comment: http://stackoverflow.com/comment/36919084

http://stackoverflow.com/comment/36604004
has text: Please Can you give me sample code of miking result set it is really helpful to me
comment on: http://stackoverflow.com/a/23780725
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23901369
has comment: http://stackoverflow.com/comment/36809597
downvote count: 0
linked to: http://stackoverflow.com/q/21882804
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23919069
duplicate of: http://stackoverflow.com/q/21882804
favorite count: 0
tagged with: android-studio
has body: I was using this library - https://github.com/shamanland/fonticon - as a dependency of an application that I'm developing on Android Studio 0.5.8. I found out that custom maven repo is no longer reachable, so I decided to compile it to aar, and put it in my android project as a local library. I simply ran 'gradle assembleRelease' on this project, then copied the build/libs/libs.aar file to my project in libs directory. As explained in this blog entry - http://geekgarage.labasland.net/local-aar-android-library/ - I added the reference to the file, so build.gradle file looks like the following. dependencies { compile files('libs/volley.jar') compile files('libs/libGoogleAnalyticsServices.jar') compile files('libs/fonticon.aar') compile 'com.android.support:support-v4:19.1.0+' compile 'com.astuetz:pagerslidingtabstrip:1.0.1' compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+' compile 'com.android.support:appcompat-v7:19.+' } I'm still getting errors as if the library isn't there. What is strange to me is that even if I deliberately mis-reference that file (e.g. changing the file name to fonticon.jar) gradle does not complain at all. So I'm wondering if that file is being used at all. There is no feedback from gradle that this file is successfully loaded or not. Is there anything I'm missing? How can I ensure that aar file is referenced and loaded successfully?
type: UnansweredQuestion
upvote count: 1
tagged with: maven
has title: AAR library doesn't seem to be working in Android Studio 0.5.8. What am I doing wrong?
score: 1
has comment: http://stackoverflow.com/comment/36835394
tagged with: java
has comment: http://stackoverflow.com/comment/36835205
has comment: http://stackoverflow.com/comment/36834466
tagged with: gradle
type: Question

http://stackoverflow.com/comment/36765397
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23882518
has text: Is there a locale for that language?
type: Comment

http://stackoverflow.com/a/24788508
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23872807
upvote count: 2
answers question: http://stackoverflow.com/q/23872807
has body: Your life would be much easier if you use Windows version of Weka with GUI. In cluster tab there is a button for ignoring attributes like ID. And for Id to cluster assignments; after your are done with clustering algorithm you chose, right click the result on left of the screen, then visualize results and then save.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23935534
tagged with: java
tagged with: annotations
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36888818
has comment: http://stackoverflow.com/comment/36865834
answer count: 0
has title: Spring Rest @Controller works well with unobfuscated.jar but with obfuscated.jar returns 404 error
has comment: http://stackoverflow.com/comment/36899343
has body: I have written REST services using Spring-MVC's controller. To define controllers I have used annotations. All works well with unobfuscated jars. But with obfuscated jars it gives 404 in response. I searched over net for any issue with obfuscation using RetroGuard and found that I need to preserve annotations after obfuscations. So I tried that too by setting ".option Annotation" but still it is not working. Here is code @Controller public class ModelEntitiesController extends CommonExceptionHandler { private static final long serialVersionUID = -3097468664312037527L; @SuppressWarnings("unchecked") @RequestMapping(value = "/Connections", method = RequestMethod.GET) @ResponseBody public ArrayList&lt;ConnectionBean&gt; getConnectionList() throws Exception { // creates an arraylist return list; } }
type: Question
has comment: http://stackoverflow.com/comment/36878827
tagged with: spring
has comment: http://stackoverflow.com/comment/36867205
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/36871349
tagged with: spring-mvc
score: 0

http://stackoverflow.com/comment/36764697
type: Comment
comment on: http://stackoverflow.com/a/23867415
has text: How to configure in eclipse ?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23889921
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23889811
upvote count: 1
has body: for constructor no param you should have two constructors like public class Student { Student(String name , int dateOfBirth) { super(name,dateOfBirth) } Student() { //task. } } also same for other class
score: 1

http://stackoverflow.com/q/23904359
tagged with: clojure
score: 2
downvote count: 0
has title: How to replace a SeeSaw widget with a dynamically created one in Clojure?
tagged with: java
tagged with: swing
type: Question
has body: I'm new to Clojure, Java and functional programming. I started working with SeeSaw for GUI and loving it. Using an example from Dave Ray i create a widget: (defrecord Col-definition [id col-name col-position]) with associated functions to create comboboxes, labels and textboxes, by most notably using extend-type: (extend-type Col-definition MakeWidget (make-widget* [col-definition] (mig-panel :constraints ["", "[][grow]"] :border [(line-border :thickness 1) 2] :items [["Column Name" "gap 10"] ;;[(col-name-field (:id col-definition) col-definition :col-name) "growx, wrap"] [(:col-name col-definition) "growx, wrap"] ["Ordinal Position" "gap 10"] [(col-name-field (:id col-definition) col-definition :col-position) "growx"]]))) The widgets get built via instances of the defrecord, tied to a screen area as so: (def second-combocoll '("Col0" "Col1" "Col2")) (def second-bottom (vertical-panel :items (vec (col-defs second-combocoll)))) (def areabottom second-bottom) where areabottom is a split area of real estate. It all works great. But I want to read in from a database and dynamically replace the widget with a new collection of comboboxes. I can't seem to remove the widget, (remove! areabottom second-combocol) or (replace! areabottom new-combocol) or any other clever ideas all have come up naught. So here's the question: How do I replace or remove a custom widget, after a triggered event (such as clicking on a file path to load)?
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23975591
tagged with: seesaw
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31128168

http://stackoverflow.com/comment/36595443
has text: @JmRag, you can run multiple threads from the SwingWorker.
comment on: http://stackoverflow.com/q/23793077
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36676174
score: 0
has text: What does "and I read the filter and the bean are in different contexts" mean? Can you provide more details about your app configuration?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23831870

http://stackoverflow.com/comment/36883676
has text: Did you add `cards` to anything?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23902467
type: Comment

http://stackoverflow.com/a/23843613
has body: try this protected Void doInBackground(Void... params) { // TODO Auto-generated method stub //Create the HTTP Post HttpParams httpParameters = new BasicHttpParams(); //Setup timeouts -- for later HttpClient httpclient = new DefaultHttpClient(httpParameters); HttpPost httppost = new HttpPost(webphp); try{ MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart"id",id); entity.addPart("time",time); httppost.setEntity(entity); httpclient.execute(httppost); } catch (Exception e){ e.printStackTrace(); } return null; }
has comment: http://stackoverflow.com/comment/36695781
type: Answer
answers question: http://stackoverflow.com/q/23843552
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/36649857
score: 0
comment on: http://stackoverflow.com/q/23821813
has text: @IwishIcouldthinkofagood its possible to reduce it because code is much big i can not devide it.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/42134289
score: 0
answers question: http://stackoverflow.com/q/23822033
has body: The buffer will not be copied when it's written to outbound channels. As far as I know the 'write' will invoke HeapByteBuffer.duplicate, which is a shallow copy.
type: Answer

http://stackoverflow.com/a/23810620
has comment: http://stackoverflow.com/comment/36628820
upvote count: 1
has comment: http://stackoverflow.com/comment/36628183
has comment: http://stackoverflow.com/comment/36629595
downvote count: 0
answers question: http://stackoverflow.com/q/23810166
has comment: http://stackoverflow.com/comment/36629300
type: Answer
has comment: http://stackoverflow.com/comment/36650757
has body: I would suggest the following steps: Extend BasicDataSourceFactory to produce customized BasicDataSources. Those customized BasicDataSources would already know which catalog is active and have the defaultCatalog property set accordingly. Use your extended BasicDataSourceFactory in the Tomcat configuration.
score: 1

http://stackoverflow.com/comment/37256534
comment on: http://stackoverflow.com/q/23923304
score: 0
type: Comment
type: QuestionComment
has text: @morgano discussing here http://meta.stackoverflow.com/q/260058/1339987 my rec is post a simple duplicate answer linking, I'll award you then try to close the question as a duplicate.

http://stackoverflow.com/q/23831811
has answer: http://stackoverflow.com/a/23832163
has comment: http://stackoverflow.com/comment/36678160
favorite count: 0
has body: I am the maintainer of a Java library (ta4j, which provides functions for technical analysis). On my repository, the different modules are mavenized and I am trying to release one of them. Maven architecture The Maven architecture of this project is: ta4j-parent |__ ta4j |__ ta4j-examples ta4j-parent I added this pom.xml only to share some properties (licenses, issueManagement, etc.) between ta4j and ta4j-examples, and for future dependencyManagement. I don't want to release this artifact (as it's useless for the users of my library). ta4j This pom.xml has ta4j-parent as its parent. It contains what is necessary to release the ta4j artifact, which is the only useful (It is the only source module of the library itself) module for my library. ta4j-examples This artifact contains standalone main classes which shows examples of usage of ta4j. I don't want to release it. For now this pom.xml only contains the dependencies of the examples. Release As I want to release only the ta4j module, I went to the ./ta4j/ta4j subdirectory and ran the following command: mvn release:prepare -Darguments=-Dgpg.passphrase="&lt;my key secret&gt;" ...which returned: [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building ta4j [INFO] task-segment: [release:prepare] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [release:prepare {execution: default-cli}] [INFO] Verifying that there are no local modifications... [INFO] ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag [INFO] Executing: /bin/sh -c cd /home/user/workspace/ta4j/ta4j &amp;&amp; git status [INFO] Working directory: /home/user/workspace/ta4j/ta4j [INFO] Checking dependencies and plugins for snapshots ... There are still some remaining snapshot dependencies. : Do you want to resolve them now? (yes/no) no: : no [INFO…
tagged with: snapshot
possible better answer: http://stackoverflow.com/a/23832163
tagged with: maven
has comment: http://stackoverflow.com/comment/36694788
has comment: http://stackoverflow.com/comment/128681182
linked to: http://stackoverflow.com/q/58521838
tagged with: maven-release-plugin
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23999386
tagged with: java
has comment: http://stackoverflow.com/comment/36670346
score: 9
type: Question
upvote count: 9
has title: How to release a Maven submodule without releasing the parent POM?
answer count: 2
has answer: http://stackoverflow.com/a/23999386
tagged with: release
downvote count: 0

http://stackoverflow.com/q/23849146
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36702210
has answer: http://stackoverflow.com/a/23849305
tagged with: arrays
tagged with: bufferedreader
downvote count: 4
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36702546
score: -3
has title: Read Text file to java object array
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19023906
accepted answer: http://stackoverflow.com/a/23849305
has body: I want a method or an example to read data from text file and store them into array of object. Each object has attributes (month name, number and boolean array[3]). The text file contains this information(Month's name, number and boolean array) line by line: May 211345 true false true June 8868767 false true false The classes: public class A{ private String monthName; private int number; private boolean[] working; public data() { ... } } publlic class B { private A[] a; }

http://stackoverflow.com/a/23860893
has comment: http://stackoverflow.com/comment/36725206
type: Answer
answers question: http://stackoverflow.com/q/23860586
has body: Uninstall the app Remove the the app in Facebook Try again
score: 0

http://stackoverflow.com/q/23827208
has body: I have two array say .. String[] a = { "dog", "cat", "turtle" }; String[] b = { "doog", "caat", "tuurtle" }; And I traverse like for (String s: a) { Sop(s). } like wise again we need to traverse the second Array. But my Qsn is using one enhanced for loop (for each loop) can I traverse or do some operation using two of the arrays. Your help would be appreciated..
score: 0
has comment: http://stackoverflow.com/comment/36659614
has comment: http://stackoverflow.com/comment/36659651
has answer: http://stackoverflow.com/a/23827699
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23827514
has answer: http://stackoverflow.com/a/23827295
has answer: http://stackoverflow.com/a/23827492
tagged with: java
has comment: http://stackoverflow.com/comment/36659644
has title: Can two array be traversed through one for-each loop?
type: Question
has comment: http://stackoverflow.com/comment/36659684
has comment: http://stackoverflow.com/comment/36659628
has answer: http://stackoverflow.com/a/23828302
tagged with: for-loop
tagged with: arrays

http://stackoverflow.com/a/23852535
has comment: http://stackoverflow.com/comment/36708773
has comment: http://stackoverflow.com/comment/36708835
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23852516
has comment: http://stackoverflow.com/comment/36708677
has comment: http://stackoverflow.com/comment/36708715
has body: Change while (x &lt; myBooks.length) { x = x + 1; System.out.print(myBooks[x].title); System.out.print(" by "); System.out.println(myBooks[x].author); } to while (x &lt; myBooks.length) { System.out.print(myBooks[x].title); System.out.print(" by "); System.out.println(myBooks[x].author); x = x + 1; } Consider case when x=2 at srat of the loop. It becomes 3 first and then books[3] will throw Exception. Other than that you have simply defined an array which is nothing but just references. You need to initialize all of them. for(Books book : myBooks ) { book = new Books(); } If you are not initializing the array they are just pointing to null and if you perform any operations on it like myBooks[i].title you will get NPE.
type: Answer

http://stackoverflow.com/a/23835487
type: Answer
downvote count: 0
score: 1
has body: I support khale's and Frakcool's reply. In addition to that if you just need another case to get false try System.out.println(a.equals((a = new A()))); The assignment essentially returns what is being assigned and that will equate to false if its not the calling object itself.
answers question: http://stackoverflow.com/q/23835182
upvote count: 1

http://stackoverflow.com/a/23891605
answers question: http://stackoverflow.com/q/23883050
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23883050
downvote count: 0
has comment: http://stackoverflow.com/comment/36789167
type: Answer
upvote count: 2
has body: Previously I had attempted to create a new instance of the Document class (each referencing the same Undo listener) and was going to use JTextArea.setDocument() instead of JTextArea.setText(). However, Document is an interface and can't be instantiated, but after reading the reference that mKorbel posted, I tried this using the PlainDocument class instead, which worked. I have decided to maintain a HashMap&lt;String, Document&gt; to contain my Document classes and switch between them. When I switch the Document, I don't see the Undo/Redo issue - I suppose as I am no longer breaking the Document. Updated SSCCE below which now uses JTextArea.setDocument() instead of JTextArea.setText(). This also has the advantage of not requiring the ignoreEdit boolean as setDocument() doesn't trigger an UndoableEditEvent, whereas setText() does. Each Document then references the local classes UndoableEditListener. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.undo.*; public class SSCCE extends JFrame implements ActionListener, UndoableEditListener { private final JLabel labTextArea; private final JTextArea textArea; private final JScrollPane scrollTextArea; private final Document docTextArea; private final JButton bOne, bTwo, bUndo; private final UndoManager uOne, uTwo; private Document dOne, dTwo; public SSCCE(String[] args) { setTitle("SSCCE - Short, Self Contained, Correct Example"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300, 200); setLocationRelativeTo(null); labTextArea = new JLabel("One"); getContentPane().add(labTextArea, BorderLayout.PAGE_START); uOne = new UndoManager(); uTwo = new UndoManager(); dOne = new PlainDocument(); dTwo = new PlainDocument(); dOne.addUndoableEditListener(this); dTwo.addUndoableEditListener(this); textArea = new JTextArea(); docTextArea = textArea.getDocument(); docTextArea.addUndoableEditListener(this); textArea.setDocument(dOne); scrollTextArea…
has comment: http://stackoverflow.com/comment/36789404
has comment: http://stackoverflow.com/comment/36788540

http://stackoverflow.com/comment/37674965
type: Comment
has text: How will I do the refactoring ?
comment on: http://stackoverflow.com/a/24333586
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36719780
score: 1
comment on: http://stackoverflow.com/q/23858203
has text: See http://stackoverflow.com/questions/23653778/nullpointerexception-accessing-views-in-oncreate
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36706116
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23850794
has text: Just tried 3072 and got Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
score: 0

http://stackoverflow.com/q/23810608
has answer: http://stackoverflow.com/a/23810980
tagged with: swing
has title: Why is my JPanel not showing on a JFrame?
has body: I have made a calculator by referencing to another's source code, but as I try to compile the file, the frame will display, leaving the panel and simply showing nothing but a blank frame. I use a basic frame.add(new Calculator()); for the methods within the file. Here is the code: import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Calculator2 extends JFrame { public static void main(String[]args) { JFrame frame = new JFrame("Test Calculator"); Windows c = new Windows(); c.setVisible(true); frame.add(c); frame.setSize(500, 500); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } class Windows extends JPanel { static boolean[] function = new boolean[4]; static double[] temporary = {0, 0}; static JTextArea display = new JTextArea(1,20); public static JPanel Windows() { JPanel panel = new JPanel(); panel.setSize(200, 300); GridLayout grid = new GridLayout(5, 5); panel.setLayout(grid); JPanel[] row = new JPanel[5]; JButton[] buttons = new JButton[19]; String[] buttonString = {"7","8","9","+", "4", "5", "6", "-", "1", "2", "3", "*", ".", "/", "C", "v", "+/-", "=", "0"}; int[] dimW = {300, 45, 100, 90}; int[] dimH = {35, 40}; Dimension dispDim = new Dimension(dimW[0], dimH[0]); Dimension regDim = new Dimension(dimW[1], dimH[1]); Dimension rColDim = new Dimension(dimW[2], dimH[1]); Dimension zeroButDim = new Dimension(dimW[3], dimH[1]); Font font = new Font("Times new Roman", Font.BOLD, 14); for(int i = 0; i &lt; 4; i++) function[i] = false; FlowLayout f1 = new FlowLayout(FlowLayout.CENTER); FlowLayout f2 = new FlowLayout(FlowLayout.CENTER, 1, 1); for(int x = 0; x &lt; 5; x++) row[x] = new JPanel(); row[0].setLayout(f1); for(int x = 0; x &lt; 5; x++) row[x].setLayout(f2); for(int i = 0; i &lt; 19; i++) { buttons[i] = new JButton(); buttons[i].setText(buttonString[i]); buttons[i].setFont(font); buttons[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent b) { if(b.getSource() == buttons…
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/23810810
has answer: http://stackoverflow.com/a/23810810
score: 2
accepted answer: http://stackoverflow.com/a/23810980
downvote count: 0
tagged with: jpanel
has answer: http://stackoverflow.com/a/23811086
type: AnsweredQuestion
favorite count: 0
type: Question
upvote count: 2
tagged with: jframe

http://stackoverflow.com/a/71330219
has body: On MacOS a version of @adriaan-koster's answer works. In your ~/.zshrc (or .bashrc or .bash_profile) config file add this line: export MAVEN_OPTS="-Xmx2G" To test, run mvn -v again and verify that it prints the Maven version, Maven home location, and Java version.
answers question: http://stackoverflow.com/q/23787943
type: Answer
score: 0

http://stackoverflow.com/q/23780963
tagged with: java
has comment: http://stackoverflow.com/comment/36573397
tagged with: swing
has comment: http://stackoverflow.com/comment/36574155
has answer: http://stackoverflow.com/a/23805723
type: Question
has comment: http://stackoverflow.com/comment/36574757
has comment: http://stackoverflow.com/comment/36573279
has answer: http://stackoverflow.com/a/23783688
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/36575452
downvote count: 0
favorite count: 0
has body: In my swing application I want to echo jpassword field character for some time (1 second) and then again hide it. I want to do it character by character after user inputs a character (When user inputs a character, show it, then hide it. Then for all input characters repeat this). Can someone tell me is it possible, if yes how? Thanks in advance!
type: UnansweredQuestion
has title: Echo jpassword character once and then hide it
linked to: http://stackoverflow.com/q/5339702
has comment: http://stackoverflow.com/comment/36577337
has comment: http://stackoverflow.com/comment/36573176
score: 2
has comment: http://stackoverflow.com/comment/36615549
has comment: http://stackoverflow.com/comment/36588944
tagged with: jpasswordfield

http://stackoverflow.com/comment/36831811
has text: Technically, `Set` is an interface that `HashSet` implements.
comment on: http://stackoverflow.com/a/23917311
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23806801
tagged with: web-services
has body: Problem : I am facing difficulty in updating a service group in WSO2 Application server. Environment details : WSO2 Application Server 5.2.1 Using Eclipse to create Java Classes Using option "Services -> JarService" to create service in WSO2 Scenario : I create web services using the option "Services -> jarservice" in WSO2 from a Jar which had multiple classes implemented (lets say 6 methods in 6 classes). I was given an option to create a Service Group Name while doing this procedure. I have given a service group name (lets say Utilities). I was able to find all the services getting created under this group which is what I expected. But here comes the problem. I wanted to create another service under the same service group (which is usual in any practical scenario). I am unable to do so. Any pointers on this? Tried hard to find pointers on this but I was unsuccessful. Any help would be appreciated.
type: Question
tagged with: wso2
has title: Update Service Group in WSO2 Application Server
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23828298
tagged with: java

http://stackoverflow.com/q/23782547
has body: I have constant values supplied from properties files MyConstants.java public interface MyConstants extends ConstantsWithLookup { public String text(); } MyConstants.properties text=Hello! To get the text I do the following private MyConstants constants = GWT.create(MyConstants.class); Button button=new Button(constants.text()); I'd like to know how to create button with text provided from properties files using UiBinder <?xml version="1.0" encoding="UTF-8"?> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"> <g:HTMLPanel> <g:Button>Hello!</g:Button> </g:HTMLPanel> </ui:UiBinder> And also I have fieldset tag, how to add text to its legend <g:HTMLPanel> Hello! </g:HTMLPanel>
score: 0
answer count: 1
has title: Constant values supplied from properties files in UiBinder GWT
has answer: http://stackoverflow.com/a/23783320
accepted answer: http://stackoverflow.com/a/23783320
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: uibinder

http://stackoverflow.com/q/23798971
has body: Hi i have a table in which i am not using Hibernate ID generator but instead using a method to generate a random number(this will never be same as per logic). Is this a bad approach? I have a method which first loads this table entity using select query and then updates some columns in the entity object returned and saves it. This is happening in the same session the load and update. In this case sometimes i get an exception:- 2014-05-20 11:31:16,341 | ERROR | [http-10181-3] |org.hibernate.util.JDBCExceptionReporter:logExceptions(101) | Lock wait timeout exceeded; try restarting transaction 2014-05-20 11:31:16,344 | ERROR | [http-10181-3] |org.hibernate.event.def.AbstractFlushingEventListener:performExecutions(324) | Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028) This comes when this method is called a lot of times. i.e my application is being used by multiple users. Any pointers on this? Is the approach being used my me for manually assiging ID incorrect? Or this has nothing to do with it? Similarly in some cases i am also querying the table to get the next ID: like select max(id) and then set the id for the next row? Is this also a …
downvote count: 0
has comment: http://stackoverflow.com/comment/36606687
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36606646
has title: Hibernate: Disadvantages of not having id generator?
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/36607582
tagged with: mysql
has comment: http://stackoverflow.com/comment/36607076
type: Question
accepted answer: http://stackoverflow.com/a/23799873
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/36606812
has comment: http://stackoverflow.com/comment/36606597
linked to: http://stackoverflow.com/q/6000336
has comment: http://stackoverflow.com/comment/36624993
has answer: http://stackoverflow.com/a/23799873
has comment: http://stackoverflow.com/comment/36607599
upvote count: 1
favorite count: 0

jframe
tags question: http://stackoverflow.com/q/23937050
tags question: http://stackoverflow.com/q/23856691
tags question: http://stackoverflow.com/q/23810608
tags question: http://stackoverflow.com/q/23924553
tags question: http://stackoverflow.com/q/23903749
tags question: http://stackoverflow.com/q/23827474
tags question: http://stackoverflow.com/q/23830815
tag name: jframe
tags question: http://stackoverflow.com/q/23855974
tags question: http://stackoverflow.com/q/23815472
tags question: http://stackoverflow.com/q/23791394
tags question: http://stackoverflow.com/q/23921254
tags question: http://stackoverflow.com/q/23819196
tags question: http://stackoverflow.com/q/23922959
tags question: http://stackoverflow.com/q/23852569
tags question: http://stackoverflow.com/q/23830587
tags question: http://stackoverflow.com/q/23839921
tags question: http://stackoverflow.com/q/23877549
tags question: http://stackoverflow.com/q/23929249
tags question: http://stackoverflow.com/q/23893082
tags question: http://stackoverflow.com/q/23854920
tags question: http://stackoverflow.com/q/23835438
tags question: http://stackoverflow.com/q/23788776
tags question: http://stackoverflow.com/q/23838543
tags question: http://stackoverflow.com/q/23821529
tags question: http://stackoverflow.com/q/23902449
tags question: http://stackoverflow.com/q/23895283
tags question: http://stackoverflow.com/q/23874314
tags question: http://stackoverflow.com/q/23792441
tags question: http://stackoverflow.com/q/23879214
tags question: http://stackoverflow.com/q/23939775
tags question: http://stackoverflow.com/q/23893623
tags question: http://stackoverflow.com/q/23787494
tags question: http://stackoverflow.com/q/23868229
tags question: http://stackoverflow.com/q/23894811
tags question: http://stackoverflow.com/q/23810778
tags question: http://stackoverflow.com/q/23851354
tags question: http://stackoverflow.com/q/23861049
tags question: http://stackoverflow.com/q/23818526
tags question: http://stackoverflow.com/q/23849008
tags question: http://stackoverflow.com/q/23924279
type: Tag
tags question: http://stackoverflow.com/q/23892576
tags question: http://stackoverflow.com/q/23838828
tags question: http://stackoverflow.com/q/23850934
tags question: http://stackoverflow.com/q/23901889
tags question: http://stackoverflow.com/q/23847118
tags question: http://stackoverflow.com/q/23848372
tags question: http://stackoverflow.com/q/23871508
tags question: http://stackoverflow.com/q/23921244
tags question: http://stackoverflow.com/q/23923592

http://stackoverflow.com/comment/36741975
has text: This is more work than necessary. You don't have to sort the whole array to find the min/max element.
type: Comment
comment on: http://stackoverflow.com/a/23870172
score: 2
type: AnswerComment

http://stackoverflow.com/comment/36740761
has text: you mean `".\\File.txt"`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23869597
type: Comment

get
tags question: http://stackoverflow.com/q/23783882
tags question: http://stackoverflow.com/q/23865976
type: Tag
tag name: get
tags question: http://stackoverflow.com/q/23816746

http://stackoverflow.com/comment/36780649
type: Comment
has text: @AleksandrM I renamed that folder but then Eclipse says the project does not exist. If I import again, it creates another folder in `.projects` directory with the shortened name.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23888000

http://stackoverflow.com/a/23868969
has comment: http://stackoverflow.com/comment/48082368
has comment: http://stackoverflow.com/comment/52094699
has comment: http://stackoverflow.com/comment/97252398
downvote count: 3
has comment: http://stackoverflow.com/comment/109892849
accepted answer of: http://stackoverflow.com/q/23868733
has comment: http://stackoverflow.com/comment/60310009
answers question: http://stackoverflow.com/q/23868733
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36740434
has comment: http://stackoverflow.com/comment/60309935
score: 137
has comment: http://stackoverflow.com/comment/48086911
type: Answer
has body: If I understand correctly you want a functional interface with a method void m(). In which case you can simply use a Runnable.
upvote count: 140
has comment: http://stackoverflow.com/comment/134993780

http://stackoverflow.com/a/25288017
has body: Replace your old jars with new one's based on the spring-framework-bom.LATEST.VERSION.pom file. That way, i had resolved my issue.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23789271
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/36844131
has text: as requested, please edit the question to explain that.
comment on: http://stackoverflow.com/q/23877003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23916429
has comment: http://stackoverflow.com/comment/37112170
score: 0
tagged with: izpack
answer count: 1
has body: I have a simple installer using no custom panels and one pack to install. The pack has two fileset elements and each file set element is restricted by the <os> element. <description/> <os arch="x86_64"/> <os arch="x86"/> My installer builds and runs successfully, but when it's done, it has ignored my <os> restriction, and placed all the files from the x86_64 folder as well as the x86 folder into my $INSTALL_PATH. I'm running on a 64 bit Windows 7 machine. Can anyone tell me if I'm doing something wrong, or could this possibly be a bug in izpack? OBTW... as a test, I changed the restriction to this... <os arch="sparc"/> ... and it successfully did not install the files when I ran my installer on my Windows 7, 64 bit machine. I'm not sure if that proves that this is some sort of izpack bug or not, but I thought it would be useful information.
has title: How do I get izpack installer to correctly restrict a fileset based on OS architecture
has comment: http://stackoverflow.com/comment/37112284
type: AnsweredQuestion
tagged with: installation
has answer: http://stackoverflow.com/a/24056288
accepted answer: http://stackoverflow.com/a/24056288
type: Question
tagged with: java

http://stackoverflow.com/a/24027072
has body: Ok I solved it. Apparently in the simple function createTarget() where i gave the target grid random true/false values for each square. (Square.on = true) I had this line target.grid[pos_x + x][pos_y + y] = templates[selectedTemplate].grid[x][y]; // It should have been this target.grid[pos_x + x][pos_y + y].on = templates[selectedTemplate].grid[x][y].on; The reason it worked some of the time was because the squares themselves were copied. This seems to have caused reference issues. By referring directly to the boolean variable the objects don't get linked in any way. Big shout out to @Uwais A He helped me eliminate all other possible causes, so ,eventually, I had to look in the least likely parts of my code.
has comment: http://stackoverflow.com/comment/37037708
has comment: http://stackoverflow.com/comment/37038673
answers question: http://stackoverflow.com/q/23921020
has comment: http://stackoverflow.com/comment/37037898
has comment: http://stackoverflow.com/comment/37037993
accepted answer of: http://stackoverflow.com/q/23921020
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/36738241
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23867635
type: AnswerComment
has text: Btw i just notice that; if i press onLongClick and after that press also save button click then function is not called twice which is ok. but if i dont use longClick one and directly use only save button then function is not called at all? why this issue? thx

http://stackoverflow.com/a/23872528
has comment: http://stackoverflow.com/comment/36748617
score: 0
has body: Well you can definitely read the csv using open CSV and then sort it using Collections.sort methods. You will need to create your own comparator, but it is easily testable unitarily. The real trick is: how big is your csv? The method I described requires to store everything in memory, so if your csv is not too big it will work. It's a question of the size of the CSV files in bytes. if your csv is about 40k rows and 15 columns, and provided your data in every column is around 100 words long, it should represent 40*1000 rows *15 columns *100 (= I assume columns are around 100 characters each on average) bytes =~ 60MB in memory. Any modern computer/server will handle that easily. if you have very long strings in your columns, like 1000 character strings it should still work. Now if the size of the files to sort increases dramatically it won't work anymore. You should start worrying if the files to process exceeds 500MB.
answers question: http://stackoverflow.com/q/23872423
type: Answer

http://stackoverflow.com/q/23925315
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/35507206
has answer: http://stackoverflow.com/a/53025445
has answer: http://stackoverflow.com/a/23925631
has answer: http://stackoverflow.com/a/53632462
answer count: 6
has title: Count int occurrences with Java8
downvote count: 0
favorite count: 0
score: 61
has answer: http://stackoverflow.com/a/56974911
accepted answer: http://stackoverflow.com/a/23925631
upvote count: 61
tagged with: java-8
possible better answer: http://stackoverflow.com/a/56974911
has body: Is there a better way to count int occurrences with Java8 int[] monthCounter = new int[12]; persons.stream().forEach(person -&gt; monthCounter[person.getBirthday().getMonthValue() - 1]++);
has answer: http://stackoverflow.com/a/44667259

http://stackoverflow.com/comment/36680312
has text: Thanks.. I defined an new variable in the head: <[DEFINE name="dateFormat" value="reportData.createDateFormat('MMM d, yyyy', 'en')"/]> <[DEFINE name="yearFormat" value="reportData.createDateFormat('yyyy', 'en')"/]>
comment on: http://stackoverflow.com/a/23837823
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23937743
has comment: http://stackoverflow.com/comment/36869956
upvote count: 3
has comment: http://stackoverflow.com/comment/36870029
has comment: http://stackoverflow.com/comment/36870180
answer count: 3
downvote count: 7
has answer: http://stackoverflow.com/a/23937859
accepted answer: http://stackoverflow.com/a/23937859
possible better answer: http://stackoverflow.com/a/23937860
favorite count: 0
has answer: http://stackoverflow.com/a/23937860
has title: How can I conver this string into a java list?
has answer: http://stackoverflow.com/a/23937876
score: -4
has comment: http://stackoverflow.com/comment/36870232
linked to: http://stackoverflow.com/q/6026813
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/36870033
tagged with: guava
tagged with: java
type: Question
has body: How can I convert this string into a java list (java.util.List) of three elements ? {Electronic,Pop,Rock} I already use Google Guava, so that would be a good solution but I cant see one

http://stackoverflow.com/q/23875206
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36752548
type: Question
score: 4
possible better answer: http://stackoverflow.com/a/42372352
has title: Hibernate JPA constraint violation and Transaction already active
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/23875709
has comment: http://stackoverflow.com/comment/36752172
favorite count: 0
accepted answer: http://stackoverflow.com/a/23875709
has comment: http://stackoverflow.com/comment/36752223
has body: I have a table with the field 'nom' with the unique constraint and when I test to insert a value of this field that already exists in the table the org.hibernate.exception.ConstraintViolationException is thrown. Then after all my persisting I get a Transaction already active Exception. this is my persisting method in a Dao class public void persist(E entity) throws Exception { EntityTransaction tr=entityManager.getTransaction() ; tr.begin(); entityManager.persist(entity); tr.commit(); } and here the code where I catch the exception try { rd.persist(r); } catch (Exception e) { e.printStackTrace(); } How Can I solve this Transaction problem ?
upvote count: 4
has answer: http://stackoverflow.com/a/42372352
has comment: http://stackoverflow.com/comment/36752710
has comment: http://stackoverflow.com/comment/36752139

http://stackoverflow.com/comment/44052189
comment on: http://stackoverflow.com/q/23938312
score: 0
type: QuestionComment
type: Comment
has text: i have this question too. did you find a way to do that??

http://stackoverflow.com/comment/36626964
type: QuestionComment
comment on: http://stackoverflow.com/q/23809849
score: 0
has text: Do you have an inner container and an outer container?
type: Comment

http://stackoverflow.com/comment/36816869
score: 0
type: Comment
has text: @noone 1/60 * 300 = 5f , i mean that the player.x value will be incremented by 5 in one frame if the FPS is 60
comment on: http://stackoverflow.com/a/23906953
type: AnswerComment

http://stackoverflow.com/a/23911735
answers question: http://stackoverflow.com/q/23911441
has comment: http://stackoverflow.com/comment/36827648
type: Answer
accepted answer of: http://stackoverflow.com/q/23911441
has body: First, note that the two approaches to API design are not mutually exclusive: one could have both a "get by index" and a "get by name", i.e. int y1 = cal.get(Calendar.YEAR); int y2 = cal.getYear(); The primary driving force behind getters controlled by an int constant in the Calendar class is uniformity: it lets users of the Calendar class, such as the date formatters, build code that accesses the calendar by index, without further interpretation. For example, if you wanted to implement a formatter that takes a format string and stores a data structure to pull data from a calendar, you would be able to do it with an array of integers: "dd-mm-yyyy" would become int[] {Calendar.DAY, Calendar.MONTH, Calendar.YEAR}, and you would be able to get the data from calendar with a simple for loop. Note that one of the reasons why Calendar uses integer constants instead of enums is backward compatibility: that Java did not have enum at the time when the Calendar class has been introduced. Also note that you do not need a switch statement on an enum or int constants to implement Calendar's getters and setters: they can be implemented as direct reads and writes of the calendar component array.
has comment: http://stackoverflow.com/comment/36826881
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23851609
tagged with: object
type: AnsweredQuestion
tagged with: linked-list
score: 1
tagged with: java
tagged with: queue
type: Question
has answer: http://stackoverflow.com/a/23851695
accepted answer: http://stackoverflow.com/a/23851695
answer count: 1
has title: Type mismatch: cannot convert from Object to Class object
has comment: http://stackoverflow.com/comment/36707112
upvote count: 1
has body: How should I enqueue an object given that this object has several parameters and I need these parameters. Eg:- BFS--> I need to enqueue and dequeue the current position but it gives me an error msg. To be more specific : /*Start = new Pos(i, j, 0);*/ public static int search(char[][] maze, Pos source) { MyQueue SP = new Queue(); // pushes source to Q SP.enqueue(source); // marks source as visited visited[source.xPos][source.yPos] = true; // enters main loop - checks if Q is nonempty while (!SP.isEmpty()) { // gets next element off of queue Pos current = SP.dequeue(); //&lt;&lt; Here is the error "Type mismatch: cannot convert from Object to Pos" // gets neighbors of current ArrayList&lt;Pos&gt; neighbors = getNeighbors(maze, current); for (Pos neighbor : neighbors) { // checks for exit if (maze[neighbor.xPos][neighbor.yPos] == 'E') { EX = neighbor.xPos; EY = neighbor.yPos; return neighbor.dist; } Q.enqueue(neighbor); } } // exit is not reachable return 0; } Where Pos as follwoing : public class Pos { public int xPos, yPos, dist; public Pos(int xPos, int yPos, int dist) { this.xPos = xPos; this.yPos = yPos; this.dist = dist; } } For more illustration of my queue implementation : public interface MyQueue { public void enqueue(Object item); public Object dequeue(); public boolean isEmpty(); public int size(); public Object peek(); } When I print dequeued elements , something like this appears "project.Pos@55f96302". Finally, how "in general" could add an object of a class to linked list?
favorite count: 0
has comment: http://stackoverflow.com/comment/36707132
downvote count: 0

http://stackoverflow.com/a/24000453
has comment: http://stackoverflow.com/comment/41859189
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23790192
has comment: http://stackoverflow.com/comment/36991169
answers question: http://stackoverflow.com/q/23790192
score: 2
type: AcceptedAnswer
downvote count: 0
has body: I was able to reproduce the problem. It is not Mac-related, but a subtle bug caused by a single space character in the UMLGraph source code. It is already fixed in Git master (development version). I found out by cloning and bisecting the UMLGraph repo against the previous release (tag R5_6_6). I did this by building the library with Maven and running each bisected build with your Ant project. Finally I found that commit @8d77597 fixes the problem. Bottom line: Just clone the repo from GitHub and build a snapshot version, then your problem should be gone. I am going to open an issue linking to this page here and asking for a bugfix release on behalf of you. Update: This is the ticket asking for a new bugfix release. Crossing my fingers for you...

http://stackoverflow.com/a/23811766
answers question: http://stackoverflow.com/q/23811583
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23811583
has body: Looks like your PHP file is returning invalid response. If you are writing a handler which returns JSON, it should return valid JSON response ANYWAY. Here is how it should be: $response = array(); $response["success"] = 0; $response["message"] = "No products found"; // include db connect class require_once __DIR__ . '/db_connect.php'; // connecting to db $db = new DB_CONNECT(); // get all products from products table $result = mysql_query("SELECT *FROM products"); // check for empty result if ($result &amp;&amp; mysql_num_rows($result) &gt; 0) { // looping through all results // products node $response["products"] = array(); while ($row = mysql_fetch_array($result)) { // temp user array $product = array(); $product["pid"] = $row["pid"]; $product["name"] = $row["name"]; $product["price"] = $row["price"]; $product["created_at"] = $row["created_at"]; $product["updated_at"] = $row["updated_at"]; // push single product into final response array array_push($response["products"], $product); } // success $response["success"] = 1; } // Echo JSON anyway! echo json_encode($response); die(); ?&gt;
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/36822690
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23912358
has text: a test should verify **expected behavior**. can you tell us, what the expected result is? otherwhise the chances are high that your question is closed as to broad.

http://stackoverflow.com/comment/36785843
type: Comment
type: QuestionComment
has text: the buttons i make are going on specific places, how can i make them go in other?
comment on: http://stackoverflow.com/q/23893006
score: 0

http://stackoverflow.com/comment/36850791
comment on: http://stackoverflow.com/a/23909551
type: Comment
has text: I am glad you figured it out. Probably you got an extra dom4j dependency from Eclipse.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36602033
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23796633
type: AnswerComment
has text: Throws `java.lang.StringIndexOutOfBoundsException` (and I'm pretty sure it needs quite a few changes to work) - please don't post untested code.

http://stackoverflow.com/comment/44796076
type: QuestionComment
comment on: http://stackoverflow.com/q/23823252
score: 0
has text: Did you get any solution for this ? I'm having the same with with AppEngine.
type: Comment

http://stackoverflow.com/q/23867299
has title: ClascastException in linking JavaConnector in kony
has comment: http://stackoverflow.com/comment/36915140
tagged with: java
has comment: http://stackoverflow.com/comment/36737164
type: Question
has answer: http://stackoverflow.com/a/26773244
has body: I have created a simple java service in kony app.When i try to run the Test with input parameter i got the following exception. java.lang.ClassCastException: com.kony.sample.KonyServerConnection cannot be cast to com.konylabs.middleware.common.JavaService at com.konylabs.middleware.connectors.JavaConnector.execute(JavaConnector.java:142) at com.pat.tool.keditor.editors.JavaServiceDefinitionEditorPage.getJavaResponse(JavaServiceDefinitionEditorPage.java:1878) at com.pat.tool.keditor.editors.JavaServiceDefinitionEditorPage$InvokeJavaOperation.run(JavaServiceDefinitionEditorPage.java:1842) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) i followed this Link for reference i have shared some of java code private static final String URL = "http://serverurl/sendEmail?"; public static String getServerPersponce(String entitiy,String mHeader){ String responseBody = ""; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(URL); System.out.println("Requesting : " + httppost.getURI()); try { StringEntity entity = new StringEntity(entitiy); if(mHeader != null &amp;&amp; !mHeader.equalsIgnoreCase("")) httppost.addHeader("AuthToken" , mHeader); httppost.setEntity(entity); httppost.setHeader("Accept", "application/json"); httppost.setHeader("Content-type", "application/json"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity1 = response.getEntity(); InputStream stream = entity1.getContent(); responseBody = getStringFromInputStream(stream); if (response.getStatusLine().getStatusCode() != 200) { // responseBody will have the error response } //responseBody = httpclient.execute(httppost, responseHandler); System.out.println("responseBody : " + responseBody); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { httpclient.getConnectionManager().shutdown(); } return re…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/57780898
tagged with: temenos-quantum
type: UnansweredQuestion

http://stackoverflow.com/q/23888012
type: Question
has title: Migrate from docx4j Version 2.X to 3.X
accepted answer: http://stackoverflow.com/a/23907366
tagged with: docx4j
answer count: 1
has body: I updated my docx4j from version 2.8 to version 3.1.0, but i have a probnlem with the type CustomXmlDataStoragePart and CustomXmlPart. The following codes are the original ones from my application with version 2.8.0: HashMap&lt;String, CustomXmlDataStoragePart&gt; customXmlDataStorageParts = wml.getCustomXmlDataStorageParts(); for (String string : customXmlDataStorageParts.keySet()) { CustomXmlDataStoragePart customXmlDataStoragePart = customXmlDataStorageParts.get(string); customXmlDataStoragePart.getData().setDocument(inputStream); } But since the version 3.0 they changed getCustomXmlDataStorageParts() from CustomXmlDataStoragePart to CustomXmlPart, but CustomXmlPart doesn't have getData() and i can not set document with my inputStream directly. How can I now let the CustomXmlPart to getXML from inputStream? Thank you!
has answer: http://stackoverflow.com/a/23907366
type: AnsweredQuestion
score: 0
tagged with: java

clr
type: Tag
tags question: http://stackoverflow.com/q/23940262
tag name: clr

http://stackoverflow.com/q/23891531
has body: I have a project that is composed out of 5-6 projects with dependencies between them. here it is: @Aspect public class MonitoringAspect { Logger logger = LoggerFactory.getLogger(MonitoringAspect.class); @Around("execution(* *.*(..)) &amp;&amp; @annotation(value)") public &lt;T&gt; Object logAround(ProceedingJoinPoint joinPoint, Monitored value) throws Throwable { Object output = null; Stopwatch stopwatch = new Stopwatch(); StringBuilder statistics = new StringBuilder(); statistics.append("\nStatistics: method [" + joinPoint.getSignature().getName() + "] "); statistics.append("arguments : " + Arrays.toString(joinPoint.getArgs())); stopwatch.start(); output = joinPoint.proceed(); // continue on the intercepted method stopwatch.stop(); statistics.append("Elapsed time in ms = " + stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug(statistics.toString()); return output; }} And The annotation: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Monitored { String value(); } If i use the annotation @Monitored from the same project that the aspect and annotation are "physically" located, everything is working find and the method is advised, but if i try to use it on a different project (like putting them in an infra project so all projects can use it). it doesn't work for these projects (but it does for that infra project that i put the files in). seems to me it should work, or i don't understand something Thanks.
score: 0
tagged with: aspectj
answer count: 1
tagged with: spring-aop
has answer: http://stackoverflow.com/a/23892074
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36783341
tagged with: spring
has comment: http://stackoverflow.com/comment/36783111
type: Question
tagged with: java
has title: Aspect not advising over different project

http://stackoverflow.com/a/24012606
has body: Problem solved. One class from other library, which was using my class, remembered that it was too high class version. Load and resolve this other library helped.
type: Answer
accepted answer of: http://stackoverflow.com/q/23887226
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23887226

http://stackoverflow.com/comment/36971521
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23910732
has text: @Dennis This will lead to creation of another `Stock` because you're passing brand new `Stock` object to `StockTransaction`.
type: AnswerComment

http://stackoverflow.com/q/23912086
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I need to transform coordinates using GeoTools. My code works fine in a Java project but when I put it in the Android I get the error at the mathTransform.transform(...) line: "The type java.awt.geom.Point2D$Double cannot be resolved. It is indirectly referenced from required .class files". Here's my code: CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:3765"); CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:4326"); boolean lenient = true; double x, y; MathTransform mathTransform = CRS.findMathTransform(sourceCrs, targetCrs, lenient); parts = result.split(" "); String coors = ""; for (int i = 0; i &lt; parts.length; i += 2) { x = Double.parseDouble(parts[i]); y = Double.parseDouble(parts[i+1]); DirectPosition2D srcDirectPosition2D = new DirectPosition2D(sourceCrs, x, y); DirectPosition2D destDirectPosition2D = new DirectPosition2D(); mathTransform.transform(srcDirectPosition2D, destDirectPosition2D); x = destDirectPosition2D.x; y = destDirectPosition2D.y; coors += x + " " + y + " "; } System.out.println(coors + ";"); Now I found this question which explains the reasons for it: Can't import Java awt in Eclipse, but what would be the solution?
tagged with: geotools
type: Question
has answer: http://stackoverflow.com/a/23912476
score: 0
linked to: http://stackoverflow.com/q/7924124
has title: MathTransform doesn't work in Android project: "The type java.awt.geom.Point2D$Double cannot be resolved."

http://stackoverflow.com/q/23872458
score: -2
tagged with: android
answer count: 1
has body: While implementing the android developers tutorial on sync adapters, http://developer.android.com/training/sync-adapters/creating-sync-adapter.html i ended up with the following code on my activity: Activity.java // Constants // The authority for the sync adapter's content provider public static final String AUTHORITY = "sync.adapter.datacontentprovider"; // An account type, in the form of a domain name public static final String ACCOUNT_TYPE = "com.udinic.sync_example"; // The account name public static final String ACCOUNT = "Udinic"; // Instance fields Account mAccount; // Global variables // A content resolver for accessing the provider ContentResolver mResolver; Inside onCreate(){ mAccount = CreateSyncAccount(this); // Get the content resolver for your app mResolver = getContentResolver(); // Turn on automatic syncing for the default account and authority mResolver.setSyncAutomatically(mAccount, AUTHORITY, true); method CreateSyncAccount: public static Account CreateSyncAccount(Context context) { // Create the account type and default account Account newAccount = new Account(ACCOUNT, ACCOUNT_TYPE); // Get an instance of the Android account manager AccountManager accountManager = (AccountManager) context .getSystemService(ACCOUNT_SERVICE); /* * Add the account and account type, no password or user data If * successful, return the Account object, otherwise report an error. */ if (accountManager.addAccountExplicitly(newAccount, null, null)) { /* * If you don't set android:syncable="true" in in your &lt;provider&gt; * element in the manifest, then call context.setIsSyncable(account, * AUTHORITY, 1) here. */ } else { /* * The account exists or some other error occurred. Log this, report * it, or handle it internally. */ Log.d("insitu", "creating sync account error"); } return newAccount; } This is the standard way in android developers tutorials in sync adapters to run a sync adapter when an available connection is up. Although i want this i also want it to only hap…
tagged with: android-syncadapter
favorite count: 0
has answer: http://stackoverflow.com/a/24664196
has title: how to make onPerformSync on Android syncadapter when network is available and content provider data changes?
downvote count: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24664196
type: Question
tagged with: android-contentprovider
has comment: http://stackoverflow.com/comment/36746504
upvote count: 0

http://stackoverflow.com/a/23837468
has comment: http://stackoverflow.com/comment/36735164
downvote count: 0
has body: That is... rather odd. This is what the documentation says about serializing lambdas: You can serialize a lambda expression if its target type and its captured arguments are serializable. However, like inner classes, the serialization of lambda expressions is strongly discouraged. I am not fully familiar with the captured arguments, but I am assuming that it is referring to all the elements that are being captured by the lambda, meaning in this case that it refers this, so it is a captured element then. When further exploring that path, we see that TestClass needs to be serializable, which it seems to be as it implements Serializable. Moreover it will use the default lambda serialization (which is moreoften than not not a good idea), and it has as arguments a String and a SerializableRunnable, which both are Serializable again. So it seems to me that you've hit a bug in the JVM and it could be caused by the target being equal to a captured argument (this).
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23837215

http://stackoverflow.com/comment/36606563
comment on: http://stackoverflow.com/q/23797033
score: 0
type: Comment
type: QuestionComment
has text: Do you have any other `@PostConstruct` annotated beans that _do_ need to run?

http://stackoverflow.com/q/23897677
has body: I am trying to read JSON data from a localhost PHP file. It successfully connects but I get the error 05-27 15:40:24.108: E/log_tag(17146): Error Parsing Data org.json.JSONException: Value {"firstName":"John","lastName":"Doe"} of type org.json.JSONObject cannot be converted to JSONArray When I open the PHP script in my browser it successfully displays { "firstName":"John" , "lastName":"Doe" } package com.example.testexternaldatabase; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.os.StrictMode; import android.util.Log; import android.widget.TextView; public class MainActivity extends Activity { /** Called when the activity is first created. */ TextView resultView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); StrictMode.enableDefaults(); // STRICT MODE ENABLED resultView = (TextView) findViewById(R.id.textView1); getData(); } public void getData() { String result = ""; InputStream isr = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.mstreetllc.com/Lab.asp"); // YOUR PHP // SCRIPT // ADDRESS HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); resultView.setText("Couldnt connect to database"); } // convert response to string try { BufferedReader reader = new BufferedReader(new InputStreamReader( isr, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((li…
has answer: http://stackoverflow.com/a/23897903
favorite count: 0
has comment: http://stackoverflow.com/comment/36795336
has answer: http://stackoverflow.com/a/23897898
accepted answer: http://stackoverflow.com/a/23897903
tagged with: android
has title: org.json.JSONObject cannot be converted to JSONArray when receiving JSON code on Android App
tagged with: php
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23897898
has comment: http://stackoverflow.com/comment/36795295
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36795099
has comment: http://stackoverflow.com/comment/36795190
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
has comment: http://stackoverflow.com/comment/36795050
answer count: 2

http://stackoverflow.com/comment/36625197
type: Comment
comment on: http://stackoverflow.com/a/23808861
type: AnswerComment
has text: Are there any benefits to this or Icewind's way, versus that of 323go as far as you're concerned?
score: 0

buffer
tags question: http://stackoverflow.com/q/23934832
tag name: buffer
tags question: http://stackoverflow.com/q/23918067
type: Tag

http://stackoverflow.com/comment/40235512
has text: FwIW, this might just be an issue with PhantomJS not handling label clicks in the same way as conventional browsers. If I'm testing JavaScript with PhantomJS then I have to manually create and dispatch the mouse event to get click to work. This unfortunately doesn't help much for Selenium but it may be useful information anyway!
comment on: http://stackoverflow.com/q/23806764
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36875839
comment on: http://stackoverflow.com/q/23940208
score: 0
type: QuestionComment
has text: I am currently using startForeground(). I was hoping for any other settings that I can use.
type: Comment

http://stackoverflow.com/a/27921150
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/120904046
has body: There is another thumb rule which is handy, and it goes something like this Class_Name Reference_Variable = new Class_Constructor() So the piece of code Truck theTruck = new Truck(); Vehicle theVehicle = theTruck; Mobile theMobile = theVehicle; Here - theTruck is the "reference variable" of type Truck and "Object Type" of Truck theVehicle is the "reference varible" of type Vehicle and "Object Type" of theTruck "reference", which is, Truck theMobile is the "reference variable" of type Moble and "Object Type" of theVehicle "reference", which is, Truck. So Option C is the correct answer.
type: Answer
answers question: http://stackoverflow.com/q/23892569
downvote count: 0

http://stackoverflow.com/comment/36635687
has text: @ohiocowboy If you post that as an answer, I'll accept it.
type: QuestionComment
comment on: http://stackoverflow.com/q/23792500
score: 0
type: Comment

http://stackoverflow.com/q/23826220
has comment: http://stackoverflow.com/comment/36671677
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36658667
type: Question
has comment: http://stackoverflow.com/comment/36659013
has title: CATALINA_PID != real PID
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: I set: $ export CATALINA_PID="$CATALINA_HOME/conf/catalina.pid" Started Tomcat: $ ./bin/startup.sh Using CATALINA_BASE: /home/tomcats/apache-tomcat-7.0.53 Using CATALINA_HOME: /home/tomcats/apache-tomcat-7.0.53 Using CATALINA_TMPDIR: /home/tomcats/apache-tomcat-7.0.53/temp Using JRE_HOME: /usr/java/jdk1.6.0_45/jre/ Using CLASSPATH: /home/tomcats/apache-tomcat-7.0.53/bin/bootstrap.jar:/home/tomcats/apache-tomcat-7.0.53/bin/tomcat-juli.jar Using CATALINA_PID: /home/tomcats/apache-tomcat-7.0.53/conf/catalina.pid Tomcat started. Checked pid-file: $ cat /home/tomcats/apache-tomcat-7.0.53/conf/catalina.pid 28461 But - there is no process 28461: $ ps aux | grep 28461 tomcats 28599 0.0 0.0 103240 872 pts/0 S+ 12:50 0:00 grep 28461 $ ps -p 28461 PID TTY TIME CMD And Tomcat's JVM runs with other PID: $ ps u | grep tomcat | grep java | grep -v grep | cut -d" " -f 3 30133 From "Tomcat the Definitive Guide" of Jason Brittain book we know that: CATALINA_PID This variable may optionally hold the path to the process ID file that Tomcat should use when starting up and shutting down. None Use: $ cat /etc/redhat-release CentOS release 6.4 (Final) So, question is: for what exactly CATALINA_PID variable needs or - why it's return wrong number? Close question - after few restarts/kills it is now works good... Don't know why.
has comment: http://stackoverflow.com/comment/36680684
tagged with: pid
tagged with: catalina

http://stackoverflow.com/comment/36682724
type: AnswerComment
has text: Accessibility may be based on runtime info such as the declared and actual types of the object reference, and the parameters.
type: Comment
comment on: http://stackoverflow.com/a/23836004
score: 0

http://stackoverflow.com/comment/36615559
type: AnswerComment
has text: vim .bash_profile export JAVA_HOME=$(/usr/libexec/java_home) $ source .bash_profile $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home >>>>is this what we have to run in the terminal to set JAVA_HOME
score: 0
comment on: http://stackoverflow.com/a/23799813
type: Comment

http://stackoverflow.com/comment/36715002
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23855404
score: 0
has text: I know StackoverFlow is not a homework-solution-generator but I create some ideas to find the solution but I can't translate into code.By the way,thank you for your advice .

http://stackoverflow.com/a/23973780
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/52868562
has body: The framework cannot cancel a task for the same reason you cannot cancel a thread. See the documentation on Thread.stop() for all the reasons. What locks could the task be holding? What outside resources could it have linkage to? All the same Thread.stop() reasons apply to tasks as well (after all, tasks run under threads.) You need to tell the task to stop just like you tell a thread to stop. I manage another fork/join project that uses the scatter-gather technique. The way I do a cancel, or short-circuit, is that every task I create is passed an object (PassObject) that has a protected volatile boolean stop_now = false; and a method for stopping the task protected void stopNow() {stop_now = true; } Each task periodically checks the stop_now and when true it gracefully ends the task. Unfortunately, the stop_now needs to be volatile since another thread is going to set it. This can add significant overhead if you check it frequently. How to set this field in another task gets a little tricky. Each task I create also contains a reference to the array of references to every other task int nbr_tasks = nbr_elements / threshold; // this holds the common class passed to each task PassObject[] passList = new PassObject[nbr_tasks]; for (int i = 0; i &lt; nbr_tasks; i++) passList[i] = new PassObject( passList,… other parms); Once the list is formed I fork() each object in passList. Each PassObject contains a reference to the array, passList, which contains a reference to every object that is passed to each task. Therefore, every task knows about every other task and when one task want to cancel the others it simply calls the cancelOthers method with a reference to the passList. private void cancelOthers (PassObject[] others) { // tell all tasks to stop for (int i = 0, max = others.length; i &lt; max; i++) others[i].stopNow(); If you’re using Java8 then you can do a form of scatter-gather with the CountedCompler class instead of the RecusiveTask. For Java7 or if you still wan…
has comment: http://stackoverflow.com/comment/37034117
upvote count: 3
score: 1
has comment: http://stackoverflow.com/comment/37088536
has comment: http://stackoverflow.com/comment/52840727
has comment: http://stackoverflow.com/comment/37102800
answers question: http://stackoverflow.com/q/23869028

http://stackoverflow.com/a/72130472
answers question: http://stackoverflow.com/q/23851668
score: 0
has body: I think you should remove blank character before convert the string int integer = Integer.parseInt(string.trim()); then, use parseInt or valueOf to convert the string for more information，please refer convert string to int
type: Answer

web-applications
tags question: http://stackoverflow.com/q/23871322
tags question: http://stackoverflow.com/q/23798414
tags question: http://stackoverflow.com/q/23924472
tags question: http://stackoverflow.com/q/23936133
tags question: http://stackoverflow.com/q/23837787
tags question: http://stackoverflow.com/q/23938146
tag name: web-applications
tags question: http://stackoverflow.com/q/23925076
tags question: http://stackoverflow.com/q/23937475
tags question: http://stackoverflow.com/q/23931844
type: Tag
tags question: http://stackoverflow.com/q/23812921

http://stackoverflow.com/comment/105801829
has text: Did anyone ever prove the JAASRealm logs users back in across restarts?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23878585
type: Comment

http://stackoverflow.com/q/23830640
has body: I'm trying to implement Dijkstra's algorithm in order to find the shortest path between 2 points in a grid (x,y) but the problem is that I can only move up, down, right and left. I have an ArrayList containing the x and ys of the points I need to pass on and another ArrayList of the points that are obstacles on the grid, I'm trying to write a function that returns an ArrayList of the movement needed in order to finish all the path. In example: 1,1,1,2,3,4,1.. 1 being right 2 being left and 3 being up and finally 4 being down. Can you please provide me with some hints and/or examples.
has answer: http://stackoverflow.com/a/23830803
has comment: http://stackoverflow.com/comment/36666243
has comment: http://stackoverflow.com/comment/36666634
has title: Dijkstra's algorithm in Java for matrix with obstacles
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2311486
has comment: http://stackoverflow.com/comment/36666509
tagged with: java
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36666167
has comment: http://stackoverflow.com/comment/36666710
tagged with: algorithm
score: -2
has comment: http://stackoverflow.com/comment/36668420
has comment: http://stackoverflow.com/comment/36667159
has comment: http://stackoverflow.com/comment/36667148
type: Question
tagged with: arraylist
linked to: http://stackoverflow.com/q/23716285
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/19463547
has comment: http://stackoverflow.com/comment/36666921

http://stackoverflow.com/comment/36708996
score: 0
comment on: http://stackoverflow.com/a/23852671
type: AnswerComment
has text: He's showing you how to declare ArrayList so that it will only accept objects that are either Player's or children that inherit from Player.
type: Comment

http://stackoverflow.com/a/66926582
type: Answer
has body: Okay that's a brief answer after hours of research, I hope it'll help others not to bang their head against the wall : try disabling the On-Screen Display support for Java.exe (by adding it in the list) in RivaTuner Statistics Server if it's running on your computer. Doing so on my computer has instantly made the issue disappear.
answers question: http://stackoverflow.com/q/23780564
score: 0

http://stackoverflow.com/comment/36680684
score: 0
type: Comment
type: QuestionComment
has text: @maindas Thanks - but it's works now. Don't know why - but after few restarts works. P.S. under this user - runs only one Tomact; catalina.sh - without modifications.
comment on: http://stackoverflow.com/q/23826220

http://stackoverflow.com/comment/36734958
type: Comment
has text: Please answer this question i am stuck of this ...
type: QuestionComment
comment on: http://stackoverflow.com/q/23866411
score: 0

http://stackoverflow.com/q/23896838
linked to: http://stackoverflow.com/q/9821425
tagged with: swing
answer count: 1
tagged with: miglayout
accepted answer: http://stackoverflow.com/a/23923560
tagged with: java
has title: JScrollPane (for JTable) fill and grow in MigLayout
has body: It is difficult to describe what happens so here is a SSCCE: public class TableInScrollPaneTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new TableInScrollPaneTest(); } }); } public TableInScrollPaneTest() { JFrame frame = new JFrame(); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); LayoutManager layout; layout = new MigLayout("wrap 1, fill", "fill, grow", "[fill, grow 1][fill, grow 2]"); //layout = new GridLayout(2,1); JPanel panel = new JPanel(layout); JPanel placeHolder = new JPanel(); JPanel placeHolder2 = new JPanel(); placeHolder.setBackground(Color.GRAY); placeHolder2.setBackground(Color.LIGHT_GRAY); JTable table = this.createTable(); JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); //table.setPreferredScrollableViewportSize(new Dimension(5000,200)); panel.add(placeHolder, ""); panel.add(tableScrollPane, ""); //panel.add(placeHolder2, ""); frame.setContentPane(panel); frame.setVisible(true); } private JTable createTable() { String[] columnNames = "Name 1,Name 2,Name 3,Name 4,Name 5".split(","); int rows = 30; int cols = columnNames.length; String[][] data = new String[rows][cols]; for(int i=0; i&lt;rows; i++) { for(int j=0; j&lt;cols; j++) { data[i][j] = "R"+i+" C"+j; } } JTable table = new JTable(data, columnNames); return table; } } I want the scrollPane to use all available space when the frame gets resized by the user. But additionally I want another panel (placeHolder) to grow, too. For example the heigth of the frame divided by 3, the placeHolder gets 1 part and the scrollPane gets 2 parts. The GridLayout is kinda doing what I need, but I'm looking for a solution with MigLayout. If you uncomment panel.add(placeHolder2, ""); and comment the line above it works. EDIT1: I tried using the sizegroup contraint. Now the placeHolder and…
tagged with: jtable
tagged with: jscrollpane
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23923560
downvote count: 0
linked to: http://stackoverflow.com/q/9773107
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/36661262
has text: I tried to change the administration server port to 14848 as you mentioned above but I got this: "Remote server does not listen for requests on [localhost:4848]. Is the server up?".
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23827843
type: AnswerComment

http://stackoverflow.com/comment/36740710
comment on: http://stackoverflow.com/a/23869529
type: Comment
score: 2
has text: dont use slash or backslash use this: System.getProperty("path.separator"); and have a look at http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
type: AnswerComment

http://stackoverflow.com/a/23869423
has body: Instead of FileWriter use OutputStreamWriter, your problem will be solved as OutputStreamWriter consdiers '\n' while streaming. FileOutputStream fos = new FileOutputStream(new File("path")); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
answers question: http://stackoverflow.com/q/23869267
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36740428

http://stackoverflow.com/a/23849820
accepted answer of: http://stackoverflow.com/q/23849811
has body: It depends on the method Location.getLocation() if you are crating the new instance of the Location class then there is no issue. But if you are returning the same object then it may cause issue in case of MultiThreading then you have to get the lock before using it on the class itself.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36703549
downvote count: 0
has comment: http://stackoverflow.com/comment/36703536
has comment: http://stackoverflow.com/comment/36703572
has comment: http://stackoverflow.com/comment/36703742
type: Answer
has comment: http://stackoverflow.com/comment/36703521
upvote count: 1
has comment: http://stackoverflow.com/comment/36703509
has comment: http://stackoverflow.com/comment/36703617
score: 1
answers question: http://stackoverflow.com/q/23849811
has comment: http://stackoverflow.com/comment/36703548

http://stackoverflow.com/comment/36968321
score: 0
has text: @DavidWallace Hi David. Just want to let you know that the error "...[M1.13]" is no longer there but it has become "...java.lang.NullPointerException" caused by line `o[c] = sheet.getRow(r).getCell(c);` have updated my output in the qns section
type: QuestionComment
comment on: http://stackoverflow.com/q/23924963
type: Comment

http://stackoverflow.com/q/23820232
type: AnsweredQuestion
has body: I was using an image editor last night for a certain picture. I set the text in the picture to #00fffb(cyan), later that day I made a program in JavaFX8 and noticed that a label set to the same color(#00fffb) did not have the same color on screen. I also noticed that the cyan-looking colors looked different in the color chooser than they do on screen. NOTE: The fonts were the same as well. Also, I used a black background to compare the two. Label CSS: .controlScreenLabel{ -fx-font-family: Lucida Fax; -fx-font-size: 23px; -fx-text-fill: #00fffb; }
accepted answer: http://stackoverflow.com/a/23820388
tagged with: java
tagged with: javafx
type: Question
tagged with: image
score: 0
has comment: http://stackoverflow.com/comment/36647085
has answer: http://stackoverflow.com/a/23820388
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36647155
has comment: http://stackoverflow.com/comment/36646916
has title: Color Mismatch In JavaFX8 Labels
tagged with: css

http://stackoverflow.com/comment/36730173
score: 1
type: QuestionComment
has text: Are you sure you can't use a singleton pattern here?. One logger instance for all classes. Logger.getLogger() should return the same instance of Logger.
type: Comment
comment on: http://stackoverflow.com/q/23863615

http://stackoverflow.com/q/23880300
tagged with: where-clause
score: 0
tagged with: sql
answer count: 1
favorite count: 0
tagged with: database-connection
has answer: http://stackoverflow.com/a/23880330
has body: when I send statement to SQL,netbeans does not recognize ? to replace it with strings,int. I suggest, synatax mistake? Here: Connection conn = null; PreparedStatement prepStmt = null; ResultSet rs = null; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); String connectionUrl = "jdbc:sqlserver://FIO\\SQLEXPRESS;" + "databaseName=Feedback;integratedSecurity=true"; conn = DriverManager.getConnection(connectionUrl); String sqlStmt = "SELECT SubjectName, Semester, Year, TrainerFirstName, TrainerLastName, StudentFirstName,StudentLastName, Answer FROM Feedback.dbo."+quest+" WHERE TrainerFirstName=? AND TrainerLastName=? AND Semester=? AND Year=?"; //String sqlStmt = "SELECT SubjectName FROM Feedback.dbo."+quest; System.out.println("SQL Statement:\n\t" + sqlStmt); prepStmt = conn.prepareStatement(sqlStmt); prepStmt.setString(1,ffname); prepStmt.setString(2,llname); prepStmt.setInt(3,sem); prepStmt.setInt(4,yea); rs = prepStmt.executeQuery(); while (rs.next()) { System.out.println(rs.getString(1) + rs.getInt(2)+rs.getInt(3)+rs.getString(4)+rs.getString(5)+rs.getString(6)+rs.getString(7)+rs.getInt(8)); //System.out.println(rs.getString(1)); /*String id = rs.getString("id"); String firstName = rs.getString("first_name"); String lastName = rs.getString("last_name"); System.out.println("ID: " + id + ", First Name: " + firstName + ", Last Name: " + lastName);*/ } } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SQLException e) { } If it is run, it print: SQL Statement: SELECT SubjectName, Semester, Year, TrainerFirstName, TrainerLastName, StudentFirstName,StudentLastName, Answer FROM Feedback.dbo.Question1 WHERE TrainerFirstName=? AND TrainerLastName=? AND Semester=? AND Year=? BUILD SUCCESSFUL (total time: 19 seconds) Where ? werent replace with ffname,llname and so on..:/ Thank you a lot.
type: AnsweredQuestion
has title: headache with "where" condition in statement sended to SQL
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23880330

http://stackoverflow.com/q/23889811
has answer: http://stackoverflow.com/a/23889855
tagged with: inheritance
has answer: http://stackoverflow.com/a/23889892
has answer: http://stackoverflow.com/a/23889943
accepted answer: http://stackoverflow.com/a/23889855
type: AnsweredQuestion
score: 21
favorite count: 0
has answer: http://stackoverflow.com/a/23889889
type: Question
possible better answer: http://stackoverflow.com/a/23889875
answer count: 8
has answer: http://stackoverflow.com/a/23889875
has answer: http://stackoverflow.com/a/23889921
tagged with: java
has body: I have 2 subclasses: Staff, Student they belong to superclass Person. Here is the code(tasks) which is given by my teacher: public class Person { private String name; private int yearOfBirth; /** * Create a person with given name and age. */ Person(String name, int yearOfBirth) { this.name = name; this.yearOfBirth = yearOfBirth; } } class Student extends Person { private String SID; // student ID number /** * Create a student with no parameters. */ Student() { //task. } } public class Staff extends Person { private String roomNumber; /** * Construct a staff member with field values and no pamaeters. */ public Staff() { //task } } I don't know what can I type in order to create an object without parameter. It always appears an error like: constructor Person in class Person cannot be applied to given types; required: java.lang.String,int; I have checked online that there are 2 ways to solve the problem: add a default value in the superclass: Person()//without parameter. In the subclass Student: Student() { Person astudent = new Student() //I guess. } add a super() in the subclass: Student() { super("xxx")//I guess. } I don't know what to do. I an a starter in learning BlueJ. Hope anyone can help me. Thank you very much.
has comment: http://stackoverflow.com/comment/36779943
downvote count: 1
has answer: http://stackoverflow.com/a/71891671
upvote count: 22
has answer: http://stackoverflow.com/a/69327720
has title: java constructor in class cannot be applied to given types

http://stackoverflow.com/comment/36665164
has text: no. currently i had 6 wsdl. but without this wsdl it is ok. when i put this wsdl to the directory then it getting that exception.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23821597

http://stackoverflow.com/q/23886913
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/36773750
tagged with: aes
has comment: http://stackoverflow.com/comment/36775054
has comment: http://stackoverflow.com/comment/36775194
tagged with: java
type: Question
has body: Hi I am not able to decrypt a text containing '+' symbol inside the JSP page, I get the following error javax.crypto.BadPaddingException: Given final block not properly padded. However the code works fine if I run from Eclipse or if I convert the code into Executable Jar. JARS used : local_policy.jar US_export_policy.jar Below is my Java code import java.security.Key; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class Decrypt256bit { private static Key key; private static Cipher cipher; static { key = new SecretKeySpec("P@ssw0Rd!@#**&amp;&amp;&amp;P@ssw0Rd!@#**&amp;&amp;&amp;".getBytes(), "AES"); try { cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING","SunJCE"); } catch (Exception e) { e.printStackTrace(); } } public static String encryptData(String plainText) { try { cipher.init(Cipher.ENCRYPT_MODE, key); byte[] encrypted = cipher.doFinal(plainText.getBytes()); return new BASE64Encoder().encode(encrypted); } catch (Exception e) { throw new IllegalArgumentException(e); } } public static String decryptData(String encryptedValue) { try { cipher.init(Cipher.DECRYPT_MODE, key); byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedValue); int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES"); System.out.println("Length==="+maxKeyLen); return new String(cipher.doFinal(decordedValue)); } catch (Exception e) { throw new IllegalArgumentException(e); } }
score: -1
has comment: http://stackoverflow.com/comment/36775655
has comment: http://stackoverflow.com/comment/36775044
has answer: http://stackoverflow.com/a/23890112
has comment: http://stackoverflow.com/comment/36826149
has title: Unable to Decrypt a text containg + symbol using AES 256bit Decryption:javax.crypto.BadPaddingException: Given final block not properly padded
downvote count: 2
upvote count: 1
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/23827801
type: Question
has body: We note that java 8 uses Referential Transparency : I test many codes to detect this RT,such as: public class ReferentialTransparency { public static int triple(int number) { System.out.println(number); try { Thread.sleep(500); } catch (Exception e) { } return number* 3; } public static void main(String[] args) { List&lt;Integer&gt; vals=Arrays.asList(1,2,3,4,3); System.out.println(vals.parallelStream() .mapToInt(ReferentialTransparency::triple) .sum()); } } CONSOLE : 3 4 2 1 3 39 I note that Java 8 runs triple methods even there is an element which is appeared two times which is 3. My question ,as Istvan interprets,is : Why doesn't the compiler optimize out the repeated call to triple(3) if triple is referentially transparent?
accepted answer: http://stackoverflow.com/a/23829357
has title: When Java8 uses referential transparency
answer count: 1
has comment: http://stackoverflow.com/comment/36665227
favorite count: 0
has comment: http://stackoverflow.com/comment/36665160
has comment: http://stackoverflow.com/comment/36663378
tagged with: java-8
has answer: http://stackoverflow.com/a/23829357
score: 2
type: AnsweredQuestion
tagged with: referential-transparency
upvote count: 3
tagged with: java
downvote count: 1

http://stackoverflow.com/a/23813453
type: Answer
has body: i think your problem stems from final Integer threadCount = new Integer(0); its final, so it cannot be changed. so your main function will always evaluate it as 0. the instance of threadCount inside the class can change, but that is not the one your while loops are looking at. At least i THINK that is what is going on here.
score: 0
answers question: http://stackoverflow.com/q/23812981

http://stackoverflow.com/a/23837305
accepted answer of: http://stackoverflow.com/q/23836455
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23836455
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36688555
has comment: http://stackoverflow.com/comment/36695141
has body: Correct. On the DefaultMessageListenerContainer(DMLC) you typically only need acknowledgemode=transacted; you would only use a transaction manager on a DMLC if you need to synchronize the JMS transaction with, say, a JDBC transaction or you need to use a platform (JTA) transaction manager. Further, any downstream JmsTemplate operation on the container's thread will be done in the same session and participate in the transaction. Similarly, for JmsTemplate operations on a thread that is not a container thread you generally don't need a transaction manager, unless the platform requires it.
score: 4

http://stackoverflow.com/q/23842428
has answer: http://stackoverflow.com/a/23842470
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36689134
has comment: http://stackoverflow.com/comment/36689328
has title: Clone copy of custom class
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23842484
has body: I have a Board class that has the following private variables: private int[][] table = new int[BOARD_DIMENSION][BOARD_DIMENSION] private List&lt;Character&gt; movesTaken = new ArrayList&lt;Character&gt;(); private List&lt;Integer&gt; future = new ArrayList&lt;Integer&gt;(); I want to be able to clone a new Board via the following method: public Board copy(Board parent){ return new Board(parent); } public Board(Board parent){ System.arraycopy(parent.getTable(),0,this.table,0,parent.getTable().length); this.future = parent.getFuture(); this.initialiseTileReps(); this.initialiseValueReps(); this.movesTaken = parent.getMovesTaken(); } However when I copy a Board object: Board U = root.copy(root); (where root is the board I want to copy). If I modify U U.move('U'); I expect that to modify U's table that contains all the game pieces. However it also modifies root's table. Can someone please help me clone my custom Board?
tagged with: oop
has comment: http://stackoverflow.com/comment/36689163
score: 0
tagged with: java

http://stackoverflow.com/comment/36872654
has text: If this answer solved your problem in question then kindly accept as answer. hv fun coding :)
comment on: http://stackoverflow.com/a/23930729
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23823817
has comment: http://stackoverflow.com/comment/36670224
type: Question
possible better answer: http://stackoverflow.com/a/23824181
answer count: 2
linked to: http://stackoverflow.com/q/5113579
downvote count: 0
has body: I want to shared common application context in a multi-war Spring application, so i don't need to defined beans again and again. But i don't want to instantiate those beans defined in this common application context in each webapp. I only want to instantiate those beans once and share by all the webapps. Is it possible? Bare me if i'm wrong. PS: this common application context exists in jar, which i'll import to every webapps. 1, Below article tell us how to share the common application context, but need to instantiate those beans in each webapp. How to import spring-config.xml of one project into spring-config.xml of another project? 2, Below is another article i just read, i demo it, but still don't get what i want, beans got instantiated twice. Can someone check this section "Why would you want to use this?" in the article, i don't get it, do they have a solution there, can someone help me here, thanks a lot for your time. http://spring.io/blog/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/ here is the demo source code in second article: https://github.com/jasonluo/ceciic/tree/master/Research/multiple-contexts-sample Updates The problem of case2 is because i didn't deploy as a ear file, thanks Deinum for pointing this out, i'm using tomcat, so there is no way to achieve that. Our solution now is using REST to access the service webapp which running in a separate server.
has answer: http://stackoverflow.com/a/23824027
has title: Using a shared parent application context in a multi-war Spring application
favorite count: 0
has comment: http://stackoverflow.com/comment/36653688
has comment: http://stackoverflow.com/comment/36653582
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36658843
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23824181
upvote count: 1
accepted answer: http://stackoverflow.com/a/23824027

http://stackoverflow.com/comment/36845823
type: AnswerComment
has text: Also, it lets me cast the list (see first line) but wouldn't let me cast the iterator. I have an iterator of apples. I want to iterate over fruit - there cannot be an issue.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23924448

http://stackoverflow.com/comment/36710026
has text: You're still reading the socket channel until end of file. That only happens when the peer closes the connection.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23839758

http://stackoverflow.com/q/23839506
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23847322
tagged with: dropwizard
tagged with: yaml
has title: property in subclass of DatabaseConfiguration can not be found in Dropwizard yaml (hierarchical issue)
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to know. Can i do this or a derivation of it? In my Dropwizard config.yml I wanted to extend databaseConfiguration class so to add another property to the config.yml as below config.yml database driverClass: org.postgresql.Driver user: user1 password: password exampleProperty: property1 (Tried a few other permutations) Assume theres a DatabaseConfiguration class that has fields with getters and annotations for driverClass, user, password etc public class AppConfiguration extends Configuration { @Valid @NotNull @JsonProperty private DatabaseConfiguration database = new DatabaseConfiguration(); public DatabaseConfiguration getDatabaseConfiguration() { return database; } @Valid @NotNull @JsonProperty private ExtendedDatabaseConfiguration extDatabase; public ExtendedDatabaseConfiguration getExtendedDatabaseConfiguration() { return extDatabase; } public class ExtendedDatabaseConfiguration extends DatabaseConfiguration { @Valid @NotNull @JsonProperty private String exampleProperty; public String getExampleProperty() { return exampleProperty; }; } The main class Server.java passes the ExtendedDatabaseConfiguration to the Hibernate Bundle via the call (formerly passed the DatabaseConfiguration) private final CustomHibernateBundle&lt;AppConfiguration&gt; hibernateBundle = new CustomHibernateBundle&lt;AppConfiguration&gt;() { @Override //Giving the subclass holding the new database property to the CustomHibernateBundle public DatabaseConfiguration getDatabaseConfiguration(AppConfiguration configuration) { return configuration.getExtendedDatabaseConfiguration(); } }; SimpleModule simpleModule = new SimpleModule(); simpleModule.addAbstractTypeMapping(DatabaseConfiguration.class, ExtendedDatabaseConfiguration.class); bootstrap.getObjectMapperFactory().registerModule(simpleModule); This is all in order for CustomHibernateBundle to then use this field as it pleases. Whatever i tried either i got the error jackson.databind.exc.UnrecognizedPropertyException or i get the follo…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23847322
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/a/23788135
answers question: http://stackoverflow.com/q/23787722
downvote count: 0
has body: The problem is that look-behinds can't have variable lengths, but if your input is well formed (that is tags are closed with matching tags), and you text to be replaced isn't a CDATA element that itself contains the closing tag (seems unlikely), this will work: str = str.replaceAll("(?<=[:<]p>)[^<]*(?=</(\\w+:)?p>)", "replacement"); This regex makes the replacement whether or not there's a namespace. Here's some test code: String str = " to be replaced <tns:p>to be replaced</tns:p><tns:w>not to be replaced</tns:w><tns:p>to be replaced</tns:p>"; str = str.replaceAll("(?<=[:<]p>)[^<]*(?=</(\\w+:)?p>)", "replacement"); System.out.println(str); Output: replacement replacementnot to be replacedreplacement If you input is not well formed and simple, ie the closing tag namespace may not be the same, you can do it by capturing the namespace, using a back-reference to assert it's the same in the closing tag, and putting it back in the replacement: str = str.replaceAll("(<(\\w+:)?p>)[^<]*(?=</(\\2)p>)", "$1replacement"); The namespace is still optional, but now the namespace in the closing tag must match that of the opening tag.
has comment: http://stackoverflow.com/comment/36586092
has comment: http://stackoverflow.com/comment/36586457
has comment: http://stackoverflow.com/comment/36586485
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36586894

servlets
tags question: http://stackoverflow.com/q/23796368
tags question: http://stackoverflow.com/q/23926681
tags question: http://stackoverflow.com/q/23802410
tags question: http://stackoverflow.com/q/23851328
tags question: http://stackoverflow.com/q/23907526
tags question: http://stackoverflow.com/q/23832443
tags question: http://stackoverflow.com/q/23929542
tags question: http://stackoverflow.com/q/23841203
tags question: http://stackoverflow.com/q/23858364
tags question: http://stackoverflow.com/q/23839226
tags question: http://stackoverflow.com/q/23872307
tags question: http://stackoverflow.com/q/23885323
tags question: http://stackoverflow.com/q/23873071
tags question: http://stackoverflow.com/q/23889657
tags question: http://stackoverflow.com/q/23789049
tags question: http://stackoverflow.com/q/23873782
tags question: http://stackoverflow.com/q/23920639
tags question: http://stackoverflow.com/q/23877694
tags question: http://stackoverflow.com/q/23778808
tags question: http://stackoverflow.com/q/23826235
tags question: http://stackoverflow.com/q/23885329
tags question: http://stackoverflow.com/q/23802375
tags question: http://stackoverflow.com/q/23913297
tags question: http://stackoverflow.com/q/23836144
tags question: http://stackoverflow.com/q/23903180
tags question: http://stackoverflow.com/q/23874916
tags question: http://stackoverflow.com/q/23911018
tags question: http://stackoverflow.com/q/23819095
tags question: http://stackoverflow.com/q/23819833
tags question: http://stackoverflow.com/q/23843017
tags question: http://stackoverflow.com/q/23790725
tags question: http://stackoverflow.com/q/23919481
tags question: http://stackoverflow.com/q/23935276
tags question: http://stackoverflow.com/q/23843309
tags question: http://stackoverflow.com/q/23800525
tags question: http://stackoverflow.com/q/23868547
tags question: http://stackoverflow.com/q/23893793
tags question: http://stackoverflow.com/q/23912460
tags question: http://stackoverflow.com/q/23903837
tags question: http://stackoverflow.com/q/23926814
tags question: http://stackoverflow.com/q/23877391
tags question: http://stackoverflow.com/q/23815963
tags question: http://stackoverflow.com/q/23935445
tags question: http://stackoverflow.com/q/23856549
tags question: http://stackoverflow.com/q/23873947
tags question: http://stackoverflow.com/q/23903939
tags question: http://stackoverflow.com/q/23856769
tags question: http://stackoverflow.com/q/23816548
tags question: http://stackoverflow.com/q/23827120
tags question: http://stackoverflow.com/q/23866710
tags question: http://stackoverflow.com/q/23898024
tags question: http://stackoverflow.com/q/23901070
tags question: http://stackoverflow.com/q/23910387
tags question: http://stackoverflow.com/q/23846611
tags question: http://stackoverflow.com/q/23845108
tags question: http://stackoverflow.com/q/23884200
tags question: http://stackoverflow.com/q/23875084
tags question: http://stackoverflow.com/q/23804236
tags question: http://stackoverflow.com/q/23783839
tags question: http://stackoverflow.com/q/23848409
tags question: http://stackoverflow.com/q/23812921
tags question: http://stackoverflow.com/q/23843628
tags question: http://stackoverflow.com/q/23816338
tags question: http://stackoverflow.com/q/23788987
tags question: http://stackoverflow.com/q/23882697
tags question: http://stackoverflow.com/q/23802295
tags question: http://stackoverflow.com/q/23878251
tags question: http://stackoverflow.com/q/23862617
tags question: http://stackoverflow.com/q/23857938
tag name: servlets
tags question: http://stackoverflow.com/q/23921389
tags question: http://stackoverflow.com/q/23892179
tags question: http://stackoverflow.com/q/23892484
type: Tag
tags question: http://stackoverflow.com/q/23865768
tags question: http://stackoverflow.com/q/23851722
tags question: http://stackoverflow.com/q/23856959
tags question: http://stackoverflow.com/q/23840003
tags question: http://stackoverflow.com/q/23899266
tags question: http://stackoverflow.com/q/23849471

http://stackoverflow.com/comment/36778279
type: Comment
comment on: http://stackoverflow.com/a/23885428
has text: The "two lower cases, one upper case" problem isn't present in Turkish, but it's in Greek (sigma). Turkish is fairly easy in comparison, it just doesn't have I as capital i.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23883917
tagged with: customization
upvote count: 5
has title: Customize catch block in Java and enable smart insert in Eclipse
downvote count: 0
accepted answer: http://stackoverflow.com/a/23884068
has body: In Eclipse when we select code statements and right click on it, it gives us an option for surrounding with try/catch block, after selecting this option our code looks like. try { //selected code lines } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Now I want to define a custom catch block which should look like below after selecting surround with try/catch block from eclipse smart insert: try { //selected code lines } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); myCustomLogger.LogMe(Log.getStackTraceString(e)); } Is it possible? Does Eclipse allow us to customize some properties for specific project in smart insert?
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23884068
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
tagged with: try-catch
score: 5

http://stackoverflow.com/comment/36647148
score: 0
type: Comment
has text: @trashgod: Yes. I did a depth first search of the files and directories on my C: drive in this example. I'm working on a more complex file browser, and that has a TreeModel implementation and a breadth first search.
comment on: http://stackoverflow.com/a/23808238
type: AnswerComment

http://stackoverflow.com/q/23878855
has answer: http://stackoverflow.com/a/23878988
tagged with: arrays
has title: Why same refrence variable points diffrent addresses if stored in array
answer count: 3
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36758601
has answer: http://stackoverflow.com/a/23878885
has body: I made 3 objects with same reference variable and stored all of them in array, When I print those reference variable all of them show different addresses.I was told if some object loose its reference variable GC removes it from heap, so how come same reference variable showing up 3 difference location, GC did not work? there are actually 3 objects in heap or same reference variable has 3 memory address class MyClass { public static void main(String[] args) { MyClass[] i = new MyClass[3]; for (int j = 0; j &lt;= 2; j++) { MyClass p = new MyClass(); i[j] = p; } for (int k = 0; k &lt;= 2; k++) { System.out.println(i[k]); } } } Output : [shadow@localhost String]$ javac MyClass.java [shadow@localhost String]$ java MyClass MyClass@138532dc MyClass@dce1387 MyClass@54640b25 [shadow@localhost String]$
score: -1
tagged with: java
tagged with: garbage-collection
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/23878869
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36758642

http://stackoverflow.com/comment/36781089
comment on: http://stackoverflow.com/a/23890013
type: AnswerComment
score: 0
type: Comment
has text: @gstackoverflow Each element of the skip list has 1 or more 'levels' to it. Each level connects to the next element that has at least the same number of levels. In my picture, element 1 has 4 levels - the bottom level connects to element 2, the second level connects to element 3 (because element 2 is only one level), level 3 connects to element 4 (because element 3 only is 2 levels high) and level 4 connects to the terminator (because no other elements are 4 levels high). Each level is a linked list of its own.

http://stackoverflow.com/comment/54218954
score: 7
type: AnswerComment
comment on: http://stackoverflow.com/a/23811953
type: Comment
has text: Can't really understand the nature of the problem, but I can confirm that I've also fixed it defining the interface in a different file. Thanks. +1

http://stackoverflow.com/comment/36854545
type: QuestionComment
type: Comment
has text: Then your problem is not with session. You should redirect to action from your welcome page.
comment on: http://stackoverflow.com/q/23844765
score: 0

http://stackoverflow.com/comment/36646402
has text: Weird. I found this about AFMParser: "This class is used to parse AFM(Adobe Font Metrics) documents". I'm not sure what this has to do with JFreeChart or anything in your example.
type: AnswerComment
comment on: http://stackoverflow.com/a/23819595
score: 0
type: Comment

http://stackoverflow.com/a/35784589
has comment: http://stackoverflow.com/comment/64616601
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23870478
has comment: http://stackoverflow.com/comment/87660334
downvote count: 3
has comment: http://stackoverflow.com/comment/138638309
score: -2
has comment: http://stackoverflow.com/comment/59240690
has body: public static boolean isLambda(Object obj) { return obj.getClass().toString().contains("$$Lambda$"); }

gmail
type: Tag
tags question: http://stackoverflow.com/q/23823156
tag name: gmail

http://stackoverflow.com/q/23797939
has comment: http://stackoverflow.com/comment/36625041
answer count: 1
has body: I have created an index named synonym_index using curl command I tried the following in JAVA API this.connection.admin().indices().prepareClose("synonym_index").execute().actionGet(); this.connection.admin().indices().prepareUpdateSettings("synonym_index").setSettings(settings).execute().actionGet(); this.connection.admin().indices().prepareOpen("synonym_index").execute().actionGet(); this.connection.admin().indices().prepareDeleteMapping("synonym_index").setType("courses").execute().actionGet(); this.connection.admin().indices().preparePutMapping("synonym_index").setType("courses").setSource(mappings).execute().actionGet(); it didn't work!! Also all my documents in the index are getting deleted !!!! Where am I going wrong?? Any ideas??
tagged with: elasticsearch
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23830956
type: Question
has comment: http://stackoverflow.com/comment/36657252
has title: Is it possible to update settings and mappings of an index in elasticsearch at runtime using JAVA API
tagged with: java
has answer: http://stackoverflow.com/a/23830956
score: 0

http://stackoverflow.com/comment/36619884
type: Comment
has text: Probably, your string starts with a null character (ASCII 0).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23802098

http://stackoverflow.com/comment/36813822
has text: But my Heap Size is still remain at its maximum 248MB
comment on: http://stackoverflow.com/a/23907376
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36823930
comment on: http://stackoverflow.com/q/23912510
type: Comment
type: QuestionComment
has text: Okay so Desktop.browse() let's me open a browser to a specific url. Can I execute some javascript after I browsed to a website?
score: 0

http://stackoverflow.com/comment/36752068
type: Comment
type: QuestionComment
has text: Jorge_B, weston: code for loadDrawingFromFile is way too big (lots of user-interface and display management), so it wouldn't be helpful to post. Important point is that it opens the data file, creates lots of data structures (char, TreeSets, strings, etc.), then closes the file.
score: 0
comment on: http://stackoverflow.com/q/23875078

http://stackoverflow.com/comment/36841053
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23921802
has text: @MadProgrammer yes I have tried calling sw.createsubtitle() and I put it in a JLabel and it does display it but the problem is that when you flip through images using the scrollbar it doesn't update the subtitle. So if you are on 1/105 and you go to the 3rd image then the subtitle should be updated to 3/105 but it doesn't get updated. So thats why I tried using the paint or draw component.
score: 0

http://stackoverflow.com/q/23869755
favorite count: 0
tagged with: cdi
has comment: http://stackoverflow.com/comment/36741112
answer count: 0
type: UnansweredQuestion
tagged with: performance
downvote count: 0
score: 1
tagged with: java
has body: What are those situations in which is better to inject an instance of a generic object through CDI than to instantiate through SomeObject newObject = new SomeObject() ? With look at performance, architecture, modularity, instance reusability, caching, transactions, etc etc... Thank you!
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/13047807
has title: When is better to @Inject a CDI than to instantiate a
duplicate of: http://stackoverflow.com/q/13047807
has comment: http://stackoverflow.com/comment/36741501
upvote count: 1

http://stackoverflow.com/q/23851962
has body: Here is my Android Media player code. I don't know what I am missing in this code, when I run with breakpoint at line MediaPlayer mp = new MediaPlayer() in Debug mode. All the files in zip folder is played. But when I run the application in normal mode the first file is played and then I get this error: android.app.SuperNotCalledException: Activity {com.example.mediaplayer/com.example.mediaplayer.MainActivity} did not call through to super.onCreate() Code: package com.example.mediaplayer; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.commons.io.IOUtils; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.widget.Button; public class MainActivity extends Activity { private MediaPlayer mp; private static final String MAIN_TAG ="ERROR"; @Override protected void onCreate(Bundle savedInstanceState) { try { //final String file_loc= Environment.getExternalStorageDirectory().toString(); //Log.i("location",file_loc); ZipFile zip = new ZipFile("/storage/emulated/0/AjeshDocument/sample.zip"); for(int i=1;i&lt;7;i++){ ZipEntry entry = zip.getEntry("sample/rihanna_"+i+".mp3"); if (entry != null) { InputStream in = zip.getInputStream(entry); // see Note #3. File tempFile = File.createTempFile("_AUDIO_", ".wav"); FileOutputStream out = new FileOutputStream(tempFile); IOUtils.copy(in, out); // do something with tempFile (like play it) File f = tempFile; try { if (f.exists()) { Log.i(MAIN_TAG,"Audio file found!"); MediaPlayer mp = new MediaPlayer(); FileInputStream fis = new FileInputStream(f); mp.setDataSource(fis.getFD()); mp.prepare(); //mp.setLooping(false); mp.start(); //mp.stop(); // mp.release(); Log.i(MAIN_TAG,"Pronounciation finished!"); } else { Log.i(MAIN_TAG,"File doesn't exist!!"); } } catch (…
answer count: 1
tagged with: android-activity
favorite count: 0
has title: android.app.SuperNotCalledException: Activity did not call through to super.onCreate()
tagged with: android
accepted answer: http://stackoverflow.com/a/23851979
type: AnsweredQuestion
score: 4
tagged with: java
downvote count: 1
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/93186631
has answer: http://stackoverflow.com/a/23851979

http://stackoverflow.com/comment/52783893
comment on: http://stackoverflow.com/q/23919468
type: Comment
has text: @adapt-dev no, I didn't.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36773745
has text: Is the package really exported by the bundle you installed? If yes then the error can not happen. Perhaps the package version of the exported package does not match the import range you specified.
score: 1
comment on: http://stackoverflow.com/a/23881895
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23826929
has answer: http://stackoverflow.com/a/23827421
upvote count: 2
duplicate of: http://stackoverflow.com/q/7569335
accepted answer: http://stackoverflow.com/a/23827021
has comment: http://stackoverflow.com/comment/36659066
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23826995
has comment: http://stackoverflow.com/comment/36659262
type: Question
linked to: http://stackoverflow.com/q/7569335
tagged with: algorithm
has body: I recently attended an interview where I was asked to write a program. The problem was: Take a string. "Hammer", for example. Reverse it and any character should not be repeated. So, the output will be - "remaH". This is the solution I gave: public class Reverse { public static void main(String[] args) { String str = "Hammer"; String revStr = ""; for(int i=0; i&lt;=str.length()-1;i++){ if(revStr.indexOf(str.charAt(i))==-1){ revStr = str.charAt(i)+revStr; } } System.out.println(revStr); } } How I can improve the above?
has comment: http://stackoverflow.com/comment/36659138
has comment: http://stackoverflow.com/comment/36660058
answer count: 3
has title: Improving this code for reversing the string and removing duplicate characters
downvote count: 0
has comment: http://stackoverflow.com/comment/36659159
has comment: http://stackoverflow.com/comment/36659156
possible better answer: http://stackoverflow.com/a/23827421
has comment: http://stackoverflow.com/comment/36660114
has answer: http://stackoverflow.com/a/23827021
favorite count: 0

http://stackoverflow.com/q/23851599
accepted answer: http://stackoverflow.com/a/23851612
upvote count: 0
tagged with: variables
answer count: 1
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/36706992
has comment: http://stackoverflow.com/comment/36707002
has title: Issue in simple program with variables/parameters
type: AnsweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23851612
type: Question
has body: I am writing a simple program for fun. I am new to programming, and am not sure how to fix this problem. The problem is in the printWord method. Not sure what to put in the parentheses to make it work. Having Word, does not work. Here's my code:`public class getWord { /** * @param args the command line arguments */ public static void main(String[] args) { getWordFromUser("Enter a random word!"); printWord(Word); } /** * gets a Word From the User */ public static String getWordFromUser(String prompt){ Scanner sc = new Scanner(System.in); System.out.println(prompt); return sc.nextLine(); } /** * Prints the random word that the user has entered * @param Word */ public static void printWord(String Word){ System.out.println("The word you have entered is " + Word); } } Thanks for the help!

http://stackoverflow.com/comment/36770727
type: QuestionComment
comment on: http://stackoverflow.com/q/23884973
has text: @Charvee does JSONArray have such a method? http://developer.android.com/reference/org/json/JSONArray.html
score: 0
type: Comment

http://stackoverflow.com/comment/36818500
type: QuestionComment
type: Comment
has text: See https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java#L1557 that is the inner class used when using one of the `query` methods. If you get a new statement or not also depends on your jdbc driver and if it caches statements.
score: 0
comment on: http://stackoverflow.com/q/23910354

bytecode
tags question: http://stackoverflow.com/q/23879723
type: Tag
tags question: http://stackoverflow.com/q/23938388
tags question: http://stackoverflow.com/q/23906885
tag name: bytecode
tags question: http://stackoverflow.com/q/23787068
tags question: http://stackoverflow.com/q/23935081

http://stackoverflow.com/comment/116807118
comment on: http://stackoverflow.com/a/38806828
has text: The PPDocument need to be closed after usage.
type: AnswerComment
type: Comment
score: 1

javabeans
tags question: http://stackoverflow.com/q/23867539
tags question: http://stackoverflow.com/q/23786226
tags question: http://stackoverflow.com/q/23808665
type: Tag
tags question: http://stackoverflow.com/q/23785816
tags question: http://stackoverflow.com/q/23794482
tags question: http://stackoverflow.com/q/23909465
tags question: http://stackoverflow.com/q/23809885
tag name: javabeans
tags question: http://stackoverflow.com/q/23799298

http://stackoverflow.com/comment/36852994
score: 0
type: Comment
type: QuestionComment
has text: I give you a possible solution as an answer... however I'm not sure that this can work, just try it :).
comment on: http://stackoverflow.com/q/23915388

http://stackoverflow.com/a/23843389
type: Answer
answers question: http://stackoverflow.com/q/23824633
downvote count: 0
score: 1
type: AcceptedAnswer
has body: I think the problem is due to the prefix classpath:: where did you find that you have to use it? You might find useful understanding how to initialize VelocityEngine reading Loading velocity template inside a jar file and how Configuring Resource Loaders in Velocity.
accepted answer of: http://stackoverflow.com/q/23824633
upvote count: 1

http://stackoverflow.com/q/23782628
score: 1
tagged with: java
has title: Sending an email with inline picture on App Engine since 1.9.0
upvote count: 1
possible better answer: http://stackoverflow.com/a/23783230
type: Question
tagged with: jakarta-mail
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23782992
accepted answer: http://stackoverflow.com/a/23782992
has answer: http://stackoverflow.com/a/23783230
favorite count: 0
tagged with: google-app-engine
type: AnsweredQuestion
has body: I am currently trying to send an email with a picture inside the mail using the Google App Engine 1.9.5. This features is availible only from the version 1.9.0 of the SDK : Users now have the ability to embed images in emails via the Content-Id attachment header. https://code.google.com/p/googleappengine/issues/detail?id=965 https://code.google.com/p/googleappengine/issues/detail?id=10503 Source : https://code.google.com/p/googleappengine/wiki/SdkForJavaReleaseNotes This is my code : Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("leo.mieulet@xxx.com", "xxx.com newsletter")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("leo.mieulet@xx.com", "Leo Mieulet")); msg.setSubject("Inline image test : "+new Date().getTime()); String imageCid = "graph"; DataSource ds = new ByteArrayDataSource(imageBase64, "image/png"); MimeBodyPart imagePart = new MimeBodyPart(); imagePart.setDataHandler(new DataHandler(ds)); imagePart.setFileName(imageCid + ".png"); imagePart.setHeader("Content-Type", "image/png"); imagePart.addHeader("Content-ID", "&lt;" + imageCid + "&gt;"); String htmlBody = "My html text... &lt;img src=\"cid:"+imageCid+"\"&gt; ... ends here."; // Create alternate message body. MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setContent("&lt;html&gt;&lt;body&gt;"+htmlBody+"&lt;/body&gt;&lt;/html&gt;", "text/html"); final Multipart multipart = new MimeMultipart(); multipart.addBodyPart(htmlPart); multipart.addBodyPart(imagePart); msg.setContent(multipart); msg.saveChanges(); Transport.send(msg); I receive an email which looks like : Could anyone help me with the problem ?

http://stackoverflow.com/comment/36769679
type: Comment
comment on: http://stackoverflow.com/a/23883761
type: AnswerComment
has text: do you mean `double CommisionPrice = Commission(InitialCost );`? Look at the function signature for `Commission` : `public static double Commission(double value )`, it needs only 1 argument.
score: 0

http://stackoverflow.com/q/23901494
type: AnsweredQuestion
tagged with: spring-data
type: Question
accepted answer: http://stackoverflow.com/a/24627785
tagged with: java
has body: I know Spring Data Common supports queries(methods in the repository) with operators such as Between, LessThan, GreaterThan, Like for the property expressions. I am wondering if these operators are also supported in Data Rest? If supported, what do the Rest API URLs look like when these operators are used. For example, if I need to query people whose age is between 20 and 30. Query in repository should be List&lt;Person&gt; findByAgeBetween(Long min, Long max); But what is the URL? I couldn't find anything related to this question in the spring reference.
upvote count: 4
tagged with: spring-data-rest
answer count: 3
has answer: http://stackoverflow.com/a/23904294
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/24622752
has title: Does Spring Data Rest support Spring Data's expression operators, eg. Between, GreaterThan?
score: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/23904294
has answer: http://stackoverflow.com/a/24627785
tagged with: spring

http://stackoverflow.com/a/24580996
type: Answer
score: 1
has body: Just a guess, but maybe you need to different version of HSrts-ghc-7.6.3 since this is a "non-standard" build.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23800358

http://stackoverflow.com/a/23908307
type: Answer
answers question: http://stackoverflow.com/q/23908184
has comment: http://stackoverflow.com/comment/36815959
score: 0
has body: I would work with the BufferedReader. Because it reads a whole line. And then you can split the line by a delimiter (lets say a space " " ). In your case I would write a split-method which receives a String and search for the regex you want.

http://stackoverflow.com/comment/36650020
has text: @user3580294 it is possible dude.
comment on: http://stackoverflow.com/q/23821813
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23843110
downvote count: 0
has comment: http://stackoverflow.com/comment/36690903
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/6184335
score: 2
has body: I'm writing Properties to a file like so: final Properties props = new Properties(); final FileOutputStream fileStream = new FileOutputStream("test.properties"); props.setProperty("name", "foo); props.setProperty("age", "123"); props.store(fileStream, null); Which works as expected but I also get a date comment at the top: #Sat May 24 09:46:30 BST 2014 I can see where this is added from the store0 method that gets called in Properties, but is there anyway I can turn it off?
answer count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/6184335
tagged with: java
type: Question
has title: Turn off date comment in properties file

http://stackoverflow.com/comment/36651044
type: AnswerComment
comment on: http://stackoverflow.com/a/23814952
score: 0
type: Comment
has text: It's hard to say since I don't know what you want to do with them, or how you're planning to use them. So the explanation is very general If you have them in the session you don't have to access them just to pass them to next page, they are already there. Because it looked like they were just unused variables that consumes extra resources.

http://stackoverflow.com/comment/36733352
has text: Use ` for `embedded` code and 4-space indentation for blocks
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23865546

http://stackoverflow.com/comment/36637302
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23814709
has text: Oh great hear that it works on your machine. I have to find out, may be you are right.

http://stackoverflow.com/comment/36772217
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23883761
has text: Or did you mean this line? double TotalCost = coupon(CommisionPrice, Coupon, PostPrices, state );

http://stackoverflow.com/q/23896235
has comment: http://stackoverflow.com/comment/36792104
tagged with: android
has answer: http://stackoverflow.com/a/23896404
upvote count: 1
linked to: http://stackoverflow.com/q/7729133
has body: I want to be able to use url's as image sources. I have found the following function to convert to bitmaps. However, I get a "NetworkOnMainThreadException." Using the Log i found that conn.connect(); , is what is where the functions crashes. I also found that because of the exception I should use an AsyncTask class extension. So I used it in the second section of code below. I still ended up with the same exception. I don't completely understand what the error means just that I am trying to do too many things in the same place at the same time. Is there an easier way to turn a url into an image I can use? How can I fix the functions I have now? public static Bitmap getImageBitmap(String url) { Log.i("bitmap","here?"); Bitmap bm = null; Log.i("bitmap","here?"); try { Log.i("bitmap","here?"); URL aURL = new URL(url); Log.i("bitmap","here?"); URLConnection conn = aURL.openConnection(); Log.i("bitmap","last ?"); conn.connect(); Log.i("bitmap","here?"); InputStream is = conn.getInputStream(); Log.i("bitmap","here?"); BufferedInputStream bis = new BufferedInputStream(is); Log.i("bitmap","here?"); bm = BitmapFactory.decodeStream(bis); bis.close(); Log.i("bitmap","here?"); is.close(); Log.i("bitmap","here?"); } catch (IOException e) { Log.e("img", "Error getting bitmap", e); } return bm; } With AsyncTask: class taskRunner extends AsyncTask&lt;String, URL, Bitmap&gt;{ public static Bitmap getImageBitmap(String url) { Log.i("bitmap","here?"); Bitmap bm = null; Log.i("bitmap","here?"); try { Log.i("bitmap","here?"); URL aURL = new URL(url); Log.i("bitmap","here?"); URLConnection conn = aURL.openConnection(); Log.i("bitmap","last ?"); conn.connect(); Log.i("bitmap","here?"); InputStream is = conn.getInputStream(); Log.i("bitmap","here?"); BufferedInputStream bis = new BufferedInputStream(is); Log.i("bitmap","here?"); bm = BitmapFactory.decodeStream(bis); bis.close(); Log.i("bitmap","here?"); is.close(); Log.i("bitmap","here?"); } catch (IOException e) { Log.e("img", "Error gett…
tagged with: java
downvote count: 3
type: Question
score: -2
has title: How do I programmatically add images to my android app
has comment: http://stackoverflow.com/comment/36792050
tagged with: image
linked to: http://stackoverflow.com/q/3090650
answer count: 1
tagged with: url
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37103638
type: Comment
comment on: http://stackoverflow.com/a/23789110
has text: Just remembered this... You might be interested in [this question](http://codereview.stackexchange.com/q/52454/9735). Getting the "Java Concurrency in Practice" book is always a good idea.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23823007
answers question: http://stackoverflow.com/q/23822957
score: 0
type: Answer
has body: The method addRow needs an Object[]. You give him a Object. Try model.addRow(data);

http://stackoverflow.com/comment/36624993
type: Comment
type: QuestionComment
has text: I don't think it is related to id generation. Think one session locking your records while other session waiting and falls with timeout. What I can suggest: 1. Do update with select condition in single query; 2. If #1 is not possible select ids, close session and then do update by selected ids
comment on: http://stackoverflow.com/q/23798971
score: 0

svd
type: Tag
tags question: http://stackoverflow.com/q/23860569
tag name: svd

http://stackoverflow.com/a/23961057
type: Answer
answers question: http://stackoverflow.com/q/23800416
has body: The type of variable expansion you are asking for can only be performed by the build step itself. If this is your own plug-in then you can apply the change I suggest here, otherwise you can always ask the plug-in author to do so. Short of either you'll have to rely on the work-around Slav provided. If you do have access to the source for the plug-in here's how to expand variables during execution of the build step. I assume the build step class is SanityTestResultsToJUnitXMLBuilder. Inside this class's perform method you need to expand the source and destination directory fields. I added place holders for other pieces of code you'd normally find in a build step for brevity. public class SanityTestResultsToJUnitXMLBuilder extends Builder { private final String sourceDirectory; private final String destinationDirectory; /* Constructor and getters typically appear here. */ @Override public void perform(AbstractBuild&lt;?, ?&gt; build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars environment = build.getEnvironment(listener); String expandedSourceDirectory = environment.expand(sourceDirectory); String expandedDestinationDirectory = environment.expand(destinationDirectory); /* The rest of the perform() logic goes here */ } /* Other methods typically appear here. */ /* The Descriptor typically appears here. */ }
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/52868562
score: 0
has text: Third party methods do what they want. There is no guarantee that any third party method will obey any standard procedure. This thread is 16 months old, you're a bit late to the party.
type: AnswerComment
comment on: http://stackoverflow.com/a/23973780
type: Comment

http://stackoverflow.com/a/23839619
has comment: http://stackoverflow.com/comment/36683963
answers question: http://stackoverflow.com/q/23839544
has comment: http://stackoverflow.com/comment/36683926
has body: You should keep track of when the keys are released. If up is never released, you know it's still being held. If right is never released, you know it's still being held. Each update, you can check if both are down and react accordingly.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36684006

http://stackoverflow.com/a/23902548
type: Answer
has body: You need to keep track of everything that has been painted and then repaint everything again. See Custom Painting Approaches for the two common ways to do this: Use a ArrayList to keep track of objects painted Use a BufferedImage here is an exemple of code you can use : ArrayList&lt;Point&gt; points = new ArrayList&lt;Point&gt;(); private void draw(Graphics g){ for (Point p: this.points){ g.fillOval(1, 2, 2, 2); } } //after defining this function you add this to your paint function : draw(g) g.drawRect(x1, y1, x2-x1, y2-y1); points.add(new Point(x1, y1, x2-x1, y2-y1)) // PS : point is a class I created to refer to a point, but you can use whatever
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23902382

http://stackoverflow.com/comment/36867319
type: Comment
type: QuestionComment
score: 0
has text: In the tutorial above there is no mentioning of any such step being necessary. For Windows, it seems that the binaries are already built and just need to be imported. Am I wrong?
comment on: http://stackoverflow.com/q/23922005

http://stackoverflow.com/a/23938381
has comment: http://stackoverflow.com/comment/36872103
has body: I'm not sure about your experience with Java language. But why don't you create a static variable in class? So, for example: class A { public static Map&lt;String, String&gt; globalMap; } From class B you could access or set it anywhere(ofcourse you need to import the class A at the top): class B { public void doAnything(){ Map anyMap&lt;String, String&gt; anyMap = new HashMap&lt;String, String&gt;(); anyMap.put("anyString", "anyString"); A.globalMap = anyMap; } }
score: 0
answers question: http://stackoverflow.com/q/23938060
type: Answer

http://stackoverflow.com/q/23916858
has title: What is an efficient way to stop a thread indefinitely?
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/10961714
tagged with: java
tagged with: multithreading
has body: Right now, I am currently making a marbles game where two players try and shoot their marbles into a circle. The player with more marbles in the circle wins. The player whose turn it is will click and drag in the opposite direction of which they want the ball to move (sort of like a sling shot). In my Marble class, there is a thread which starts when the mouse click is released. The marble will move and bounce off the walls, slowly reaching a X and Y velocity of zero. When this happens though, my thread continues looping and eating through the computers CPU. You can tell that the thread is still running because it continues printing out the velocity even when the ball has stopped moving. I need help trying to figure out a efficient way of stopping the thread without using the Thread class's stop() method. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Ball { float x, y, lastX, lastY; int width, height; float xVelocity, yVelocity; float speed; public Ball() { width = (int) (Math.random() * 50 + 10); height = (int) (Math.random() * 50 + 10); x = (float) (Math.random() * (Marble.gamePanel.getWidth() - width) + width/2); y = (float) (Math.random() * (Marble.gamePanel.getHeight() - height) + height/2); lastX = x; lastY = y; xVelocity = (float) Math.random() * speed*2 - speed; yVelocity = (float) Math.random() * speed*2 - speed; } public void update() { lastX = x; lastY = y; x += xVelocity; y += yVelocity; if(x + width/2 &gt;= Marble.gamePanel.getWidth()) { xVelocity *= -0.75; x = Marble.gamePanel.getWidth() - width/2; } else if (x - width/2 &lt;= 0) { xVelocity *= -0.75; x = width/2; } if (y + height/2 &gt;= Marble.gamePanel.getHeight()) { yVelocity *= -0.75; y = Marble.gamePanel.getHeight() - height/2; } else if (y - height/2 &lt;= 0) { yVelocity *= -0.75; y = height/2; } } } import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.List; import java.util.ArrayList; /** * Write a description of class Marble here. …
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23917037
has comment: http://stackoverflow.com/comment/36831448
has answer: http://stackoverflow.com/a/23917349
answer count: 2
has comment: http://stackoverflow.com/comment/36831029
downvote count: 0
possible better answer: http://stackoverflow.com/a/23917349
favorite count: 0
has answer: http://stackoverflow.com/a/23917037

http://stackoverflow.com/comment/36572284
has text: @AndreiI that was because the answer didn't explained the purpose of having getters/setters to follow this specification, the *this* was for the state of the answer (in that moment).
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23779799

http://stackoverflow.com/q/23864045
tagged with: cardlayout
tagged with: border-layout
has comment: http://stackoverflow.com/comment/36732570
score: 0
answer count: 1
tagged with: layout-manager
has title: How can i put BorderLayout in CardLayout?
has comment: http://stackoverflow.com/comment/36730835
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36732180
has body: Question can be incorrect, but i don't know how to ask correctly. I am sorry for that. Here the problem: My JFrame has CardLayout as the layout manager. I have three JPanel's and I switching between them. Everything was good until i had to add 2 JPanel's into one of them. Now one of my JPanel's should include two another JPanel's. I read somewhere that it is posible. So this JPanel should have BorderLayout. There how it should be: Here is what i had before: my JFrame class: public class JavaGame2 extends JFrame { public JavaGame2(){ CardLayout layout = new CardLayout(); setLayout(layout); GameController controller = new CardLayoutGameController(getContentPane(), layout); gamePanel = new GamePanel(controller); menuPanel = new MenuPanel(controller); lvlPanel = new LvlEndPanel(controller); add(gamePanel, CardLayoutGameController.GAME_PANEL); add(menuPanel, CardLayoutGameController.MENU_PANEL); add(lvlPanel, CardLayoutGameController.LEVEL_PANEL); controller.showMenu(); } CardLayoutGameController which is switching all JPanel's: public class CardLayoutGameController implements GameController { public static final String GAME_PANEL = "GamePanel"; public static final String MENU_PANEL = "MenuPanel"; public static final String LEVEL_PANEL = "LvlPanel"; private Container container; private CardLayout cardLayout; public CardLayoutGameController(Container parent, CardLayout layout) { container = parent; cardLayout = layout; } @Override public void showMenu() { cardLayout.show(container, MENU_PANEL); } @Override public void showGame() { cardLayout.show(container, GAME_PANEL); } @Override public void showEndLvl(){ cardLayout.show(container, LEVEL_PANEL); } } Then I added two JPanel classes InterfacePanel and GameMainPanel(which should include this InterfacePanel and my old GamePanel) How it looks like now: UPD runable example: runable class: public class Mcve extends JFrame { private GamePanel gamePanel; private LvlEndPanel lvlPanel; private GameMainPanel gameMainPanel; Mcve(){ …
has answer: http://stackoverflow.com/a/23864094
tagged with: java
has comment: http://stackoverflow.com/comment/36732244
type: Question

http://stackoverflow.com/q/23855677
tagged with: volatile
linked to: http://stackoverflow.com/q/21283293
has title: Volatile reference to mutable object - will updates to the object's fields be visible to all threads
accepted answer: http://stackoverflow.com/a/23856974
upvote count: 15
favorite count: 0
has comment: http://stackoverflow.com/comment/36717906
tagged with: multithreading
linked to: http://stackoverflow.com/q/18030570
linked to: http://stackoverflow.com/q/4614331
has answer: http://stackoverflow.com/a/23856974
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23855704
has comment: http://stackoverflow.com/comment/36716093
downvote count: 0
has comment: http://stackoverflow.com/comment/36717962
has answer: http://stackoverflow.com/a/23855704
tagged with: java
has comment: http://stackoverflow.com/comment/36715677
has body: ... without additional synchronization ? The Tree class below is meant to be accessed by multiple threads (it is a singleton but not implemented via an enum) class Tree { private volatile Node root; Tree() { root = new Node(); // the threads are spawned _after_ the tree is constructed } private final class Node { short numOfKeys; } } Will updates to the numOfKeys field be visible to reader threads without any explicit synchronization (notice that both readers and writers have to acquire an instance of ReentrantReadWriteLock - same instance for each node - but barring that) ? If not would making numOfKeys volatile suffice ? Is changing the root as simple as root = new Node() (only a writer thread would change the root, apart from the main thread which calls the Tree constructor) Related: multiple fields: volatile or AtomicReference? Is volatile enough for changing reference to a list? Are mutable fields in a POJO object threadsafe if stored in a concurrentHashMap? Using volatile keyword with mutable object EDIT: interested in post Java 5 semantics
type: Question
tagged with: java-memory-model
score: 15
linked to: http://stackoverflow.com/q/21466171
answer count: 2

http://stackoverflow.com/comment/36709441
type: Comment
comment on: http://stackoverflow.com/q/23852922
score: 0
has text: Yes show us full code
type: QuestionComment

http://stackoverflow.com/q/23841301
tagged with: java
score: 17
has body: I had a lot of issues getting Super Dev mode to work with IntelliJ. This question, and my answer below, are to document how to do this, for anyone else who might come across this in future (and for my own reference):
has answer: http://stackoverflow.com/a/23841302
has answer: http://stackoverflow.com/a/25201243
has title: How to get GWT Super Dev Mode to work with IntelliJ
answer count: 3
tagged with: intellij-idea
downvote count: 0
upvote count: 17
favorite count: 0
accepted answer: http://stackoverflow.com/a/25942154
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23841302
tagged with: gwt-super-dev-mode
has answer: http://stackoverflow.com/a/25942154
type: Question
tagged with: gwt

http://stackoverflow.com/comment/38248715
has text: @Alex Even more stupidly, flip() isn't reversible. Very poor choice of name. The idea is to use the state of your program to know the state of the buffer.m or keep them in read state except transiently as per my answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23933439
type: Comment

mapreduce
tags question: http://stackoverflow.com/q/23823741
tags question: http://stackoverflow.com/q/23859699
type: Tag
tags question: http://stackoverflow.com/q/23828393
tags question: http://stackoverflow.com/q/23908191
tags question: http://stackoverflow.com/q/23826007
tags question: http://stackoverflow.com/q/23822428
tag name: mapreduce
tags question: http://stackoverflow.com/q/23834319
tags question: http://stackoverflow.com/q/23872677
tags question: http://stackoverflow.com/q/23896086
tags question: http://stackoverflow.com/q/23868022
tags question: http://stackoverflow.com/q/23784215
tags question: http://stackoverflow.com/q/23779976

antlr4
tags question: http://stackoverflow.com/q/23887888
tags question: http://stackoverflow.com/q/23913889
type: Tag
tag name: antlr4

http://stackoverflow.com/a/23888928
type: AcceptedAnswer
downvote count: 0
has body: You can't as that would give variable numbers of columns for the rows returned. You can do a fiddle with GROUP_CONCAT:- SELECT doctorname, aday, GROUP_CONCAT(CONCAT_WS('~', availfrom, availupto) SEPARATOR '#') avail_time_slots FROM sometable GROUP BY doctname, aday Then in code you would need to split up the avail_time_slots
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23888154
upvote count: 2
answers question: http://stackoverflow.com/q/23888154
has comment: http://stackoverflow.com/comment/36780270
has comment: http://stackoverflow.com/comment/36779713

soa
type: Tag
tags question: http://stackoverflow.com/q/23906646
tag name: soa

http://stackoverflow.com/comment/36759233
comment on: http://stackoverflow.com/a/23879135
score: 0
type: Comment
has text: Very good answer. This is breadth-first search. I suggest using a HashSet or a 2D boolean array rather than a list for the closed list, since you only need to be able to check whether it has been processed before.
type: AnswerComment

http://stackoverflow.com/comment/36790021
score: 0
comment on: http://stackoverflow.com/q/23895174
type: Comment
type: QuestionComment
has text: if you're reading from a file and writing to another, I can't see a problem.

http://stackoverflow.com/q/23898973
has comment: http://stackoverflow.com/comment/36797751
has comment: http://stackoverflow.com/comment/36797701
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2007666
has answer: http://stackoverflow.com/a/23899183
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36797894
has title: Examples of why we need initialization blocks
type: Question
possible better answer: http://stackoverflow.com/a/23899183
answer count: 2
has body: I was going through this topics: In what order do static initializer blocks in Java run? Java Static Initialization Order And I don't understand if we have a constructors, where we can put some logic, such as dealing with exceptional situations, why we need initialization blocks, which code we can also move to constructor ? If the answer is that in some cases we need to initialize some resources before constructor runs would you help me with some examples, so I could fully see the picture.
has comment: http://stackoverflow.com/comment/36797911
has answer: http://stackoverflow.com/a/23899508
has comment: http://stackoverflow.com/comment/36798104
has comment: http://stackoverflow.com/comment/36798092
tagged with: block
has comment: http://stackoverflow.com/comment/36798001
linked to: http://stackoverflow.com/q/19058766
accepted answer: http://stackoverflow.com/a/23899508
linked to: http://stackoverflow.com/q/18883646
tagged with: initialization
favorite count: 0
has comment: http://stackoverflow.com/comment/36798018
upvote count: 2
downvote count: 1

http://stackoverflow.com/comment/36798018
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23898973
has text: @Pshemo well, I find your example as a good example to not use initialization blocks but instead builder pattern :P
score: 0

http://stackoverflow.com/comment/36765615
comment on: http://stackoverflow.com/q/23882518
has text: Its already answered by @DirkLachowski Collate and sort
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/46564820
type: QuestionComment
type: Comment
has text: if you use a try/catch around the accept alert code you have and then don't do anything with the exception it would attempted to close the popup anywhere you need to, but if the popup isn't there your test won't error. not the best practice, but depending on what you're going for it could work.
score: 0
comment on: http://stackoverflow.com/q/23883071

http://stackoverflow.com/comment/36868102
has text: Yes, by natural order.
comment on: http://stackoverflow.com/a/23936740
type: AnswerComment
score: 0
type: Comment

algorithm
tags question: http://stackoverflow.com/q/23914892
tags question: http://stackoverflow.com/q/23826929
tags question: http://stackoverflow.com/q/23862863
tags question: http://stackoverflow.com/q/23918737
tags question: http://stackoverflow.com/q/23866888
tag name: algorithm
tags question: http://stackoverflow.com/q/23879042
tags question: http://stackoverflow.com/q/23850725
tags question: http://stackoverflow.com/q/23907390
tags question: http://stackoverflow.com/q/23916157
tags question: http://stackoverflow.com/q/23902842
tags question: http://stackoverflow.com/q/23929774
tags question: http://stackoverflow.com/q/23862207
tags question: http://stackoverflow.com/q/23898464
tags question: http://stackoverflow.com/q/23805282
tags question: http://stackoverflow.com/q/23830640
tags question: http://stackoverflow.com/q/23894252
tags question: http://stackoverflow.com/q/23791086
tags question: http://stackoverflow.com/q/23915723
type: Tag
tags question: http://stackoverflow.com/q/23887227
tags question: http://stackoverflow.com/q/23884594
tags question: http://stackoverflow.com/q/23845398
tags question: http://stackoverflow.com/q/23905748
tags question: http://stackoverflow.com/q/23794575
tags question: http://stackoverflow.com/q/23804645
tags question: http://stackoverflow.com/q/23876524
tags question: http://stackoverflow.com/q/23916936
tags question: http://stackoverflow.com/q/23800685
tags question: http://stackoverflow.com/q/23919879
tags question: http://stackoverflow.com/q/23887860

http://stackoverflow.com/a/23804829
has comment: http://stackoverflow.com/comment/36617383
downvote count: 0
has comment: http://stackoverflow.com/comment/36629013
has body: Try this (which uses the default JVM locale): DateFormat df = new SimpleDateFormat("'Today is 'MMM dd, yyyy' and it is 'HH:mm"); System.out.println(df.format(new Date())); If you need a different locale you can force it like follows: DateFormat df = new SimpleDateFormat("'Today is 'MMM dd, yyyy' and it is 'HH:mm", new Locale("en")); System.out.println(df.format(new Date())); Or you can update the locale of the JVM to override the system one: how do I set the default locale for my JVM?
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36617149
answers question: http://stackoverflow.com/q/23804371
upvote count: 2
has comment: http://stackoverflow.com/comment/36617491
has comment: http://stackoverflow.com/comment/36618235

http://stackoverflow.com/comment/36774487
type: QuestionComment
type: Comment
has text: What is the line (Fragment00.java:32)?
comment on: http://stackoverflow.com/q/23887325
score: 0

http://stackoverflow.com/comment/36720813
comment on: http://stackoverflow.com/q/23858751
score: 0
type: Comment
type: QuestionComment
has text: @Isaac I guess that he gets it on em.createQuery(), because EntityManager is not injected.

http://stackoverflow.com/comment/36708677
comment on: http://stackoverflow.com/a/23852535
score: 1
has text: Um...no. That doesn't fix the issue.
type: AnswerComment
type: Comment

sensors
type: Tag
tags question: http://stackoverflow.com/q/23857692
tag name: sensors

http://stackoverflow.com/q/23812996
has answer: http://stackoverflow.com/a/23813092
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23813136
type: UnansweredQuestion
tagged with: oop
has title: Java OOP : How to design the situation where an attribute value would decide the class of another attribute?
tagged with: java
has answer: http://stackoverflow.com/a/23813166
type: Question
has body: Let's consider this Java class : public class A { int att1; UnknownDataType att2; } And let's consider these implications : IF att1 is equal to 1 THEN att2 should be of type DataType1. IF att1 is equal to 2 THEN att2 should be of type DataType2. I honestly cannot yet imagine how to design this, because an attribute value is influencing another intribute class. Should simply make the class A as abstract class, and make DataType1 and DataType2 inherit from A? Have you guys had a similar situation? Thank you a lot.

pivot-table
tag name: pivot-table
tags question: http://stackoverflow.com/q/23885116
type: Tag

http://stackoverflow.com/q/23907987
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36814888
has comment: http://stackoverflow.com/comment/36814807
tagged with: sockets
tagged with: java
has body: im trying to send image over socket in android using two emulator, log file give me 05-28 13:55:07.349: I/System.out(26763): Receiving... and i can see the created image from file explorer in data\files\output.jpg but it's blank and it's size =0k package com.javacodegeeks.android.androidsocketserver; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Environment; import android.os.StrictMode; import android.util.Log; public class Main extends Activity { private static ServerSocket serverSocket; private static Socket clientSocket; private static InputStream inputStream; private static FileOutputStream fileOutputStream; private static BufferedOutputStream bufferedOutputStream; private static int bufferSize = 3000; // bufferSize temporary hardcoded private static int bytesRead; private static int totalbytesRead = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); try { init(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void init() throws IOException { // TODO Auto-generated method stub serverSocket = new ServerSocket(6000); // Server socket System.out.println("Server started. Listening to the port 4444"); clientSocket = serverSocket.accept(); byte[] data = new byte[bufferSize]; // create byte array to buffer the // file inputStream = clientSocket.getInputStream(); String filePath = this.getFilesDir().getPath().toString() + "/output.jpg"; fileOutputStream = new FileOutputStream(filePath); // fileOutputStream = new FileOutputStream(file); bufferedOutputStream = new BufferedOutputStream(fileOutputS…
type: Question
has title: Android send image over socket, received blank image
has comment: http://stackoverflow.com/comment/36817294
has answer: http://stackoverflow.com/a/23917796
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/comment/36723020
type: Comment
type: QuestionComment
has text: @OlegS. In my opinion it was less about the data structure but the wrong data type to use as inputs. I used `String`, but the correct way would have been `Date`. I am now using `Date` instead of `String`.
score: 0
comment on: http://stackoverflow.com/q/23859686

http://stackoverflow.com/comment/36978128
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23922758
has text: @trashgod, I think we are talking about two different examples. The tutorial explains how to add a component to each individual tab. I thought the question was about adding a single component at the right of the tabbed pane itself. This is what my posted code attempts to do. I guess using the tutorial approach you would need to add a separate tab with the check box as a component on that tab. From a UI point of view it would be more reliable since it will always be painted properly, but I would guess you would also selected the tab when the check box is clicked.

http://stackoverflow.com/comment/36617721
has text: you should step through your code with your debugger
comment on: http://stackoverflow.com/q/23805028
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36834602
comment on: http://stackoverflow.com/q/23918707
has text: Ok. I will try using Iterator. Tx
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36804950
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23877263
has text: Hi, tanks for your time, see that root@digcr [/home/crlis/sejda-console]# bin/sejda-console splitbybookmarks -f abril01.pdf -p [BOOKMARK_NAME] -o /B/ -l 2 22:31:15.080 Configuring Sejda 1.0.0.M9 22:31:15.093 Loading Sejda configuration form default sejda.xml 22:31:15.271 Starting execution with arguments: 'splitbybookmarks -f abril01.pdf -p A B -o /B/ -l 2' 22:31:15.271 Java version: '1.7.0_55' 22:31:15.335 Option only takes one value: --outputPrefix -p value : prefix for the output files name (optional) root@dipgcr [/home/crlis/sejda-console]#
type: Comment

http://stackoverflow.com/a/23891013
accepted answer of: http://stackoverflow.com/q/23884200
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23884200
type: AcceptedAnswer
has body: It is more for the servlet classes you can write to call the Rational Team Concert plain Java API's, not the reverse. In other words, that API doesn't know about Java EE, but nothing prevents your Java EE app to use RTC java API. Make sure you don't call TeamPlatform.shutdown() though: You need to start the platform the first time the servlet executes, but if you stop it in your servlet code, you'll get the exception when another user calls the servlet.

static
tags question: http://stackoverflow.com/q/23903556
tags question: http://stackoverflow.com/q/23791242
tags question: http://stackoverflow.com/q/23798564
tags question: http://stackoverflow.com/q/23938425
tags question: http://stackoverflow.com/q/23832497
tags question: http://stackoverflow.com/q/23806060
tags question: http://stackoverflow.com/q/23820463
tags question: http://stackoverflow.com/q/23921678
tags question: http://stackoverflow.com/q/23897297
tags question: http://stackoverflow.com/q/23878220
tags question: http://stackoverflow.com/q/23795668
tags question: http://stackoverflow.com/q/23832544
tags question: http://stackoverflow.com/q/23836953
tags question: http://stackoverflow.com/q/23876399
tags question: http://stackoverflow.com/q/23840528
tag name: static
tags question: http://stackoverflow.com/q/23850855
tags question: http://stackoverflow.com/q/23934079
tags question: http://stackoverflow.com/q/23900820
type: Tag

http://stackoverflow.com/q/23910714
has title: java index out of bounds exception using lists
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has body: I made some code for bullets in a list and a list for mobs. I tried to make something that would detect collision and then delete both the bullet and the mob. However, I get a java.lang.IndexOutOfBoundsException at this line: if(gmgr.bulletlist.get(i).x+x>=gmgr.moblist.get(mobnum).x&amp;&amp;gmgr.bulletlist.get(i).x+x&lt;=gmgr.moblist.get(mobnum).x+32){ here is my full code: for (int x = 0; x &lt; gmgr.bulletlist.get(i).size; x++) {//size is the size of the bullet in pixels in this case 8 for (int y = 0; y &lt; gmgr.bulletlist.get(i).size; y++) { for (int mobnum = 0; mobnum &lt; gmgr.moblist.size();//here size is the length of the list mobnum++) { if(gmgr.bulletlist.get(i).x+x&gt;=gmgr.moblist.get(mobnum).x&amp;&amp;gmgr.bulletlist.get(i).x+x&lt;=gmgr.moblist.get(mobnum).x+32){//here I take the position of the bullet and add and check for collision on every pixel if(gmgr.bulletlist.get(i).y+y&gt;=gmgr.moblist.get(mobnum).y&amp;&amp;gmgr.bulletlist.get(i).y+y&lt;=gmgr.moblist.get(mobnum).y+32){ gmgr.moblist.remove(mobnum); mobnum-=1;//the problem is for as far as I know that I delete this while in this loop gmgr.bulletlist.remove(i); i-=1; System.out.println("gotcha!!!!");//which means that the bullet hit the mob } } } } } I need to find a way to remove these bullets. Any ideas to improve my code are also welcome
answer count: 2
accepted answer: http://stackoverflow.com/a/23911045
score: -1
has answer: http://stackoverflow.com/a/23910880
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23911045
possible better answer: http://stackoverflow.com/a/23910880
favorite count: 0

http://stackoverflow.com/a/24664196
has body: This is really not a big deal now i understand i only need to perform contentProvider.onRequestSync and the SyncService from the Sync framework will detect it and call onPerformSync in SyncAdapter
type: Answer
upvote count: 2
downvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23872458
score: 1
accepted answer of: http://stackoverflow.com/q/23872458

http://stackoverflow.com/comment/36579720
has text: @agad: My mistake! I have corrected the code. Thanks.
comment on: http://stackoverflow.com/q/23783716
score: 0
type: Comment
type: QuestionComment

android-studio
tags question: http://stackoverflow.com/q/23830889
tags question: http://stackoverflow.com/q/23814665
tags question: http://stackoverflow.com/q/23828085
tags question: http://stackoverflow.com/q/23825143
tags question: http://stackoverflow.com/q/23811989
tags question: http://stackoverflow.com/q/23846295
tags question: http://stackoverflow.com/q/23780578
type: Tag
tags question: http://stackoverflow.com/q/23916295
tags question: http://stackoverflow.com/q/23901369
tag name: android-studio
tags question: http://stackoverflow.com/q/23904263
tags question: http://stackoverflow.com/q/23807445

http://stackoverflow.com/q/23912035
tagged with: java
has comment: http://stackoverflow.com/comment/36822005
tagged with: compression
type: Question
has answer: http://stackoverflow.com/a/42053613
tagged with: performance
has comment: http://stackoverflow.com/comment/36821886
tagged with: arrays
has answer: http://stackoverflow.com/a/23912757
answer count: 6
score: 4
has body: I have a large array (~400.000.000 entries) with integers of {0, 1, ..., 8}. So I need 4 bits per entry. Around 200 MB. At the moment I use a byte-array and save 2 numbers in each entry. I wonder, if there is a good method, to compress this array. I did a quick research and found algorithms like Huffmann or LZW. But these algorithms are all for compressing the data, send the compressed data to someone and decompress them. I just want to have a table, with less memory space, so I can load it into the RAM. The 200MB table easily fits, but I'm thinking on even bigger tables. Important is, that I still be able to determine the values on certain positions. Any tips? Further information: I just did a little experimenting, and it turns out, that on average 2.14 consecutive numbers have the same value. There are 1 zero, 154 ones, 10373 twos, 385990 threes, 8146188 fours, 85008968 fives, 265638366 sixes, 70791576 sevens and 80 eights. So more than half of the numbers are 6s. I only need a fast getValue(idx) funktion, setValue(idx, value) is not important.
possible better answer: http://stackoverflow.com/a/23913540
has comment: http://stackoverflow.com/comment/36821862
has answer: http://stackoverflow.com/a/23913540
has comment: http://stackoverflow.com/comment/36821781
has comment: http://stackoverflow.com/comment/36821827
has answer: http://stackoverflow.com/a/24077534
favorite count: 0
accepted answer: http://stackoverflow.com/a/23912182
has comment: http://stackoverflow.com/comment/36821728
has comment: http://stackoverflow.com/comment/36821749
upvote count: 4
has answer: http://stackoverflow.com/a/23912182
type: AnsweredQuestion
has title: Compress array of numbers
has answer: http://stackoverflow.com/a/23912391
downvote count: 0

http://stackoverflow.com/q/23925811
has comment: http://stackoverflow.com/comment/36848463
tagged with: java
tagged with: database
tagged with: mysql
has body: I have a situation, I want to generate a excel sheet through java program. I can generate excel sheet every time i execute the program. While i am executing program data saved to database, but I want to save data to database only once in a week. I have Two tables: CREATE TABLE PROJECTS (id int(10) NOT NULL AUTO_INCREMENT, project_name varchar(100) NOT NULL, lastUpdated Date, PRIMARY KEY (id)); CREATE TABLE PROJECT_DATA (id int(10) NOT NULL AUTO_INCREMENT, project_id int(10), rca_field varchar(50), environment varchar(50), dateCreated Date, endDate Date, dataValue int(10), PRIMARY KEY (id), FOREIGN KEY (`project_id`) REFERENCES PROJECTS(`id`)); Can any body suggest me a way to do this in JAVA Program? Thanks
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36848272
has answer: http://stackoverflow.com/a/23926012
has answer: http://stackoverflow.com/a/23925897
score: 0
has comment: http://stackoverflow.com/comment/36848390
linked to: http://stackoverflow.com/q/12034177
has title: Save Values to Database Only Once in A Week
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2248971
has comment: http://stackoverflow.com/comment/36848162

http://stackoverflow.com/comment/36856579
comment on: http://stackoverflow.com/q/23930117
type: Comment
type: QuestionComment
has text: usually for this the preference has a default value... and post that part of the code where it gives nullpointer so that we can help
score: 0

http://stackoverflow.com/q/23927659
tagged with: java
has comment: http://stackoverflow.com/comment/36856037
type: Question
has comment: http://stackoverflow.com/comment/36851659
score: 0
tagged with: google-maps
tagged with: infowindow
answer count: 1
has comment: http://stackoverflow.com/comment/36851264
has comment: http://stackoverflow.com/comment/36851895
tagged with: android
has comment: http://stackoverflow.com/comment/36851569
has answer: http://stackoverflow.com/a/23931626
has title: InfoWindow issue in Google Map v2 Android
has comment: http://stackoverflow.com/comment/36851366
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36855944
linked to: http://stackoverflow.com/q/14123243
has comment: http://stackoverflow.com/comment/36851485
has body: I am working with new Google map V2 in project I have added the infowindow on marker click and in my infowindow have two button. Issue: When I click on button1 I want button1 should disable and button2 enable vice versa. Previously there is map.invalidate() with this we can refresh map but how can achieve this in map V2. I refereed this link for infoWindow.

http://stackoverflow.com/comment/36570134
score: 5
comment on: http://stackoverflow.com/q/23779646
type: QuestionComment
type: Comment
has text: What do you mean by "something else that do same work"?

http://stackoverflow.com/q/23802534
type: Question
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/23802736
answer count: 1
favorite count: 0
tagged with: ddms
accepted answer: http://stackoverflow.com/a/23802736
tagged with: android
has body: How can I fix this so that I can see a) my text file that is saved in data/data and b) a database that I have saved in that location?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36612943
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/4867379
downvote count: 1
has title: I cannot view any folders (or it shows it as empty) in my ddms - at data/data - even though the file path saves to that location

http://stackoverflow.com/a/23915709
accepted answer of: http://stackoverflow.com/q/23905916
answers question: http://stackoverflow.com/q/23905916
type: AcceptedAnswer
downvote count: 0
has body: While using doReturningWork() you gain the access to the plain JDBC connection. Then you should split your SQL into 2 executions (set and select): final Object queryResultObject = session.doReturningWork(new ReturningWork&lt;ReturnObjectType&gt;() { @Override public ReturnObjectType execute(Connection connection) throws SQLException { final Statement statement = connection.createStatement(); statement.execute("set @rank = 0"); final ResultSet resultSet = statement.executeQuery( "select @rank := @rank + 1 as rank,id,name from test"); ReturnObjectType result = /* transform ResultSet into return value */ return result; } });
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36730425
type: QuestionComment
has text: thanks i solve the problem. i use javafx with netbeans platform, so i should make the package of module as public package.
comment on: http://stackoverflow.com/q/23855065
score: 0
type: Comment

http://stackoverflow.com/q/23803175
has answer: http://stackoverflow.com/a/32719120
upvote count: 8
has title: How to clear distinct_id in mixpanel android when user logs out?
type: AnsweredQuestion
tagged with: mixpanel
tagged with: java
accepted answer: http://stackoverflow.com/a/25439844
type: Question
answer count: 2
score: 8
downvote count: 0
tagged with: android
has body: I need Mixpanel to forget distinct_id when user logs out. In iOS app i call reset (https://mixpanel.com/site_media/doctyl/uploads/iPhone-spec/Classes/Mixpanel/index.html#//apple_ref/occ/instm/Mixpanel/reset) and it works. I cant find the right call in Android mixpanel documentation, i tried calling clearSuperProperties(), but distinct_id persists.
has answer: http://stackoverflow.com/a/25439844
favorite count: 0
possible better answer: http://stackoverflow.com/a/32719120

multithreading
tags question: http://stackoverflow.com/q/23846648
tags question: http://stackoverflow.com/q/23874238
tags question: http://stackoverflow.com/q/23859027
tags question: http://stackoverflow.com/q/23872602
tags question: http://stackoverflow.com/q/23868719
tags question: http://stackoverflow.com/q/23885954
tags question: http://stackoverflow.com/q/23802484
tags question: http://stackoverflow.com/q/23869188
type: Tag
tags question: http://stackoverflow.com/q/23837728
tags question: http://stackoverflow.com/q/23806565
tags question: http://stackoverflow.com/q/23812122
tags question: http://stackoverflow.com/q/23830903
tags question: http://stackoverflow.com/q/23912697
tags question: http://stackoverflow.com/q/23789987
tags question: http://stackoverflow.com/q/23921731
tags question: http://stackoverflow.com/q/23884018
tags question: http://stackoverflow.com/q/23934896
tags question: http://stackoverflow.com/q/23919099
tags question: http://stackoverflow.com/q/23847570
tags question: http://stackoverflow.com/q/23911229
tags question: http://stackoverflow.com/q/23781578
tags question: http://stackoverflow.com/q/23928745
tags question: http://stackoverflow.com/q/23830542
tags question: http://stackoverflow.com/q/23894725
tags question: http://stackoverflow.com/q/23835253
tags question: http://stackoverflow.com/q/23900494
tags question: http://stackoverflow.com/q/23828946
tags question: http://stackoverflow.com/q/23931208
tags question: http://stackoverflow.com/q/23902621
tags question: http://stackoverflow.com/q/23845268
tags question: http://stackoverflow.com/q/23788838
tags question: http://stackoverflow.com/q/23930189
tags question: http://stackoverflow.com/q/23898162
tags question: http://stackoverflow.com/q/23855677
tags question: http://stackoverflow.com/q/23824841
tags question: http://stackoverflow.com/q/23824564
tags question: http://stackoverflow.com/q/23853691
tags question: http://stackoverflow.com/q/23924682
tags question: http://stackoverflow.com/q/23859181
tags question: http://stackoverflow.com/q/23809129
tags question: http://stackoverflow.com/q/23853705
tags question: http://stackoverflow.com/q/23796960
tags question: http://stackoverflow.com/q/23937225
tags question: http://stackoverflow.com/q/23861979
tags question: http://stackoverflow.com/q/23795071
tags question: http://stackoverflow.com/q/23823301
tags question: http://stackoverflow.com/q/23925424
tags question: http://stackoverflow.com/q/23838700
tags question: http://stackoverflow.com/q/23838102
tags question: http://stackoverflow.com/q/23893851
tags question: http://stackoverflow.com/q/23799094
tags question: http://stackoverflow.com/q/23812981
tags question: http://stackoverflow.com/q/23913381
tags question: http://stackoverflow.com/q/23782914
tags question: http://stackoverflow.com/q/23859523
tags question: http://stackoverflow.com/q/23893656
tags question: http://stackoverflow.com/q/23814067
tags question: http://stackoverflow.com/q/23807601
tags question: http://stackoverflow.com/q/23782604
tags question: http://stackoverflow.com/q/23790173
tags question: http://stackoverflow.com/q/23870081
tags question: http://stackoverflow.com/q/23861579
tags question: http://stackoverflow.com/q/23909168
tags question: http://stackoverflow.com/q/23902280
tags question: http://stackoverflow.com/q/23931643
tags question: http://stackoverflow.com/q/23907118
tags question: http://stackoverflow.com/q/23858263
tags question: http://stackoverflow.com/q/23918912
tags question: http://stackoverflow.com/q/23816769
tags question: http://stackoverflow.com/q/23869762
tags question: http://stackoverflow.com/q/23870090
tags question: http://stackoverflow.com/q/23843348
tags question: http://stackoverflow.com/q/23823574
tags question: http://stackoverflow.com/q/23933009
tags question: http://stackoverflow.com/q/23782247
tags question: http://stackoverflow.com/q/23848518
tags question: http://stackoverflow.com/q/23850664
tags question: http://stackoverflow.com/q/23870408
tags question: http://stackoverflow.com/q/23828349

http://stackoverflow.com/a/23832086
answers question: http://stackoverflow.com/q/23831997
upvote count: 1
has body: You could implement some 'lock'. When the first server starts the process it locks the 'lock' and then the second server wont acquire the 'lock' and should give up. When the first server finishes it would release the lock.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36736444
downvote count: 0

http://stackoverflow.com/q/23916109
tagged with: java
tagged with: ping
type: Question
has comment: http://stackoverflow.com/comment/36831089
score: 0
has title: Extract values and Package Ping JAVA
upvote count: 1
downvote count: 1
has body: I need help, i have this code public static void main(String args[]) throws IOException { JavaApplication2 ping = new JavaApplication2(); List&lt;String&gt; commands = new ArrayList&lt;String&gt;(); commands.add("ping"); commands.add("-n"); commands.add("3"); commands.add("10.40.1.156"); ping.doCommand(commands); } public void doCommand(List&lt;String&gt; command) throws IOException { String s = null; ProcessBuilder pb = new ProcessBuilder(command); Process process = pb.start(); BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream())); System.out.println("Here is the standard output of the command:\n"); while ((s = stdInput.readLine()) != null) { System.out.println(s); } System.out.println("Here is the standard error of the command (if any):\n"); while ((s = stdError.readLine()) != null) { System.out.println(s); } } And this is my output Here is the standard output of the command: Haciendo ping a 10.40.1.156 con 32 bytes de datos: Respuesta desde 10.40.1.156: bytes=32 tiempo=2ms TTL=255 Respuesta desde 10.40.1.156: bytes=32 tiempo=2ms TTL=255 Respuesta desde 10.40.1.156: bytes=32 tiempo=87ms TTL=255 Estad�sticas de ping para 10.40.1.156: Paquetes: enviados = 3, recibidos = 3, perdidos = 0 (0% perdidos), Tiempos aproximados de ida y vuelta en milisegundos: M�nimo = 2ms, M�ximo = 87ms, Media = 30ms Here is the standard error of the command (if any): But i need only the seconds and the Packages
has comment: http://stackoverflow.com/comment/36829982
has comment: http://stackoverflow.com/comment/36830477
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36829909
answer count: 0
has comment: http://stackoverflow.com/comment/36830610

http://stackoverflow.com/q/23783437
has answer: http://stackoverflow.com/a/23783963
type: Question
has comment: http://stackoverflow.com/comment/36577276
has comment: http://stackoverflow.com/comment/36577550
has comment: http://stackoverflow.com/comment/36577427
accepted answer: http://stackoverflow.com/a/23783963
score: -1
has body: I have a string String mystring="[ "28, 4th Cross Road, HAL 3rd Stage, Hal, Puttappa layout, New Thippasandra, Bangalore, Karnataka 560008, Hindistan" ]"; What i am trying to do:: i want to extract Bangalore from this string But i don't want to extract bangalore from the start of the string traversing step-by-step instead i want to extract bangalore from the end of the string by traversing How can i achieve this ?
has title: Extracting a word from a string from traversing from the end of the string
linked to: http://stackoverflow.com/q/18782566
answer count: 1
has comment: http://stackoverflow.com/comment/36577559
has comment: http://stackoverflow.com/comment/36577087
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1

http://stackoverflow.com/a/23868697
downvote count: 0
type: Answer
has body: For applying directly the concepts in that video, you can switch to a reference frame where the planet does not move at the time of the collision. For that, and considering just classical physics, you just need to change the velocity of the player subtracting the speed of the planet (2D vector subtraction). Then apply the formula in the video, and finally switch back to your original reference frame by adding the speed of the planet (2D addition). In a notation similar to the one in the video, being v_before the velocity of the player before bouncing, v_planet the velocity of the planet, n the normal of the planet surface where the collision occurs and C the restitution coefficient, v_before_2 = v_before - v_planet // change of reference frame v_after_2 = v_before_2 - (1 + C) * (v_before_2 . n) * n // simple wall bouncing v_after = v_after_2 + v_planet // change to original reference frame
upvote count: 1
has comment: http://stackoverflow.com/comment/36740398
score: 1
accepted answer of: http://stackoverflow.com/q/23868065
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23868065

http://stackoverflow.com/comment/36849014
comment on: http://stackoverflow.com/q/23925949
has text: I'm not sure why this question is getting down-voted. While it may seem like a "stupid" question to some of you it is NOT a poorly worded question. There is an honest issue and code to back it up. This is precisely what this site is here for. Please consider your reasoning for down-votes.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36613464
type: Comment
comment on: http://stackoverflow.com/q/23801897
type: QuestionComment
has text: This is not memory access. This is I/O port access, and I/O ports are not the same as memory. You can't access them even with sun.misc.Unsafe, and I didn't know you could access them outside the kernel at all. You will need to use JNI or find a pre-existing library (that uses JNI). (Edit: This depends on the architecture. x86 processors have a separate concept of I/O ports, but this might not be one)
score: 1

http://stackoverflow.com/q/23910776
type: AnsweredQuestion
has body: I am now trying to make an App to detect human faces on a Google Nexus 10 using Camera.FaceDetectionListener. The faces have been successfully detected and shown on the screen by drawing rectangles around them. The problem for me now is that this tablet doesn't support the optional fields of Camera.Face. Because the value of field "id" always equals to -1, and it's the same result with front and back camera. Could there be any possible reasons that cause this problem? On the other hand, if anyone knows any device that fully supports all optional fields of Camera.Face? Any help would be greatly appreciated.
tagged with: face-detection
type: Question
tagged with: android
tagged with: nexus-10
score: 0
has title: Google Nexus 10 doesn't support the optional fields of Camera.Face (leftEye, mouth, rightEye)
answer count: 1
has answer: http://stackoverflow.com/a/23911386
tagged with: camera
tagged with: java
accepted answer: http://stackoverflow.com/a/23911386

http://stackoverflow.com/comment/36874902
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23939566
has text: Do you have any JavaScript that is running when the value of the selects change? Your screenshot suggests that there is some kind of loop on the JSP that you didn't provide in your code snippet too (the screenshot shows four rows in the table but the code snippet suggests only one row. A wild guess: you might be reusing names or ids on your fields when they need to be unique.

http://stackoverflow.com/comment/36619952
comment on: http://stackoverflow.com/a/23806202
type: AnswerComment
score: 0
type: Comment
has text: Well depends on what the point was with the addItem(). If its just there because you copied the text from somewhere else just remove the line and replace it with: `myUpgradeCombo.upgrade(myCombo, new FC(format,platef,idf));`

http://stackoverflow.com/comment/36789101
type: QuestionComment
type: Comment
has text: Must be made so as to ensure runtime inlineable code, so a requirement.
comment on: http://stackoverflow.com/q/23894354
score: 0

http://stackoverflow.com/comment/36662475
comment on: http://stackoverflow.com/a/23808863
type: Comment
has text: Sorry I do not get what you mean by element name corresponds to the SOAPBody? also what do you mean by the object model, is that the FindEventsResponse.class?
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36648128
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23820796
has text: define - "show a timer".

http://stackoverflow.com/comment/36634603
comment on: http://stackoverflow.com/q/23813658
score: 0
type: QuestionComment
has text: Sorry, it's Tomcat 6.0.39 with jdk 6u45 on Linux centos 6.5. An dyes, I read the tomcat doc about JAAS, but nothing useful found.
type: Comment

http://stackoverflow.com/q/23926409
tagged with: fragment
has comment: http://stackoverflow.com/comment/36849519
type: UnansweredQuestion
has title: How to inflate a view returned from onCreateView()
has comment: http://stackoverflow.com/comment/36859576
upvote count: 1
has comment: http://stackoverflow.com/comment/36849299
downvote count: 1
has comment: http://stackoverflow.com/comment/36849446
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/36849228
has comment: http://stackoverflow.com/comment/36849200
tagged with: java
has answer: http://stackoverflow.com/a/23926610
has answer: http://stackoverflow.com/a/23926596
has comment: http://stackoverflow.com/comment/36851217
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36849149
has comment: http://stackoverflow.com/comment/36849260
has comment: http://stackoverflow.com/comment/36849239
has comment: http://stackoverflow.com/comment/36870255
has comment: http://stackoverflow.com/comment/36849499
has comment: http://stackoverflow.com/comment/36849578
favorite count: 0
has comment: http://stackoverflow.com/comment/36849313
has body: I have a java class that extends a fragment and as you know at onCreateView a layout view will be returned to appear on the fragment container. Now, I want to inflate the returned View view = inflater.inflate(R.layout.fragment00, null); return view; with another layout or views from an xml file. Updat onCreateView() will return a view that will appear on the fragment conatiner. Now, I want to inflate that view with another xml file. is that possible.? I hope it is clear now. Any idea how to do that? Code: //I want to inflate "view" with another layout or views from another xml file @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.fragment00, null); return view;
tagged with: android
has comment: http://stackoverflow.com/comment/36870039

http://stackoverflow.com/comment/36796646
has text: The code provides enough info to understand and fix the problem.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23898427

http://stackoverflow.com/q/23778466
type: UnansweredQuestion
score: 5
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/23966596
type: Question
tagged with: automation
has title: Integrate yahoo smush.it in maven build for image compression
upvote count: 5
has body: I want to integrate Yahoo smush.it in maven build to automate the image compression in build itself. Can anyone help me to do so? I'm open to other libraries as well. [Back-end is Java.]
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42608866
favorite count: 0
tagged with: image-compression
tagged with: yahoo

http://stackoverflow.com/q/23833592
has answer: http://stackoverflow.com/a/24036266
possible better answer: http://stackoverflow.com/a/23839153
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question
type: AnsweredQuestion
upvote count: 5
has body: I have a method in my script that I use in a loop to determine if an object is enabled and displayed before it tries to interact with it, this looks like so: - public boolean isElementPresent(By myObject, individualThreadSession threadSesh) { try{ if(threadSesh.driver.findElement(myObject).isEnabled() && threadSesh.driver.findElement(myObject).isDisplayed()) { return true; } else { return false; } } catch (NoSuchElementException e){ return(false); } } The myobject part is passed in from a line reading something like so: - isElementPresent(By.xpath(IDString),threadSesh) So I'm passing in the relevant By (which is determined via data specified at runtime) Now this has worked out very well for me for a long time, until now. I'm trying to click on an object that is inserted into the page after I click a link, the problem is that Selenium is returning false for the threadSesh.driver.findElement(myObject).isDisplayed() portion of this even once the object is clearly visible on the screen. I can interact with this object fine manually and if I record it using the IDE it seems to work fine also... Anyone have any idea about how I can get around this? Or forcing Selenium to think that the object is displayed? The HTML for the area I'm working on is as follows when the objects have not been added: - No comment Save Cancel 240 characters And once you click the object Its changed to this: No comment Save Cancel 240 characters I've tried using an XPATH of .//textarea[contains(@id,'editcommenttext')] which I've varified within firepath as targetting just the textarea I want but no success. Any suggestions? Is there something wrong with the HTML I could get the devs to alter to make selenium return true here perhaps? It also appears that if I remove the isDisplayed check and then move on with my code I then get an error stating .InvalidElementStateException: Element must not be hidden, disabled or read-only when I try and type into the cell etc. I also tried getting the devs to gi…
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/23839153
downvote count: 0
has title: Selenium webdriver returns false from isDisplayed() on newly added object in browser and then returns InvalidElementStateException
favorite count: 0
accepted answer: http://stackoverflow.com/a/24036266

http://stackoverflow.com/comment/36722577
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23858751
type: QuestionComment
has text: @Isaac I've updated my question with the new bit of code.

http://stackoverflow.com/comment/37773756
type: Comment
comment on: http://stackoverflow.com/a/23816652
has text: Not necessary since I found a workaround that works with the official new release of Luna.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36917338
has text: That's a really really strange way to get hold of service instances... especially as you're already in a DS component and can just use injection...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23945008

http://stackoverflow.com/q/23824731
downvote count: 0
favorite count: 0
has body: I'm working on a school project an have created a GXT TabPanel as follows: TabPanel tabPanel = new TabPanel(); tabPanel.add(initMyModelView(), "My Model"); tabPanel.add(initGroupModelView(), "Group Model"); tabPanel.add(initProposalView(), "Proposals"); tabPanel.add(initPreferencesView(), "Preferences"); In groupmodel I have a TextButton, when clicking this I want to change to the "My Model" tab. exportModelButton.addSelectHandler(new SelectHandler(){ @Override public void onSelect(SelectEvent event) { // TODO Auto-generated method stub } }); Could this be done in GXT 3.1.0 and if so, how?
accepted answer: http://stackoverflow.com/a/23826077
tagged with: gxt
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23826077
has title: Change tab with button in TabPanel
type: Question
answer count: 1

http://stackoverflow.com/comment/36588609
has text: But my annotations are good? because I think there is an error..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23789293

http://stackoverflow.com/comment/36768565
score: 0
comment on: http://stackoverflow.com/q/23863716
type: Comment
type: QuestionComment
has text: possible duplicate of [Reflection type inference on Java 8 Lambdas](http://stackoverflow.com/questions/21887358/reflection-type-inference-on-java-8-lambdas)

http://stackoverflow.com/a/23922061
answers question: http://stackoverflow.com/q/23899785
upvote count: 1
has comment: http://stackoverflow.com/comment/76553482
score: 1
has body: It turns out it's because the return type of the getter doesn't match the argument of the setter. (One's "Boolean" the other "boolean").
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/76573953
type: Answer
accepted answer of: http://stackoverflow.com/q/23899785
has comment: http://stackoverflow.com/comment/76284570

http://stackoverflow.com/comment/36581196
comment on: http://stackoverflow.com/a/23784222
score: 0
type: Comment
has text: Thank you very much, I can try in a few hours and then will tell you :)
type: AnswerComment

http://stackoverflow.com/a/23849812
has body: An integer (which your index would be) is 32 bits, a reference is either 32 or 64 bits an object is a minimum of 64 bits plus its internals. So an integer is either the same size or slightly smaller than a reference. But a copy of the object will be much larger Index of array or reference But seriously you shouldn't be worrying about this index to an array of references unless there are an insane number of these and you are memory starved. And of course there will be a small performance penalty for this indirection. Do whichever makes most sense conceptually but its likely you want to stick with references not indexes to an array if both make conceptual sense - very similar memory footprint and a simpler structure. Copy of vector Of course the third option is to keep a reference to a copy of the vector, this would involve the full memory of the object for each copy and is worth avoiding unless you need independent objects
type: Answer
answers question: http://stackoverflow.com/q/23849758
score: 0

http://stackoverflow.com/a/23878513
has body: Assume that you have classes A and B, where B extends A. Class A has methods: methodOne(), methodTwo() and class B overrides methodOne(). However remember that class B has also methodTwo(), since it's inherited so there is no use to call it via super because you have it directly in descendant class. EDIT Let's take a look on that: import java.util.*; class A { public void methodOne() { System.out.println("A.1"); methodTwo(); //super.methodTwo(); /*This above would lead to compilation error even though it would work as intended - always print A.2. Use instead for instance: ((A)this).methodTwo();*/ } public void methodTwo() { System.out.println("A.2"); } } class B extends A{ @Override public void methodTwo() { System.out.println("B.2"); } public B() { methodOne(); } } public class Test { public static void main(String[] args) { A a = new A(); B b = new B(); a.methodTwo(); b.methodTwo(); } }
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36757939
type: Answer
answers question: http://stackoverflow.com/q/23878406
has comment: http://stackoverflow.com/comment/36758205
has comment: http://stackoverflow.com/comment/36757968
has comment: http://stackoverflow.com/comment/36757974
has comment: http://stackoverflow.com/comment/36758041
has comment: http://stackoverflow.com/comment/36758135
score: 0
has comment: http://stackoverflow.com/comment/36757994

http://stackoverflow.com/a/23809973
score: 0
accepted answer of: http://stackoverflow.com/q/23809957
has comment: http://stackoverflow.com/comment/36627331
answers question: http://stackoverflow.com/q/23809957
has body: cities[0][1] = distanceBetweenFirstTwoCities;
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36862649
has text: The tutorial you've linked describes how to create a Maven CQ project from the archetype, so if you followed it, you are using Maven. Find the pom.xml file in your project root and add above dependency to the `<dependencies>` section.
comment on: http://stackoverflow.com/a/23931007
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36746245
score: 0
type: Comment
type: QuestionComment
has text: to Hot Licks: yes but I can't be the first one to encounter this. The real question is: is there any package (that I could import with maven) that does the above
comment on: http://stackoverflow.com/q/23871694

http://stackoverflow.com/comment/36820631
comment on: http://stackoverflow.com/q/23911110
type: Comment
score: 0
type: QuestionComment
has text: thanks for the quick reply Leo. They are already placed there, but it doesn't work with Outlook.setLibraryPath("moyocore.dll");

http://stackoverflow.com/a/23922673
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/45758756
has comment: http://stackoverflow.com/comment/36845645
type: Answer
accepted answer of: http://stackoverflow.com/q/23922134
answers question: http://stackoverflow.com/q/23922134
has body: This quote explains the considerations behind having primitive streams. I'm assuming the same applied to primitive Optionals. In short, primitive streams (and probably Optionals as well) were created for performance reasons. They didn't create them for all 8 primitive types to reduce code duplication and interface pollution. Quoting the words of Brian Goetz in the lambda mailing list: More generally: the philosophy behind having specialized primitive streams (e.g., IntStream) is fraught with nasty tradeoffs. On the one hand, it's lots of ugly code duplication, interface pollution, etc. On the other hand, any kind of arithmetic on boxed ops sucks, and having no story for reducing over ints would be terrible. So we're in a tough corner, and we're trying to not make it worse. Trick #1 for not making it worse is: we're not doing all eight primitive types. We're doing int, long, and double; all the others could be simulated by these. Arguably we could get rid of int too, but we don't think most Java developers are ready for that. Yes, there will be calls for Character, and the answer is "stick it in an int." (Each specialization is projected to ~100K to the JRE footprint.) Trick #2 is: we're using primitive streams to expose things that are best done in the primitive domain (sorting, reduction) but not trying to duplicate everything you can do in the boxed domain. For example, there's no IntStream.into(), as Aleksey points out. (If there were, the next question(s) would be "Where is IntCollection? IntArrayList? IntConcurrentSkipListMap?) The intention is many streams may start as reference streams and end up as primitive streams, but not vice versa. That's OK, and that reduces the number of conversions needed (e.g., no overload of map for int -> T, no specialization of Function for int -> T, etc.) And I should mention that I found that quote in the answer to this question.
score: 20
upvote count: 20

http://stackoverflow.com/comment/36815338
type: Comment
has text: the JSON string contains special characters such as \, @, &, #, etc.. first you need convert them into their respective HEX value
comment on: http://stackoverflow.com/a/23905599
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36810132
type: AnswerComment
type: Comment
has text: *"I have to decide that in master class but how?"* - You can't. It is not possible.
comment on: http://stackoverflow.com/a/23900243
score: 0

http://stackoverflow.com/a/23879413
answers question: http://stackoverflow.com/q/23877900
has comment: http://stackoverflow.com/comment/36770830
type: Answer
has body: OpenSessionInView is a servlet filter than just Open a hibernate session and store it in the SessionHolder for the thread that is serving the request. With this session opened, hibernate can read the Lazy initialized collections and objects when you use this in the rendering stage of the request. This session can be accessed when you invoke SessionFactory.getCurrentSession(). But, OpenSessionInView just opens the session and it doesn't begin any transactions. With a session opened you can read objects from database but, if you want to do something in a transaction you need @Transactional annotations or other mechanism to demarcate the begin and the end of the transaction when you want. Then the answer of the questions: Is it bad practice to use OpenSessionInViewFilter in application having complex schema. This is a good practice if you need avoid the LazyInitializationException and the overload is just open new Hibernate Session and close it at the end of the request for each request. Using this filter can cause N+1 problem I use this filter in many projects and not cause any problem. if we are using OpenSessionInViewFilter does it mean @Transactional not required? No. You only have a Hibernate Session opened in the SessionHolder of the thread, but if you need Transactions you need put @Transactional.
upvote count: 14
has comment: http://stackoverflow.com/comment/36796684
has comment: http://stackoverflow.com/comment/36824336
has comment: http://stackoverflow.com/comment/36797201
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23877900
score: 14
type: AcceptedAnswer

http://stackoverflow.com/comment/36794233
type: Comment
comment on: http://stackoverflow.com/q/23895478
score: 0
type: QuestionComment
has text: @Mortos, If there are a lot of potential foo/bar type classes that you expect to have to call `.getChiled().print()` on, you might want to consider some sort of wrapper factory: a class which, given a non-specific parent, will return an anonymous class with the `.print()` method you are looking for.

http://stackoverflow.com/a/23936599
type: Answer
accepted answer of: http://stackoverflow.com/q/23894856
has body: Holger had it, this doesn't work in JDK8, I had to run the server under JDK7. For anyone else who runs into this, to switch JDK versions go into WLDOMAIN\bin and edit setDomainEnv.cmd (or setDomainEnv.sh) and point it to another JDK installation.
answers question: http://stackoverflow.com/q/23894856
upvote count: 2
downvote count: 2
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/23918073
has answer: http://stackoverflow.com/a/23918502
has body: I was trying out a simple example but it did not worked. ApplicationContextHolder class implementing the Aware: @Component public class ApplicationContextHolder implements ApplicationContextAware { private static ApplicationContext context; @Override public void setApplicationContext(ApplicationContext context) throws BeansException { this.context = context; } public static ApplicationContext getApplicationContext(){ return context; } } App.java public static void main( String[] args ) { ApplicationContext context = ApplicationContextHolder.getApplicationContext(); // context in above line is coming as null } Below is the xml entry I have: &lt;context:component-scan base-package="com.XXX" /&gt; Please let me know why is the context coming as null in the App.jaa class. Do I need to make some entry for class implementing the Aware somewhere int he xml file?
tagged with: spring
accepted answer: http://stackoverflow.com/a/23918502
has title: ApplicationContextAware not working in Spring 3.0
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23918529
has answer: http://stackoverflow.com/a/43912173
has answer: http://stackoverflow.com/a/23918529
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23796325
has comment: http://stackoverflow.com/comment/36604022
favorite count: 0
answer count: 0
type: UnansweredQuestion
has body: I have two different project In first Project have all js,ftl java files and I included jsp file also in: Webcontent/test.jsp META-INF/resources/test.jsp META-INF/test.jsp When I exported this jar file in another project, I'm unable to call this jsp file. Tried Following way: &lt;jsp:include page="/test.jsp"&gt;&lt;/jsp:include&gt; &lt;jsp:include page="/test.jar!/resources/test.jsp"&gt;&lt;/jsp&gt; but it's still showing error while accessing this path in jsp.
has comment: http://stackoverflow.com/comment/36624460
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36602533
tagged with: jsp
tagged with: struts2
upvote count: 1
linked to: http://stackoverflow.com/q/5013917
downvote count: 0
has title: JSP file Include in from Jar file

http://stackoverflow.com/comment/37109331
has text: Ok so I misunderstood the question: "Is Object deserialization a proper way to implement Prototype pattern in Java?" :)
type: Comment
comment on: http://stackoverflow.com/a/24048557
score: 0
type: AnswerComment

http://stackoverflow.com/q/23857035
score: 0
linked to: http://stackoverflow.com/q/23854130
answer count: 1
tagged with: jar
has title: getResource(String name) returns null?
has comment: http://stackoverflow.com/comment/36756984
favorite count: 0
has answer: http://stackoverflow.com/a/23858679
has comment: http://stackoverflow.com/comment/36759945
has comment: http://stackoverflow.com/comment/36759863
has comment: http://stackoverflow.com/comment/36718072
has comment: http://stackoverflow.com/comment/36718371
type: UnansweredQuestion
tagged with: getresource
has comment: http://stackoverflow.com/comment/36717170
has comment: http://stackoverflow.com/comment/36717163
tagged with: java
has comment: http://stackoverflow.com/comment/36718253
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36718088
type: Question
has comment: http://stackoverflow.com/comment/36718031
has comment: http://stackoverflow.com/comment/36717200
has comment: http://stackoverflow.com/comment/36718223
has comment: http://stackoverflow.com/comment/36718136
has body: First off, I would like to address that this question is very similar to the one here:getResources() returns an empty Enumeration . I chose to ask this because mine is more of a question of JAR files, as well as because the former question has yet to be answered. In addition, this is technically a different method entirely (getResource(String) instead of getResources()). Now that that is out of the way... I am getting a mysterious error message from my code when it is in a Runnable JAR file, yet this doesn't happen at all when I am testing the project in Eclipse. The error message is: Exception in thread "main" java.lang.ExceptionInInitializerError at com.wierd0games.Under.graphics.Sprite.&lt;clinit&gt;(Sprite.java:13) at com.wierd0games.Under.main.Main.&lt;init&gt;(Main.java:53) at com.wierd0games.Under.main.Main.main(Main.java:57) Caused by: java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at com.wierd0games.Under.graphics.SpriteSheet.load(SpriteSheet.java:27) at com.wierd0games.Under.graphics.SpriteSheet.&lt;init&gt;(SpriteSheet.java:22) at com.wierd0games.Under.graphics.SpriteSheet.&lt;clinit&gt;(SpriteSheet.java:13) ... 3 more From my interpretation of this error, the problem is in my Sprite class at line 13. Here, I create my first Sprite with: public static Sprite frog=new Sprite(0, 0, 64, SpriteSheet.frog); Then the second part of the error means that the real problem is in the SpriteSheet class, which is called on by the initialization of frog, the Sprite object. The only time I use ImageIO.read is in the function load() {} which is: private void load() { try { BufferedImage image=ImageIO.read(SpriteSheet.class.getResource(path)); int w=image.getWidth(); int h=image.getHeight(); image.getRGB(0, 0, w, h, pixels, 0, w); } catch (IOException e) { e.printStackTrace(); } } ... in which path is a String that is "/textures/spritesheetFrog.png", because the Sprite Sheet is located in a folder named textures, and is…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36759913

http://stackoverflow.com/comment/64183810
type: Comment
has text: For the same i have given hibernate cfg to config location. But getting following error Caused by: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource] at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.unwrap(DriverManagerConnectionProviderImpl.java:222)
comment on: http://stackoverflow.com/a/23885999
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36573489
type: Comment
comment on: http://stackoverflow.com/q/23780474
has text: Why don't you use validator method for an input field?
score: 0
type: QuestionComment

http://stackoverflow.com/a/23831322
has comment: http://stackoverflow.com/comment/36667949
upvote count: 1
downvote count: 0
has body: The ArrayList offers a method, trimToSize(), that "Trims the capacity of this ArrayList instance to be the list's current size. An application can use this operation to minimize the storage of an ArrayList instance." See http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#trimToSize(). If any other methods do such an action silently, that would depend on the implementation provided with your JRE.
answers question: http://stackoverflow.com/q/23831157
has comment: http://stackoverflow.com/comment/36667553
has comment: http://stackoverflow.com/comment/36668125
type: Answer
score: 1

http://stackoverflow.com/a/23790483
type: Answer
has body: The way you are storing the data is not appropriate. I would recommend you to define a class for your Students that implements Comparable. Then overide compareTo() function such that it compares by the course id public class Student implements Comparable&lt;Student &gt; { public int id; public String name; public String course; public int compareTo(Student s) { if(s ==null) return 1; return id - s.id; } } Now you can store all your students in the ArrayList as follows : Student [] studentsList = new Student [sizeOfStudent]; Now you can just sort using Arrays utility sort method : Arrays.sort(studentsList); Note: If you want to use a different data structure, then I would recommend using ArrayList instead of an Array.
answers question: http://stackoverflow.com/q/23790396
score: 0

http://stackoverflow.com/a/23895972
accepted answer of: http://stackoverflow.com/q/23895908
type: Answer
score: 4
upvote count: 4
downvote count: 0
has body: A PropertyPlaceholderConfigurer does not add the properties from its locations to the Environment. With Java config, you can use @PropertySource to do that.
has comment: http://stackoverflow.com/comment/36791592
has comment: http://stackoverflow.com/comment/36791715
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23895908

http://stackoverflow.com/a/23904780
has comment: http://stackoverflow.com/comment/36809322
has body: First of all inflating with R.layout.camerapreviewfragment but the layout you are creating is fragmentRoot_layout and tools:context="com.example.fragmentwithcamerasurface.CameraPreviewFragment" CameraPreviewFragment is not a context Hey checkout this for details about tools:context
answers question: http://stackoverflow.com/q/23904508
score: 0
has comment: http://stackoverflow.com/comment/36808612
has comment: http://stackoverflow.com/comment/36809200
type: Answer
has comment: http://stackoverflow.com/comment/36808732

http://stackoverflow.com/q/23828761
has answer: http://stackoverflow.com/a/23831600
has comment: http://stackoverflow.com/comment/36666151
has answer: http://stackoverflow.com/a/23829988
has body: I'm unable to identify the element in all the below cases. Please help me to identify the problem in my code. HTML code : Test CRM Centre I want to click the element in tag <a - Test CRM Centre Code I tried : driver.findElement(By.cssSelector(".SItreeText")).click(); driver.findElement(By.linkText("Test CRM Centre")).click(); driver.findElement(By.xpath("//html/body/table/tbody/tr[1]/td/div[1]/table/tbody/tr/td[1]/div/div/table/tbody/tr/td/span/table/tbody[2]/tr[2]/td[3]/div/div/div[2]/div/a")).click(); driver.findElement(By.cssSelector("#DetailedNavigationTree")).click(); driver.findElement(By.xpath("//a[contains(@href, '#')]")).click(); driver.findElement(By.xpath("//a[@id = 'navNodeAnchor_2_0']")).click(); driver.findElement(By.xpath("//a[contains(@href, '#')]")).click(); driver.switchTo().frame(driver.findElement(By.xpath("//html/body/table/tbody/tr[1]/td/div[1]/table/tbody/tr/td[1]/div/div/table/tbody/tr/td/span/table/tbody[2]/tr[2]/td[3]/div/div/div[2]/div/a")));
score: 0
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
downvote count: 1
has comment: http://stackoverflow.com/comment/36664454
answer count: 4
favorite count: 0
tagged with: xpath
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36663295
has title: Unable to identify the element even using full xpath
has comment: http://stackoverflow.com/comment/36672464
has answer: http://stackoverflow.com/a/23830672
has comment: http://stackoverflow.com/comment/36663460
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/23829343
has comment: http://stackoverflow.com/comment/36664247
has comment: http://stackoverflow.com/comment/36662976
tagged with: webdriver
type: Question
has comment: http://stackoverflow.com/comment/36662891

http://stackoverflow.com/comment/48733137
type: Comment
comment on: http://stackoverflow.com/a/23802247
has text: Spring 3.1.3 was released in December 2012! Java8 was not even available at that time...
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36707534
has text: Tejas means "question" when he says "answer".
comment on: http://stackoverflow.com/q/23851835
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36853882
comment on: http://stackoverflow.com/q/23929029
type: Comment
has text: @Reddevil You mean SQL statement?
score: 0
type: QuestionComment

http://stackoverflow.com/a/23917020
answers question: http://stackoverflow.com/q/23916579
type: AcceptedAnswer
has body: 10.0.2.2 is an address that is used by your app running in an emulator to connect with a server running on your pc. The emulator is on the same pc. If you use a real devive you have to use the (W)LAN address of your pc which is in the same WLAN as your device. Often something like 192.168.0.12. Find out with ipconfig.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23916579

http://stackoverflow.com/a/23843451
has comment: http://stackoverflow.com/comment/36690885
has comment: http://stackoverflow.com/comment/36690858
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36691065
has comment: http://stackoverflow.com/comment/36691134
answers question: http://stackoverflow.com/q/23843377
type: Answer
has comment: http://stackoverflow.com/comment/36691108
accepted answer of: http://stackoverflow.com/q/23843377
has comment: http://stackoverflow.com/comment/36691159
has body: If the line specified is 150, then cd is null. Please debug to check the values in the list bpd. It means that the list bpd is having null value instead of BillProductDetails instance. So, while iterating the elements on the list, NPE is thrown when getQty() method is invoked on the null reference
has comment: http://stackoverflow.com/comment/36691296

http://stackoverflow.com/q/23855559
tagged with: mysql
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23855778
has comment: http://stackoverflow.com/comment/36715007
has comment: http://stackoverflow.com/comment/36715113
answer count: 2
tagged with: sql
tagged with: sqlite
has title: Import MySQL dump file to SQLite
favorite count: 0
has answer: http://stackoverflow.com/a/24062563
accepted answer: http://stackoverflow.com/a/24062563
has answer: http://stackoverflow.com/a/23855778
has body: Here is my use case: I have an sql dump file provided by a server application that I don't have access to, neither to the MySQL database that originates the file. The sql dump file is an ordinary one, common base SQL syntax, as those generated by phpmyadmin. I download this text file into an Android device. The columns are just of type 'int' or 'text', not other types. I want then to import this file into the Android app's SQLite database - basically reading the file into a stream, then executing one-by-one the sql statements. My question: is there any existing class either in Android or available-of-your-knowledge that I can use in Java/Android and import the MySQL dump file straight into SQLite, so that to spare a couple of time to develop a parser myself? Again, it's not about external tools. Thanks!
tagged with: android
has comment: http://stackoverflow.com/comment/36714883
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java

http://stackoverflow.com/q/23860158
has title: Getting error in my constructor
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has body: In my class assignment I need to create a constructor for Matrix, and im getting an error i'm not familiar with... this is the error: Multiple markers at this line - Method breakpoint:Matrix [entry] - Matrix(int, int) - Syntax error on token "public", delete this token And this is my code: import java.util.Scanner; public class Matrix { private int [][] data; private Scanner // Class constructor - can be created only when a user provide positive columns and rows public Matrix(int r, int c) throws DidNotProvideMatrixData { if (r &lt;= 0 || c &lt;= 0) { throw new DidNotProvideMatrixData("Rows and Columns have to be positive!"); } else { this.data = new int[r][c]; } } Thanks
has comment: http://stackoverflow.com/comment/36723652
has comment: http://stackoverflow.com/comment/36723988
accepted answer: http://stackoverflow.com/a/23860169
has comment: http://stackoverflow.com/comment/36723544
downvote count: 3
has comment: http://stackoverflow.com/comment/36723644
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23860169
has comment: http://stackoverflow.com/comment/36723620
has comment: http://stackoverflow.com/comment/36723636
score: -3
has comment: http://stackoverflow.com/comment/36723645
has comment: http://stackoverflow.com/comment/36723777

http://stackoverflow.com/a/23928163
score: 1
has comment: http://stackoverflow.com/comment/36852649
accepted answer of: http://stackoverflow.com/q/23927531
answers question: http://stackoverflow.com/q/23927531
upvote count: 1
type: AcceptedAnswer
has body: Running a background task and polling your server for update is a very bad idea, as it has pleanty of drawbacks. I would advice you to use GCM. As its very easy to implement.(GCM with php and GCM with java) However, Since you want a service based approach: Try using the alarm managers, as they can save you on power. Set up an AlarmManager to fire in say 10 minutes. In response to the alarm, start a service that polls the data. After polling it should set itself up with a new Alarm to fire again in another 10 minutes. The service shuts itself down. Note: I will still urge you to use gcm as they are very efficient at doing that one thing(polling for updates).
has comment: http://stackoverflow.com/comment/36854316
type: Answer
downvote count: 0

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/23789825
type: Tag
tags question: http://stackoverflow.com/q/23872423
tag name: csv
tags question: http://stackoverflow.com/q/23936528
tags question: http://stackoverflow.com/q/23794481
tags question: http://stackoverflow.com/q/23834863
tags question: http://stackoverflow.com/q/23926814
tags question: http://stackoverflow.com/q/23812601
tags question: http://stackoverflow.com/q/23802922
tags question: http://stackoverflow.com/q/23926675
tags question: http://stackoverflow.com/q/23919534
tags question: http://stackoverflow.com/q/23897736
tags question: http://stackoverflow.com/q/23878992
tags question: http://stackoverflow.com/q/23781826
tags question: http://stackoverflow.com/q/23864865
tags question: http://stackoverflow.com/q/23830073

intellij-idea
tags question: http://stackoverflow.com/q/23923304
tags question: http://stackoverflow.com/q/23843190
tags question: http://stackoverflow.com/q/23842589
tags question: http://stackoverflow.com/q/23834809
tags question: http://stackoverflow.com/q/23785043
tags question: http://stackoverflow.com/q/23825143
tags question: http://stackoverflow.com/q/23875038
tags question: http://stackoverflow.com/q/23912229
tags question: http://stackoverflow.com/q/23809940
tags question: http://stackoverflow.com/q/23897042
type: Tag
tags question: http://stackoverflow.com/q/23929821
tag name: intellij-idea
tags question: http://stackoverflow.com/q/23847482
tags question: http://stackoverflow.com/q/23824792
tags question: http://stackoverflow.com/q/23920140
tags question: http://stackoverflow.com/q/23815134
tags question: http://stackoverflow.com/q/23905162
tags question: http://stackoverflow.com/q/23841301
tags question: http://stackoverflow.com/q/23808711
tags question: http://stackoverflow.com/q/23907168
tags question: http://stackoverflow.com/q/23845588
tags question: http://stackoverflow.com/q/23814381
tags question: http://stackoverflow.com/q/23894804
tags question: http://stackoverflow.com/q/23856935
tags question: http://stackoverflow.com/q/23923696
tags question: http://stackoverflow.com/q/23877521

http://stackoverflow.com/comment/36595851
comment on: http://stackoverflow.com/a/23793225
score: 0
type: AnswerComment
type: Comment
has text: @LuiggiMendoza please stop, i already deploy my app with EQUALS. and problem in sign "+"

http://stackoverflow.com/comment/36758715
type: QuestionComment
comment on: http://stackoverflow.com/q/23863615
has text: @TheLostMind whats your idea about Simulant's and J888's answers?
score: 0
type: Comment

http://stackoverflow.com/q/23843934
tagged with: java
has title: different instantiation of members in singleton class
type: Question
has body: as title says, is there any difference between this: public final class Foo { private static final Foo foo; private final ArrayList&lt;String&gt; text = new ArrayList&lt;String&gt;(); //other members public static Foo getFooInstance(){ if(foo == null) { foo = new Foo(); } return foo; } public ArrayList&lt;String&gt; getList(){ return text; } and public final class Foo { private static final Foo foo = new Foo(); private final ArrayList&lt;String&gt; text; private Foo(){ //other members text = new ArrayList&lt;String&gt;(); } public static Foo getFooInstance(){ return foo; } public ArrayList&lt;String&gt; getList(){ return text; } i think there is no difference,to be more clear, i posted this question.
upvote count: 2
has comment: http://stackoverflow.com/comment/36691702
tagged with: singleton
accepted answer: http://stackoverflow.com/a/23843967
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36691699
has answer: http://stackoverflow.com/a/23843967
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/36691689
type: AnsweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/comment/36733255
comment on: http://stackoverflow.com/q/23864935
score: 0
type: QuestionComment
type: Comment
has text: Why not use an XML parser to parse XML?

http://stackoverflow.com/q/23913144
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36824072
has comment: http://stackoverflow.com/comment/36825917
has answer: http://stackoverflow.com/a/23916533
accepted answer: http://stackoverflow.com/a/23916533
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36830783
score: 0
answer count: 1
tagged with: jsp
has title: Pass variable to a method in JSP Java
has comment: http://stackoverflow.com/comment/36825006
has body: I have a Vector Method which returns value from the database to a JSP combobox. The Method has an Input Variable String which is stored in the session. I need to Pass the Value from the Session to the method invocation in the JSP but I am not getting the values from the Database. Here is My Method: public Vector getHostel(String campus) throws IOException{ Vector v = new Vector(); Connection conn; try{ conn = db.getDbConnection(); String sql = "select * from hostel_master where campus_code = ?"; PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, campus); ResultSet rs = ps.executeQuery(); while(rs.next()){ String host = rs.getString(1); v.add(host) } }catch(Exception asd){ System.out.println(asd.getMessage()); } return v; } And My JSP file extract: <jsp:useBean id = "obj" class="com.app.dao.HostelsDao" scope = "page"/> <% String campus = (String)session.getAttribute("campus_code");%> <%-- I really hate this --%> SELECT <c:forEach var = "item" items = "${obj.getHostel(campus)}"> ${item} </c:forEach> I am not getting Anything in my select list but when I pass the Value directly I am getting correct output. I need this value to vary depending on the campus_code value in the session. Please Help.
has comment: http://stackoverflow.com/comment/36824527

http://stackoverflow.com/a/23935898
has comment: http://stackoverflow.com/comment/36900695
has body: The payload of your message is : { "aps":{ "badge":9, "alert":"The ninth season of supernatural, an American paranormal drama television series created by Eric Kripke, premiered on October 8, 2013, concluded on May 20, 2014, and contained 23 epis", "sound":"default" }, "sound":"newMessage.aif" } The total length of all the characters you see above, including the quotes and the brackets, should be &lt;= 256 bytes (not just the content of the alert property). You should avoid any spaces and new-lines that are not part of the alert message, because those are also counted toward the 256 bytes limit. Note that your second example contains an additional parameter "sound":"newMessage.aif". That's why you have less remaining space for your alert. BTW, I don't understand why you send the sound parameter twice. Is it a mistake? It should only appear inside the aps dictionary. Relevant quotes from the APNS guide : Each push notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit. The examples are formatted with whitespace and line breaks for readability. In practice, omit whitespace and line breaks to reduce the size of the payload, improving network performance.
has comment: http://stackoverflow.com/comment/36895938
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36896028
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23931469
has comment: http://stackoverflow.com/comment/36898165
answers question: http://stackoverflow.com/q/23931469
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36683558
type: QuestionComment
has text: Make sure you are asking repaint at the end of the adtionPerformed method
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23837504

http://stackoverflow.com/q/23788175
upvote count: 0
tagged with: java
type: Question
has body: String getSname=request.getParameter("singer"); String sname="'"+getSname+"'"; String query=" SELECT singer FROM egypt WHERE singer= ' "+getSname+" ' "; rs=stmt.executeQuery(query); while(rs.next()) { out.print("&lt;br&gt;singer : " + rs.getString ("singer") ); When I enter the code in the page jsp appeare the same code when run program
type: AnsweredQuestion
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/36586152
downvote count: 2
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36586185
has comment: http://stackoverflow.com/comment/36588996
has answer: http://stackoverflow.com/a/23788480
accepted answer: http://stackoverflow.com/a/23788480
has title: When I enter the code in the page jsp appeare the same code when run program

http://stackoverflow.com/comment/36952545
type: Comment
type: QuestionComment
has text: Cannot test right now, because my MacBook pro died :( Will report back later...
comment on: http://stackoverflow.com/q/23920801
score: 0

http://stackoverflow.com/comment/36711641
has text: it isn't. The point of the EDIT is to explain why I think the first listing should work. If you can call a function on `result` in that line, than it should be fully initialized and ready to be assigned to `helper` as well. I think.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23853705
type: Comment

http://stackoverflow.com/comment/66116598
has text: This didn't work for me with SoapUI-5.1.3 on Windows 10
comment on: http://stackoverflow.com/a/23949271
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36654138
type: AnswerComment
has text: thats a very different question and just means you need to define your security context correctly, specifically there is no defaultsecruitychain bean defined. Have a look at example security-context.xml and make sure you have everything ...
type: Comment
comment on: http://stackoverflow.com/a/23809990
score: 0

http://stackoverflow.com/a/23852968
accepted answer of: http://stackoverflow.com/q/23852914
type: AcceptedAnswer
has body: MemorySafeUndeclaredThrowableStrategy was removed in Spring 4.0.2. Please see here for futher information. You should use spring 4.0.4 with CGLIB 3.1
upvote count: 9
type: Answer
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/36709722
answers question: http://stackoverflow.com/q/23852914

http://stackoverflow.com/comment/36830570
has text: This works ONLY if your background image is symmetrical (square). Try this: http://i.imgur.com/nH1V7gH.png
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23916502

http://stackoverflow.com/a/23835003
score: 3
accepted answer of: http://stackoverflow.com/q/23834744
upvote count: 3
answers question: http://stackoverflow.com/q/23834744
type: AcceptedAnswer
has body: while (true) { tweet = tweets.get(tweetIndex); user = tweet.new User(); entity = tweet.new Entities(); userMentions = entity.getUserMentions(); hashtags = entity.getHashtags(); if (tweet.getText() == null) { break; } The only break in this loop will work only if getText is null. If getText is not null for all the tweets, you'll get index out of bound exception. Instead of while(true) you should probably use a check like tweetIndex &lt; tweets.size() The second problem. You create a Tweets object without loading any items there: wtp.mapJavaObject(); tws = new Tweets(); tweets = tws.getTweets(); Of course tws object will not have any tweets in this case. What you need to do is to make sure that your mapJavaObjects() method returns a Tweets object with the tweets loaded by ObjectMapper and after this is done your code should look like this: tweets = wtp.mapJavaObject(); Something like this: public Tweets mapJavaObject() { String jsonFile = twitterFile.getName(); Tweets ret = null; System.out.println("Mapping JSON to WeatherTweet Class."); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { ret = (Tweets) mapper.readValue(new File(jsonFile), Tweets.class); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Finished Mapping of JSON File."); retrun ret; }
downvote count: 0
has comment: http://stackoverflow.com/comment/36676912
has comment: http://stackoverflow.com/comment/36677051
has comment: http://stackoverflow.com/comment/36696002
type: Answer
has comment: http://stackoverflow.com/comment/36674909

http://stackoverflow.com/comment/104939293
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate of [Accessing files with spaces in filename from Java](https://stackoverflow.com/q/5358850/608639), [Read file with whitespace in its path using Java](https://stackoverflow.com/q/9128288/608639), and friends.
comment on: http://stackoverflow.com/q/23828105

http://stackoverflow.com/comment/36857580
type: Comment
comment on: http://stackoverflow.com/a/23927997
type: AnswerComment
has text: Is it opening new window after clicking button? I think there is some problem with that locator ? Do you want to click that anchor tag in posted HTML code? By.id("dynshlp_sel_2-rowsel");
score: 0

http://stackoverflow.com/q/23793537
has comment: http://stackoverflow.com/comment/36599276
has body: I create a new instance of the "runGraphics.java" class from a class that has a surfaceView. When it opens this class, it now runs into an issue when the setContentView is put in. Before it was called in a different function before the calling of the runGraphics class. Here is my activity: import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.Toast; public class runGraphics extends Activity { ImageButton polarCap1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.graphics); polarCap1 = (ImageButton) findViewById(R.id.polarCapButton); polarCap1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(runGraphics.this, "IT WORKED", Toast.LENGTH_LONG).show(); }//end onClick function });//end setOnClickListener }//end onCreate function }//end runGraphics class here is my xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ImageButton android:id="@+id/polarCapButton" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/polarcap" /&gt; &lt;/LinearLayout&gt; and here is my logcat after I added the setContentView: 05-21 16:52:38.726: E/AndroidRuntime(18959): FATAL EXCEPTION: Thread-17 05-21 16:52:38.726: E/AndroidRuntime(18959): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 05-21 16:52:38.726: E/AndroidRuntime(18959): at android.os.Handler.&lt;init&gt;(Handler.java:121) 05-21 16:52:38.726: E/AndroidRuntime(18959): at android.app.Activity.&lt;init&gt;(Activity.java:704) 05-21 16:52:38.726: E/AndroidRuntime(18959): at com.twe…
tagged with: button
has title: Java Android - ImageButton displays but does not allow me to click it
has answer: http://stackoverflow.com/a/23793614
tagged with: imagebutton
favorite count: 0
accepted answer: http://stackoverflow.com/a/23793603
has comment: http://stackoverflow.com/comment/36598896
possible better answer: http://stackoverflow.com/a/23793614
has comment: http://stackoverflow.com/comment/36596073
tagged with: android
has comment: http://stackoverflow.com/comment/36598127
has comment: http://stackoverflow.com/comment/36598807
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23794153
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23793603
has comment: http://stackoverflow.com/comment/36598684
downvote count: 0
tagged with: image
answer count: 3

http://stackoverflow.com/comment/36598605
score: 0
type: Comment
has text: The answer is going to depend somewhat on which operating system you're running. Perhaps the Javadoc for the [ThreadPoolExecutor](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html) class might help you determine what happens.
type: QuestionComment
comment on: http://stackoverflow.com/q/23794386

http://stackoverflow.com/comment/36755956
type: Comment
comment on: http://stackoverflow.com/a/23877443
has text: doGet only outputs a message. maybe i should redirect it to NewFile.html using RequestDispatcher ? Can't I just add an exclusion for NewFile.html in web.xml ?
type: AnswerComment
score: 0

http://stackoverflow.com/q/23781782
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36574025
favorite count: 0
type: UnansweredQuestion
has body: I have written a code to execute jar file from my C# application , but now I also need to terminate that jar from my C# application. is there any way to do this? here is my code to start jar from c#. Process myCSharpProcess = new Process(); myJavaProcess.StartInfo.FileName = "javaw"; myJavaProcess.StartInfo.Arguments = "-jar D:\\DATA\\PROJECT\\LicensingManagement\\Assignment\\JavaLogin.jar \"test\" \"12345\""; //myProcess.StartInfo.CreateNoWindow = true; myJavaProcess.Start();
has answer: http://stackoverflow.com/a/23781893
tagged with: java
has title: How to terminate running jar file using C#
type: Question
tagged with: c#
score: 3
has comment: http://stackoverflow.com/comment/36574018
has comment: http://stackoverflow.com/comment/36574067
upvote count: 3

http://stackoverflow.com/comment/36792497
type: Comment
has text: Thanks for the great answer. Unfortunately, this product model doesn't quite fit my problem. It is my mistake not listing all possible product attribute for the complete answer. I was hoping that deserializer will be used to deserialize Money attribute of product automagically. Product model has many other attributes and JSON will have all those attributes of the product listed and will throw "Can not deserialize instance of java.lang.String out of START_OBJECT token. Any tips are appreciated. Thanks.
comment on: http://stackoverflow.com/a/23878172
type: AnswerComment
score: 0

http://stackoverflow.com/a/23860820
type: Answer
has body: With the following lines: byte[] prvk1 = new byte[(int)new File("C:\\...\\"+T_Username.getText()+"\\private_"+ T_Username.getText()).length()]; and byte[] encBytes = new byte[(int)new File("C:\\...\\"+T_Username.getText()+"\\hash_"+ T_Username.getText()).length()]; You actually create two empty byte arrays. You only indicate the size of the array using File.length(), which obviously is not correct. Try again after actually reading the files, e.g. using the readAllBytes method (requires Java 8 or higher).
answers question: http://stackoverflow.com/q/23857638
score: 0

http://stackoverflow.com/q/23780651
tagged with: javascript
upvote count: 3
answer count: 1
tagged with: websocket
has comment: http://stackoverflow.com/comment/112796105
favorite count: 0
tagged with: sockets
has body: My goal is to set up a connection between a Java Server Socket and a browser (using web sockets). So far, the connection works, but my data streams do not. I would like to send a String from the server socket to the web socket. The problems are the input and output streams. The web socket sends "zustimmung" to the server socket which is read in the run() by in.readLine(). But this does not read the String, it reads "GET / HTTP/1.1". The Output also does not work (I'm guessing it's due to the writeUTF()). So my question: What data streams can I use to transfer the Strings between the web socket and the server socket? Code Server: import java.net.*; import java.io.*; public class ServerCommunicator extends Thread{ private final static int PORT = 7777; private static ServerSocket serverSocket; private static Server server; private Socket incoming; private DataOutputStream out; private DataInputStream in; public static void main (String args[]) { try { serverSocket = new ServerSocket (PORT); System.out.println("Waiting for Clients.."); server = new Server(); while (true) { Socket incoming = serverSocket.accept(); ServerCommunicator communicator = new ServerCommunicator(incoming); communicator.start(); } }catch (Exception e) {e.printStackTrace();} } public ServerCommunicator (Socket incoming) { this.incoming = incoming; try { out = new DataOutputStream (incoming.getOutputStream()); in = new DataInputStream (incoming.getInputStream()); } catch (Exception e) {e.printStackTrace();} } public void run() { try { String input = in.readLine(); String reply; reply = server.auszaehlen(input); //returns a String out.writeUTF(reply); out.flush(); incoming.close(); } catch (Exception e) {e.printStackTrace();} } } Javascript code HTML: Run WebSocket
has title: Java Server Socket transfer String to web socket
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23781032
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/23781032

http://stackoverflow.com/comment/36748800
has text: Can I get the result as :{"a", "b", "c", "1", "2", "3"} or I'll have to get it manually?
comment on: http://stackoverflow.com/a/23863192
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36820250
comment on: http://stackoverflow.com/q/23906737
score: 0
has text: @Jens Yep the file is in the jar. But I get classNotFound exceptions. Should I add a classpath in the pom?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23789605
answer count: 0
has comment: http://stackoverflow.com/comment/36595304
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36590885
type: Question
has body: Based on the accepted answer here, I added this code to an Activity as what I hoped to be the first step in changing the assigned Layout for an Activity: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show(); setContentView(R.layout.activity_settings_landscape); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show(); setContentView(R.layout.activity_settings); } } ...and modified the Activity's element in AndroidManifest.xml. e.g., changing it from this: &lt;activity android:name="hhs.app.SettingsActivity" android:label="@string/title_activity_settings" &gt; &lt;/activity&gt; ...becomes this: &lt;activity android:name="hhs.app.SettingsActivity" android:configChanges="orientation|keyboardHidden" android:label="@string/title_activity_settings" &gt; &lt;/activity&gt; (I added the "configChanges" jazz). But, although mashing keypad.9 does indeed flip the orientation in the emulator, no toast is being raised (the breakpoint on the "if" line of onConfigurationChanged() is not being hit). What am I doing wrong or omitting? Note: It made no difference when I removed "|keyboardHidden" from the "configChanges" line in AndroidManifest (it was just a hunch - I wondered if it meant "pay no attention to an orientation change made via the keyboard"). UPDATE I tried araut's suggestion, and also the one from Jared Burrows here, but neither one works for me. Cold this be simply an emulator problem? I have no device to test it with yet, so I can't empirically answer that question myself. UPDATE 2 Based on what I read here, I thought maybe adding some OrientationEventListener jazz would solve this dilemma, but no! This is the code I added (shown in context; what's new is the Orientatio…
has title: Why is my Orientation Change Going Unnoticed?
has comment: http://stackoverflow.com/comment/36589648
downvote count: 0
favorite count: 0
tagged with: android-orientation
has comment: http://stackoverflow.com/comment/36593021
tagged with: onconfigurationchanged
linked to: http://stackoverflow.com/q/5726657
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/50496400
upvote count: 1
tagged with: android-manifest
tagged with: android-configchanges
linked to: http://stackoverflow.com/q/9566305

http://stackoverflow.com/q/23884384
tagged with: apache-commons-math
type: Question
linked to: http://stackoverflow.com/q/16896961
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24460884
has title: how to calculate integral with apache common math 3.3
tagged with: integral
has body: I want to calculate integral of some expriment with apache commonmath3.3 lib. I saw this question. SimpsonIntegrator simpson = new SimpsonIntegrator(); TrapezoidIntegrator trapezoid = new TrapezoidIntegrator(); double[] vector = new double[2]; vector[0] = 0; vector[1] = 1; PolynomialFunction f = new PolynomialFunction(vector); UnivariateFunction uf = (UnivariateFunction)new PolynomialFunction(vector); System.out.println("To String " + uf.toString()); System.out.println("Degree: " + f.degree()); double i = simpson.integrate(10, uf, -Float.MAX_VALUE, Float.MAX_VALUE); double j = trapezoid.integrate(10, uf, 0, 1); System.out.println("Simpson integral : " + i); System.out.println("Trapezoid integral : " + j); and i think we have to create a double array for Intervals of integral.but when i want to create array with more than size 2 i give this message: Caused by:org.apache.commons.math3.exception.TooManyEvaluationsException: illegal state: maximal count (10) exceeded: evaluations 05-27 08:11:33.461: E/AndroidRuntime(1349): at org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator.computeObjec tiveValue(BaseAbstractUnivariateIntegrator.java:218) Am I missing something? How can i declare function for integral? for example how can i declare "x^2+3" function for integral?
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23906650
tags question: http://stackoverflow.com/q/23787234
tag name: deserialization
tags question: http://stackoverflow.com/q/23837215
tags question: http://stackoverflow.com/q/23892962
tags question: http://stackoverflow.com/q/23911891

http://stackoverflow.com/q/23792441
tagged with: graphics
has comment: http://stackoverflow.com/comment/36593990
score: -1
has comment: http://stackoverflow.com/comment/36594074
tagged with: image
has body: I'm trying to create a JFrame with 1 image and a text box. I've managed to figure out the text box, but I can't figure the image painting. So far I have this: public class Patcher extends JFrame { private static final long serialVersionUID = -431324639043295668L; private JPanel contentPane; private static JTextArea textArea; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Patcher frame = new Patcher(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Patcher() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 319); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); textArea.setBackground(new Color(240, 240, 240)); textArea.setText("123"); contentPane.add(textArea, BorderLayout.SOUTH); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.NORTH); Image img = ImageIO.read(new URL(ClassLoader.getSystemResource("Icon_Entrey_21.png"), "img")); ImageObserver imgobs; panel.paintComponent(Graphics.drawImage(img, 0, 0, null)); } } The idea is that I create a JPanel, declare an Image using a ClassLoader and try to draw it using paintComponent() method with Graphics as an argument. What am I doing wrong here? Also I've tried creating a new Graphics() but that throws an error, as well.
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23792727
favorite count: 0
has title: paintComponent with graphics
tagged with: jframe
has comment: http://stackoverflow.com/comment/36594464
has comment: http://stackoverflow.com/comment/36594138
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23792727
tagged with: swing
downvote count: 1
type: Question

http://stackoverflow.com/comment/36776485
comment on: http://stackoverflow.com/q/23873324
has text: On the server(localhost), I have a selfcreated CA root cert. ca.crt in cacerts.jks, selfsigned server certificate in keystore.jks. Client side i have just the selfsigned client certificate in the client.jks.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/23881206
has title: Error "has no public TestCase(String name) or TestCase() in Junit test
type: Question
has body: I'm a beginner in junit test android. I'm following this tutorial but get this error junit.framework.AssertionFailedError: Class com.example.projectfortest.test.MainActivityTest has no public constructor TestCase(String name) or TestCase() at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701) This is my code: public class MainActivityTest extends ActivityInstrumentationTestCase2&lt;MainActivity&gt; { private MainActivity mMainActivity; private TextView mFirstTestText; private String expected, actual; public MainActivityTest(Class&lt;MainActivity&gt; activityClass) { super(activityClass); } @Override protected void setUp() throws Exception { super.setUp(); mMainActivity = getActivity(); mFirstTestText = (TextView) mMainActivity.findViewById(R.id.txt1); expected = mMainActivity.getString(R.string.txt1_test); actual = mFirstTestText.getText().toString(); } public void testPreconditions() { assertNotNull("mMainActivity is null", mMainActivity); assertNotNull("mFirstTestText is null", mFirstTestText); } public void testMyFirstTestTextView_labelText() { assertEquals(expected, actual); } } I didn't see anything wrong in my code. Please help
score: 15
upvote count: 15
answer count: 3
tagged with: junit
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23883537
tagged with: android
has answer: http://stackoverflow.com/a/47469838
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/65285318

http://stackoverflow.com/a/41669601
answers question: http://stackoverflow.com/q/23889657
score: 0
type: Answer
has body: The browser retrieves the IFRAME content as a separate resource -- eg, a separate request to your server. That request should be handled by the appropriate servlet mapped for that URL. If the specified URL is mapped to the same servlet, that servlet will get invoked twice -- which isn't necessarily a problem, but having a distinct servlet for separate responsibilities may be cleaner design perspective. Servlets are allowed to be concurrently invoked &amp; should be stateless to allow this; they should have no request- or conversation-specific members. Then it's a matter of the servlet being coded appropriately for the content it is intended to deliver -- the templating &amp; boilerplate are typically different, eg the IFRAME does not typically include a page header or banner etc.

http://stackoverflow.com/comment/36607165
score: 0
type: Comment
has text: So, we have `HashSet<String> data;` and `String check="abc,ghi"; String[] checkArray = check.split(","); for(i){if(data.contains(checkArray[i]))}` . Something like this should work.
type: QuestionComment
comment on: http://stackoverflow.com/q/23783550

http://stackoverflow.com/q/23805193
has title: Jcalender date format not matching MYSQL
has body: I am making a Application Using Java. to pick the date i am using JCalender.jar file , and saving it in MYSQL . their date format does not match MYSQL date format . how can i change it
favorite count: 0
accepted answer: http://stackoverflow.com/a/23811990
tagged with: swing
tagged with: jcalendar
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36617431
type: Question
has answer: http://stackoverflow.com/a/23811990
has comment: http://stackoverflow.com/comment/36618213
answer count: 1
downvote count: 0

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/23785976

http://stackoverflow.com/q/23862174
type: AnsweredQuestion
downvote count: 0
has title: SomeClass.<OtherClass>someMethod() syntax meaning
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/23862225
score: 1
tagged with: java
has body: I have come across a curious syntax today. The code is from Gradle's source files you can find it in src/core-impl/org/gradle/api/internal/artifacts/configurations/DefaultConfiguration.java private class ConfigurationResolvableDependencies implements ResolvableDependencies { public FileCollection getFiles() { return DefaultConfiguration.this.fileCollection(Specs.&lt;Dependency&gt;satisfyAll()); } } Is someone able to explain the purpose of this strange generics syntax. If this is a repeat, then please forgive me as i do not know what to call this for searching purposes.
possible better answer: http://stackoverflow.com/a/23862225
answer count: 2
has answer: http://stackoverflow.com/a/23862247
accepted answer: http://stackoverflow.com/a/23862247
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/23860753
has title: If I throw a new exception in a constructor do I have to catch this exception whenever I use this constructor?
has comment: http://stackoverflow.com/comment/36724930
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36724840
tagged with: java
has body: Sorry if I didnt ask it properly, I'm taking a java class in university now and i'm a beginner.. So what I want to ask is, I created a constructor and declared that this constructor throws an exception. Now when I created a method for this class called add I got an error that I didnt catch the error for the new (Matrix) object I created in this method. So I wanted to ask if whenever I will use this constructor anywhere I have to catch it? can I just catch it in the constructor and it will not bother me again or that might bring trouble..? This is my code: public class Matrix implements Arithmetic, InputOutput { private static final Matrix Matrix = null; // Class attributes int [][] data; private Scanner myScanner; // Class constructor - can be created only when a user provide positive columns and rows public Matrix(int r, int c) throws DidNotProvideMatrixData { if (r &lt;= 0 || c &lt;= 0) { throw new DidNotProvideMatrixData("There got to be Rows and Columns and they have to be positive!"); } else { this.data = new int[r][c]; } } public Matrix add(Object o) { try { if (o instanceof Matrix &amp;&amp; o != null) { Matrix matrixToAdd = (Matrix)o; if (this.data.length == matrixToAdd.data.length &amp;&amp; this.data[0].length == matrixToAdd.data[0].length) { Matrix resultMatrix = new Matrix(this.data.length, this.data[0].length); for (int i = 0; i &lt; this.data.length; i++) { for (int j = 0; j &lt; this.data[i].length; j++) { resultMatrix.data[i][j] = this.data[i][j] + matrixToAdd.data[i][j]; } } return resultMatrix; } else { throw new AddedDiffSizedMatrix(); } } } catch (AddedDiffSizedMatrix e) { System.out.println("you can only add matched size matrix"); } catch (DidNotProvideMatrixData e) { System.out.println("There got to be Rows and Columns and they have to be positive!"); } return null; } The compiler told me I have to catch "DidNotProvideMatrixData" in add Thanks a bunch!
has answer: http://stackoverflow.com/a/23860775
accepted answer: http://stackoverflow.com/a/23860775
type: Question
has comment: http://stackoverflow.com/comment/36724765
has comment: http://stackoverflow.com/comment/36724748
score: 0
has comment: http://stackoverflow.com/comment/36724866
answer count: 1

http://stackoverflow.com/a/23901705
downvote count: 0
type: Answer
has body: Instead of declaring the variables individually // Don't do it like that! ImageIcon breifCase0; ImageIcon breifCase1; ImageIcon breifCase2; ... ImageIcon breifCase26; make an array or a collection. Declare your array like this ImageIcon[] breifCase = new ImageIcon[27]; Now you can slightly change your loop - and you are done! for(int i = 0; i &lt; 27; i++) { breifCase[i] = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("img/case" + i + ".png"))); }
accepted answer of: http://stackoverflow.com/q/23901683
upvote count: 4
answers question: http://stackoverflow.com/q/23901683
type: AcceptedAnswer
score: 4

http://stackoverflow.com/comment/36676482
type: QuestionComment
comment on: http://stackoverflow.com/q/23830413
score: 2
has text: I understand what you are saying. I could've included the research I'd done up front, but I wanted keep the question simple. A lot of the time when I end up on stackoverflow the question itself is miles long, whilst the actual question is contained in the title, and a lot of the time the title and the accepted answer is completely independent on the long question text. Maybe I'm overthinking this. My experience as a contributor is very limited after all:) Thanks for useful input though!
type: Comment

http://stackoverflow.com/comment/36627842
score: 0
type: AnswerComment
type: Comment
has text: http://stackoverflow.com/questions/23810509/what-will-happen-if-fields-with-same-name-inherites-from-two-sourcesclass-and-i
comment on: http://stackoverflow.com/a/23805991

http://stackoverflow.com/comment/36684049
comment on: http://stackoverflow.com/q/23839652
has text: @ZoveGames do you know of other service to upload that lets you stream? Most of the ones I found give you a url like : Vocaroo.com/857hsgf? or thinks like that.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23779546
answers question: http://stackoverflow.com/q/23779350
has comment: http://stackoverflow.com/comment/36570714
has body: All U should be lowercase u: String s = "\u05d0\u05d5\u05d2\u05e0\u05d3\u05d4"; try{ byte[] bytes = s.getBytes(); String decoded = new String(bytes); System.out.println(decoded); } catch(UnsupportedEncodingException e) { // ... } See Byte Encodings and Strings. Output: אוגנדה
has comment: http://stackoverflow.com/comment/36571516
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23779350
has comment: http://stackoverflow.com/comment/36573241

http://stackoverflow.com/comment/36594377
type: QuestionComment
has text: code was updated to reflect a brief synopsis of what I was expecting
type: Comment
comment on: http://stackoverflow.com/q/23792603
score: 0

http://stackoverflow.com/q/23922961
tagged with: java
type: Question
has title: menu in a while loop
tagged with: while-loop
answer count: 3
has answer: http://stackoverflow.com/a/23923051
has body: I want to make a kind of menu inside a while loop. I wrote this code System.out.println("age , sex or exit" ); BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in)); String r = bufferRead.readLine(); while(!(r.equals("exit"))) { if(r.equals("age")) { System.out.println("enter name"); r = bufferRead.readLine(); getAge(r); System.out.println("age , sex or exit" ); r = bufferRead.readLine(); } if(r.equals("sex")) { System.out.println("enter name"); r = bufferRead.readLine(); getSex(r); System.out.println("age , sex or exit" ); r = bufferRead.readLine(); } } It works the first time but it don't work properly. Is there a better way to do it ?
has answer: http://stackoverflow.com/a/23923027
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36842976
has answer: http://stackoverflow.com/a/23923111
score: 0

http://stackoverflow.com/comment/36660654
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23827719
has text: I'm supposed to be using the same driver as him.

http://stackoverflow.com/comment/36845038
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23918270
type: Comment
has text: I just decompiled `com.ibm.ws.websvcs.transport.http.WASAxis2Servlet` and found that it has enough logs, but I can't find them anywhere (eclipse console, trace.log, SystemOut.log, ..). Do you know how to solve that ?

http://stackoverflow.com/comment/36866374
score: 2
has text: @rexford, you have your escape sequence backwords in your comment, `[^A-Za-z0-9/._\\-@]`
type: AnswerComment
comment on: http://stackoverflow.com/a/23935331
type: Comment

http://stackoverflow.com/a/23798573
has body: Here is another option using String#replaceAll and String#split String s = "if x=7 else if x=6 else if x&gt;5 else"; String[] parts = s.replaceAll("\\s*(?:if|else)\\s*", "").split("(?&lt;=\\d)"); System.out.println(Arrays.toString(parts)); Output [x=7, x=6, x&gt;5]
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23798262
upvote count: 1
type: Answer

http://stackoverflow.com/q/23782574
tagged with: jsp
tagged with: grails
tagged with: servlets
score: 0
has title: Difference b/w passing model and using request object at jsp/gsp
answer count: 2
has answer: http://stackoverflow.com/a/23782732
type: UnansweredQuestion
tagged with: spring-mvc
has body: I have been working both on spring and grails (grails is built on spring). We can pass our data from controller to view (jsp/gsp) via request object or via model. Passing data via model is preferred because its easy. Comparison of code : Spring : controller request.setAttribute("name","india"); view ${pageContext.request.getAttribute('name')} controller ModelAndView("viewname",modelObject) Grails controller request.setAttribute("name","india") view ${request.getAttribute("name")} controller render(view:"viewName",model:[name:"india"]) I think request object does many functionalities other than this. So my question is : If passing data from controller to view can be done with request object itself why java technology required to make a concept like model ? necessity is mother of invention I mean to say that there must be a task that can be implemented only via a model.
tagged with: java
has answer: http://stackoverflow.com/a/23782847
type: Question

http://stackoverflow.com/q/23854657
has body: I have a panel which comes on top of another panel which is made using JWindow. I want to set this top panel go fullscreen when a button is clicked. I searched in for long time but couldn't find a solution.
score: -1
linked to: http://stackoverflow.com/q/11570356
upvote count: 0
answer count: 1
has title: Make JWindow of swing to appear full screen and components inside it also should adjust accordingly
favorite count: 0
accepted answer: http://stackoverflow.com/a/23854671
has comment: http://stackoverflow.com/comment/36713061
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23854671
duplicate of: http://stackoverflow.com/q/11570356
tagged with: java
tagged with: swing
downvote count: 1
type: Question
tagged with: fullscreen

http://stackoverflow.com/q/23809957
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/36627345
answer count: 1
has comment: http://stackoverflow.com/comment/36628132
has title: Java 2D array to hold distance
favorite count: 0
has body: I am implementing the travelling salesman problem and I need for example 5 cities where there is a distance,d, between each city, i.e 0 -d- 0 -d- 0 -d- 0 -d- 0 (where 0 is a city and d is the distance) I am defining the cities as follow: int[][] cities = new int[1][5]; how can I specify what is the distance between 2 cities in Java? I am doing as below but I am getting "] expected " int[][] cities = new int[1][5]; cities[0][0] = 10; cities[0][1] = 10; cities[0][2] = 10; cities[0][3] = 10; cities[0][4] = 10;
has answer: http://stackoverflow.com/a/23809973
accepted answer: http://stackoverflow.com/a/23809973
downvote count: 4
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36627233
tagged with: java
score: -4

http://stackoverflow.com/q/23844560
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/24228412
has body: After several months of searching &amp; reading, now i need your help, taking in consideration the following: - My Application Developed using Java Swing. - MySQL has been used as database. - JDBC has been used to make the communication between the application &amp; database. - The application will run on network environment with multiple client will connect to database. - The application use Financial transactions, Posting, Billing ... etc. ** now i want to develop a server side that will work as middle-ware, this server side will do the following: - Connecting to the database to retrieve data as client request. - Business logic will be on the server side. - Client will not know about the database. - Queries Syntax will be on the server side. - The Client will View,Save,Edit, Cancel ... etc, sending these actions to the server side &amp; server will response. --- I have read about JFC, J2EE, EJB ... etc, but i don't want to run my application from browser, it will be kept as desktop application only due to the complexity of the application. --- So i will do it using Sockets. Any ideas, or tutorials that i can follow?
has comment: http://stackoverflow.com/comment/36693680
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23846766
type: UnansweredQuestion
tagged with: sockets
tagged with: swing
has comment: http://stackoverflow.com/comment/36693481
has title: Java Swing using Socket for enterprise application

http://stackoverflow.com/comment/36710532
has text: Your BufferedReader code doesn't terminate for me. Even when I type alt 0. Try this: while ((line = in.readLine()).length() != 0)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23853367

http://stackoverflow.com/comment/36851646
type: Comment
type: QuestionComment
has text: go through this link, changes are minimal but depends on your code design. http://www.javaworld.com/article/2071804/java-web-development/migrating-ejb-2-x-applications-to-ejb-3-0.html
score: 0
comment on: http://stackoverflow.com/q/23919927

http://stackoverflow.com/a/23859674
has body: From your stacktrace: Caused by java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[] at data.HttpRequestTask.doInBackground... Follow the trace back along the methods to find and properly cast/parse your arguments. In the future try not to use screenshots of text, it makes it more difficult to help and many won't even try to because of it.
score: 0
answers question: http://stackoverflow.com/q/23859027
type: Answer

http://stackoverflow.com/a/23878585
has comment: http://stackoverflow.com/comment/36777541
upvote count: 3
has comment: http://stackoverflow.com/comment/36777501
has comment: http://stackoverflow.com/comment/36822824
score: 3
has comment: http://stackoverflow.com/comment/36776241
has body: You will not archive that with tomcat and standard form based authentication at the example (it uses UserDatabaseRealm). Take a look at the notes: http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html "The cached user is not saved and restored across sessions serialisations." with all realm implementations but "JAASRealm", or so says documentation. So you can implement your own JAAS login module to be used with forms authentication in tomcat or you can use a framework as "spring security", there are very simple tutorials on the web, for example http://www.mkyong.com/spring-security/spring-security-form-login-example/ I have successfuly tested that example (the session login is remembered after tomcat restart). I hope this help you. Regards, José
answers question: http://stackoverflow.com/q/23825731
accepted answer of: http://stackoverflow.com/q/23825731
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/105801829
type: Answer

http://stackoverflow.com/a/23900334
accepted answer of: http://stackoverflow.com/q/23900288
answers question: http://stackoverflow.com/q/23900288
has body: if you are in a Servlet environment, you have a request object, you can try: request.getParameter("id"); If you are parsing this from plain java, you could use something like what's described here: How to extract parameters from a given url
type: AcceptedAnswer
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/36800561
score: 3
downvote count: 0

http://stackoverflow.com/comment/36623978
has text: I know that I have to fix the sw, this is really non informative, but thanks anyway for remarking it. So, you mean that there is no way to recognize that a sw called in a target caused an issue like that and then report the failure?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23808096
score: 0

http://stackoverflow.com/comment/36804149
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23902374
has text: Is it not `EditText.getText().toString()`?
type: AnswerComment

http://stackoverflow.com/comment/36582089
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23780201
has text: upd: with `shared.loader=` it seems to be more correct to place all common web-apps libraries in separate folder instead of `catalina.home/lib`

http://stackoverflow.com/a/75459941
answers question: http://stackoverflow.com/q/23882316
score: 0
has comment: http://stackoverflow.com/comment/133191691
has body: -Djava.util.prefs.userRoot=/com/ABC/test
type: Answer

http://stackoverflow.com/comment/36837830
comment on: http://stackoverflow.com/q/23918514
score: 0
has text: @BitBank: it sounds reasonable albeit weir as it only happens with some image width. Anyway, thanks for you time and I will go with your suggestions and see what happens.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23933070
score: 3
has body: The thread needs to be started. Call timer.start().
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23933009
answers question: http://stackoverflow.com/q/23933009
type: Answer

http://stackoverflow.com/a/23892760
answers question: http://stackoverflow.com/q/23891624
has body: There are no field literals like there are class literals. That basically means that the only way you can refer to a field is through a String value of its name. You won't be able to get IDE refactoring capabilities for fields, which I assume is why you want this. public class Example {} ==&gt; public class Refactored ... Example.class ==&gt; Refactored.class // would cause compiler error if wasn't changed You'll need to do this check at runtime, one way or another.
score: 0
type: Answer

http://stackoverflow.com/comment/36682908
has text: Where do you get the String from? Do you read it from a file with one of these statments per line, or something like that?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23839111
score: 0

http://stackoverflow.com/comment/36820419
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23911270
type: QuestionComment
has text: Why don't you annotate the Java class directly instead of using these xml config files? In Java you can use features like auto complete so the chance to have errors is reduced. I'm not such a huge XML "fan".

http://stackoverflow.com/comment/36672464
score: 1
type: Comment
type: QuestionComment
has text: Do you have an `xmlns` (namespace declaration) in your "HTML"?
comment on: http://stackoverflow.com/q/23828761

http://stackoverflow.com/a/23842913
score: -1
has body: Use following to append if file exists. FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
answers question: http://stackoverflow.com/q/23842896
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/36689871
has comment: http://stackoverflow.com/comment/36689902

http://stackoverflow.com/comment/36621291
has text: it showing unimplemented method cause your class does not contain 'override onClick' method check my answer below
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23806615

http://stackoverflow.com/comment/36744470
comment on: http://stackoverflow.com/q/23871377
score: 0
has text: also tried clearing all cache http://stackoverflow.com/questions/16048111/tfs-2010-versioncontrol-config-is-not-valid-and-cannot-be-loaded
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36782065
score: 0
comment on: http://stackoverflow.com/q/23872672
has text: i have a list of file i'm displaying. and after i upload a file it should appear in the list
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23900699
downvote count: 2
has answer: http://stackoverflow.com/a/23900786
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23900710
type: Question
has answer: http://stackoverflow.com/a/23900789
has answer: http://stackoverflow.com/a/23900753
has body: I have a jar that I want to take out a class file and add a few lines of code to it. I got class editor, but you can't actually change any code, you can change constants and that is all. I have a program that you can read the source code from a .class but you can't change anything on it. Is there a program or eclipse plugin that you can read and EDIT the source code from a .class file?
favorite count: 0
has title: How do I edit the actual code of a java .class file?
answer count: 4
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/q/23928068
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36852968
linked to: http://stackoverflow.com/q/15812148
type: Question
score: 1
tagged with: project
tagged with: java
tagged with: lotus-domino
has comment: http://stackoverflow.com/comment/36853116
has comment: http://stackoverflow.com/comment/36854584
has comment: http://stackoverflow.com/comment/36900064
downvote count: 0
tagged with: xpages
has body: Every time Lotus Domino Designer crash, if i have a database opened that contains java classes deployed into WebContent/WEB-INF/src, and/or jars included into Java build path, i always need to add jars again, and to re-deploy classes using Build path -> Use as source folder. It seems a project corruption. Any idea to avoid this?
favorite count: 0
has title: Lotus Domino Designer crash and project corruption
has comment: http://stackoverflow.com/comment/36916223
answer count: 0
has comment: http://stackoverflow.com/comment/36854190

http://stackoverflow.com/q/23851064
tagged with: java
has answer: http://stackoverflow.com/a/23855718
linked to: http://stackoverflow.com/q/4216745
duplicate of: http://stackoverflow.com/q/9785072
has comment: http://stackoverflow.com/comment/36706112
downvote count: 1
type: Question
has title: Convert String in 24 Hour time to 12 Hour AM PM Time
duplicate of: http://stackoverflow.com/q/4216745
possible better answer: http://stackoverflow.com/a/23855718
has comment: http://stackoverflow.com/comment/36706023
accepted answer: http://stackoverflow.com/a/23851990
answer count: 2
has comment: http://stackoverflow.com/comment/36706035
favorite count: 0
tagged with: datetime
has comment: http://stackoverflow.com/comment/36706047
has answer: http://stackoverflow.com/a/23851990
has body: Returned the exact String for "closing time" below from my json Result. It appears to be in 24hour time format. I did a little search around and noticed it is not in the desired format of HH:MM:SS. What's an efficient way to convert this to a 12Hour AM PM time. Thanks.` String closingTime = "2100"; //Desired output: String closingTime = "9:00 pm"
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9785072
upvote count: 3

http://stackoverflow.com/a/23835742
has comment: http://stackoverflow.com/comment/36676089
has comment: http://stackoverflow.com/comment/36676265
has comment: http://stackoverflow.com/comment/36677738
has body: you should use getServerName() method which returns current domain name. getServerName() Returns the host name of the server that received the request. getRemoteHost() Returns the fully qualified name of the client that sent the request. Source : http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/36676186
accepted answer of: http://stackoverflow.com/q/23835626
has comment: http://stackoverflow.com/comment/36676138
has comment: http://stackoverflow.com/comment/36686834
has comment: http://stackoverflow.com/comment/36686111
answers question: http://stackoverflow.com/q/23835626
type: Answer
has comment: http://stackoverflow.com/comment/36676991
has comment: http://stackoverflow.com/comment/36677907
has comment: http://stackoverflow.com/comment/36677127

http://stackoverflow.com/a/23901125
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23901070
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36801630
answers question: http://stackoverflow.com/q/23901070
has comment: http://stackoverflow.com/comment/37157640
has comment: http://stackoverflow.com/comment/36835676
type: Answer
has body: the url pattern specification : 1 - A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping. 2 - A string beginning with a ‘*.’ prefix is used as an extension mapping. 3 - A string containing only the ’/’ character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null. 4 - All other strings are used for exact matches only. reference : Java Servlet Specification
downvote count: 0
has comment: http://stackoverflow.com/comment/36835166
has comment: http://stackoverflow.com/comment/37157689
score: 3
has comment: http://stackoverflow.com/comment/36835457

http://stackoverflow.com/q/23927054
has answer: http://stackoverflow.com/a/23927296
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36850608
tagged with: java
has comment: http://stackoverflow.com/comment/36851026
has comment: http://stackoverflow.com/comment/36850493
accepted answer: http://stackoverflow.com/a/23927296
score: 0
has body: public class PurchaseOrderWrapper extends ArrayList&lt;HashMap&lt;String, String&gt;&gt; { public boolean contains(Object o) { HashMap&lt;String, String&gt; ob = (HashMap&lt;String, String&gt;) o; for (HashMap&lt;String, String&gt; map : this) { Log.i("kasun",ob.get("part_no")+" "+ map.get("part_no")+" = "+Boolean.toString(ob.get("part_no").equalsIgnoreCase(map.get("part_no")))); if(ob.get("part_no").equalsIgnoreCase(map.get("part_no"))){ return true; } } return false; } } if (wrapper.contains(removitems)){ wrapper.remove(removitems); } Wrapper is a instance of a PurchaseOrderWrapper class.it contains Hash Map with with 5 attributes including part no.remove items also contains 4 items inclding part no as i mention on the above example.So i need to remove the hashmap from Wrapper instance which has same part no in remove items hash map.But it does not work
answer count: 1
has comment: http://stackoverflow.com/comment/36850570
favorite count: 0
has title: Cannot remove hash map from array list
has comment: http://stackoverflow.com/comment/36850560
type: AnsweredQuestion

http://stackoverflow.com/q/23928128
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/36852420
has answer: http://stackoverflow.com/a/23929072
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/36855147
type: Question
has comment: http://stackoverflow.com/comment/36856991
score: -1
tagged with: eclipse
upvote count: 0
answer count: 1
has title: Maven Build Error during Build of Multi Module Project
has body: I'm working on multi-module Maven project. During compilation My pom.xml throws following error: org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack (unpack) on project Test2: The parameters 'artifactItems' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack are missing or invalid. How can I get rid of the above error? The pom.xml of Test2 project is as follows: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 Test1 com.photon.phresco 1.0.0-SNAPSHOT com.photon.phresco Test2 1.0.0-SNAPSHOT Test2 war net.awired.js almond 0.1.4 war test net.awired.js jquery 1.7.2 war jslibraries.files jslib_jquery-amd 1.7.1-alpha-1 js jslibraries.files.history jslib_jquery.hashable 1.0.0 js jslibraries.files jslib_xml2json-amd 1.1 js jslibraries.files jslib_jquery-ui-amd 1.8.16-alpha-1 js jslibraries.files jslib_jsonpath-amd 0.8.0 js junit junit 4.7 jar net.awired.js qunit 1.12.0 war jslibraries.files jslib_yui 3.7.2 war com.google.code.gson gson 2.2.2 jar <distributionManagement> TestMultiModule-release http://host:port/repository/content/repositories/dep-3-2/ TestMultiModule-snapshot http://host:port/repository/content/repositories/snapshots/ </distributionManagement> /src/main/java /src/test/java do_not_checkin/target org.apache.maven.plugins maven-dependency-plugin copy-dependencies package copy-dependencies provided jar do_not_checkin/target/lib org.codehaus.mojo build-helper-maven-plugin add-source compile add-source src/main/java org.apache.maven.plugins maven-assembly-plugin 2.2-beta-5 create-war package single false conf/war-config.xml conf/zip-config.xml net.awired.jstest jstest-maven-plugin 3.3.1.7000 test do_not_checkin/jstest/report ALMOND true ${js.skipTest} eshop/widgets/Init.js **/**.min.js **/**-min.js net.alchim31.maven yuicompressor-maven-plugin 1.3.0 true yuicompressor-default compress

http://stackoverflow.com/comment/36769271
type: QuestionComment
has text: You all ready are printing the array by calling System.out.println(anArray); Since you array if of type int (which already has a toString method defined), when you write sysOut on your array the toString of each element in the array gets called if none other is defined for the array.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23884454

http://stackoverflow.com/q/23868231
has title: How to get Cipher's maximum key size
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/992019
has comment: http://stackoverflow.com/comment/36738354
has comment: http://stackoverflow.com/comment/36738540
tagged with: cryptography
has body: Given a javax.crypto.Cipher object, how do I obtain key length to use with its init method? I do know that object is created with Cipher.getInstance("AES/CBC/PKCS5Padding"), but I'd like to abstract from that. Right now my code looks like: SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); KeySpec spec = new PBEKeySpec(keyString.toCharArray(), SALT, 256, 128); byte[] encoded = factory.generateSecret(spec).getEncoded(); assert encoded.length*8 == 128; Key rv = new SecretKeySpec(encoded, "AES"); Cipher cipher = Cipher.getInstance(CIPHER_MODE); cipher.init(Cipher.DECRYPT_MODE, rv, new IvParameterSpec(IV_PARAMETER_SPEC)); I'd like replace cipher object with a parameter and "128", "AES" constant values to be derived from cipher object.
has comment: http://stackoverflow.com/comment/36738174
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23880791
score: 1
has answer: http://stackoverflow.com/a/23880791
has answer: http://stackoverflow.com/a/23875107
tagged with: java
upvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23875107

http://stackoverflow.com/comment/126749404
type: Comment
has text: @BrianGoetz isn't counters::get a unBounded method reference?
type: AnswerComment
comment on: http://stackoverflow.com/a/23925631
score: 0

http://stackoverflow.com/q/23792881
type: Question
has comment: http://stackoverflow.com/comment/36595115
has comment: http://stackoverflow.com/comment/36595157
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36595366
has comment: http://stackoverflow.com/comment/36595568
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36596344
has title: How can i delete the __MACOSX folder in android?
has comment: http://stackoverflow.com/comment/36594920
has comment: http://stackoverflow.com/comment/36594997
has body: My app need to download some ZIP files to work. Once the file has been unzipped, it also reveal the __MACOSX folder, because the original file has been zipped with mac. I know that I can zip the file using the terminal to avoid that folder, but because I have lot of files, for me is better to delete this folder once the file has been unzipped. I have tried this but it doesn't work: private static final File MAC_FOLDER = new File(Environment.getExternalStorageDirectory().getPath() + "/folder/folder/__MACOSX"); File fileMac = MAC_FOLDER; if(MAC_FOLDER.exists()){ fileMac.delete(); } Any suggestions? Thanks It doesn't work even if try to delete the folder and hi content File fileMac = MAC_FOLDER; if(MAC_FOLDER.exists()){ if (fileMac.isDirectory()) { String[] children = fileMac.list(); for (int i = 0; i &lt; children.length; i++) { new File(fileMac, children[i]).delete(); } } }
score: 1
has comment: http://stackoverflow.com/comment/36595205
tagged with: java
has comment: http://stackoverflow.com/comment/36595636
upvote count: 1
has answer: http://stackoverflow.com/a/23793747

http://stackoverflow.com/q/23849001
has title: BaseGameUtils GoogleApiClient.ApiOptions cannot be resolved to a type
tagged with: google-play-services
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23866504
downvote count: 0
tagged with: android
upvote count: 6
has answer: http://stackoverflow.com/a/23854784
favorite count: 0
accepted answer: http://stackoverflow.com/a/23866504
score: 6
possible better answer: http://stackoverflow.com/a/23854784
has body: After importing BaseGameUtils project as a library and fixing a couple of errors i came across these errors: GoogleApiClient.ApiOptions mGamesApiOptions = null; GoogleApiClient.ApiOptions mPlusApiOptions = null; GoogleApiClient.ApiOptions mAppStateApiOptions = null; the errors say GoogleApiClient.ApiOptions cannot be resolved to a type. other errors i got: public void setGamesApiOptions(GoogleApiClient.ApiOptions options) { doApiOptionsPreCheck(); mGamesApiOptions = options; } they say mGamesApiOptions cannot be resolved to a variable and the same as before for the GoogleApiClient.ApiOptions. i've already referenced the google_play_services_lib to the GameBaseUtils. ive looked on the internet for some explanation without succes, the only thing i found is this https://code.google.com/p/google-api-java-client/wiki/Setup but didn't help much either because i didn't really understand what to do, can anyone help? (btw i use eclipse)
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36781854
has text: Did you try writing the code to unzip the jar file(using java -jar command) into some temp folder and read the images?
comment on: http://stackoverflow.com/q/23891128
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23930189
has answer: http://stackoverflow.com/a/25921672
tagged with: java
linked to: http://stackoverflow.com/q/10401947
tagged with: sleep
answer count: 2
duplicate of: http://stackoverflow.com/q/2523721
downvote count: 0
has comment: http://stackoverflow.com/comment/40577596
favorite count: 0
has title: WHY does Thread.sleep() clear the interrupted flag?
linked to: http://stackoverflow.com/q/2523721
has answer: http://stackoverflow.com/a/25921774
has body: I know that some Thread methods clear the interrupted flag (e.g. sleep, wait, ...). But why do they do this? What is the reason for it?
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading
type: Question
score: 3

http://stackoverflow.com/a/23813026
has comment: http://stackoverflow.com/comment/91092042
has comment: http://stackoverflow.com/comment/91084370
accepted answer of: http://stackoverflow.com/q/23812947
has comment: http://stackoverflow.com/comment/124026942
has comment: http://stackoverflow.com/comment/36634372
answers question: http://stackoverflow.com/q/23812947
has comment: http://stackoverflow.com/comment/36633762
score: 87
type: AcceptedAnswer
downvote count: 0
upvote count: 87
type: Answer
has body: Assuming you have class Entity { final long id; final String data; public long getId() { return id; } public String getData() { return data; } Entity(long id, String data) { this.id = id; this.data = data; } } In Java 8 you can write Collection&lt;Entity&gt; entities = Arrays.asList(new Entity(1, "one"), new Entity(11, "eleven"), new Entity(100, "one hundred")); // get a collection of all the ids. List&lt;Long&gt; ids = entities.stream() .map(Entity::getId).collect(Collectors.toList()); System.out.println(ids); prints [1, 10, 100] As you can imagine this is rather ugly in Java 7 or less. Note the Entity.getId when applied to map() means call this method on each element. Now, the real interesting part is you can do this. List&lt;Long&gt; ids = entities.parallelStream() .map(Entity::getId).collect(Collectors.toList()); In most cases using a parallel stream will hurt performance, but it makes trying it and seeing amazingly easy (possibly too easy ;) The most efficient way is to have, or build a Map. Map&lt;Long, Entity&gt; entitiesMap = ... // get all ids Collection&lt;Long&gt; addIds = entitiesMap.keySet(); // look up entities by id. List&lt;Long&gt; ids = ... List&lt;Entity&gt; matching = new ArrayList&lt;&gt;(); for(Long id: ids) matching.add(entitiesMap.get(id));
has comment: http://stackoverflow.com/comment/36632975
has comment: http://stackoverflow.com/comment/36634310
has comment: http://stackoverflow.com/comment/36632879
has comment: http://stackoverflow.com/comment/36632769

lambda
tags question: http://stackoverflow.com/q/23870478
tags question: http://stackoverflow.com/q/23865950
tags question: http://stackoverflow.com/q/23887691
tags question: http://stackoverflow.com/q/23837215
tags question: http://stackoverflow.com/q/23912622
tags question: http://stackoverflow.com/q/23795376
tags question: http://stackoverflow.com/q/23834995
tag name: lambda
tags question: http://stackoverflow.com/q/23865643
type: Tag
tags question: http://stackoverflow.com/q/23893486
tags question: http://stackoverflow.com/q/23836988
tags question: http://stackoverflow.com/q/23860533
tags question: http://stackoverflow.com/q/23863716
tags question: http://stackoverflow.com/q/23790514
tags question: http://stackoverflow.com/q/23832904
tags question: http://stackoverflow.com/q/23839072

http://stackoverflow.com/a/23884180
answers question: http://stackoverflow.com/q/23883978
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23883978
has comment: http://stackoverflow.com/comment/36768811
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36768684
type: Answer
has comment: http://stackoverflow.com/comment/36768801
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36768647
has body: Grouguard keep statements Keep statements are a way to tell Proguard to keep bits of code even if they're not called from the application code directly. A good example for this is the MainActivity Activity. It is not being called from your code, but you still need to keep it in the final package and also not change its name. Are these the only keep statements you have configured? If true, you're missing some basic ones. Here is a basic example for a minimal Android configuration (section 7): http://proguard.sourceforge.net/index.html#manual/examples.html Retrace Retrace is a way to recreate stack traces. So first we need the stack trace from your crash. Run the APK on a device/emulator and get the crash exception and stacktrace. It should look like: NullPointerException at a.b.m.a(). Use the GUI retrace (it's easier to use) to get the actual stack trace, and then you can go to your original code and try and debug the crash. Reflection and Proguard A common reason for flows being broken by Proguard is that Proguard needs to be notified of reflection. For example - method invocation from layout XML is done via reflection, but since there is no call from your code itself, Proguard doesn't know it has the keep the relevant methods. Please refer to this question for more info on the subject: Android, ProGuard, and keepclasseswithmembernames If you wanna rule out reflection problems, I suggest you begin by disabling Proguard code shrinking: http://proguard.sourceforge.net/index.html#FAQ.html.

http://stackoverflow.com/a/23918106
downvote count: 0
has body: Authentication auth = SecurityContextHolder.getContext().getAuthentication(); auth.getName();
accepted answer of: http://stackoverflow.com/q/23917844
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23917844
has comment: http://stackoverflow.com/comment/36833928
type: AcceptedAnswer

http://stackoverflow.com/comment/36729534
comment on: http://stackoverflow.com/q/23863369
type: Comment
score: 1
type: QuestionComment
has text: I'm assuming you can't use `Calendar` or `JodaTime`

http://stackoverflow.com/a/23815738
score: 0
type: AcceptedAnswer
upvote count: 2
has body: It's working for me. You may want to assign Fahrenheit, Celsius, and Newton in your constructor, though: public class working { public static void main(String[] args) { temperature freezing = new temperature(32,0,0); temperature boiling = new temperature(212,100,33); temperature human = new temperature(98.6,37,12.21); System.out.println("water freezes at " + freezing.getFahrenheit() + " Fahrenheit, " + freezing.getCelsius() + " Celisus, and " + freezing.getNewton() + " Newton"); System.out.println("water boils at " + boiling.getFahrenheit() + " Fahrenheit, " + boiling.getCelsius() + " Celisus, and " + boiling.getNewton() + " Newton"); System.out.println("human body temperature is " + human.getFahrenheit() + " Fahrenheit, " + human.getCelsius() + " Celisus, and " + human.getNewton() + " Newton"); } } class temperature { public temperature (double f, double b, double h) { Fahrenheit = f; // &lt;==== ADD? Celsius = b; // &lt;==== ADD? Newton = h; // &lt;==== ADD? } double Fahrenheit; double Celsius; double Newton; public void setTemp(double Fahrenheit, double Celsius, double Newton){ setFahrenheit(Fahrenheit); setCelsius(Celsius); setNewton(Newton); } public double getNewton() { return Newton; } public double getCelsius() { return Celsius; } public double getFahrenheit() { return Fahrenheit; } public void setFahrenheit(double Fahrenheittemp){ Fahrenheit = Fahrenheittemp; } public void setCelsius(double Celsiustemp){ Celsius = Celsiustemp; } public void setNewton(double Newtontemp){ Newton = Newtontemp; } }
answers question: http://stackoverflow.com/q/23815650
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36638306
has comment: http://stackoverflow.com/comment/36638314
accepted answer of: http://stackoverflow.com/q/23815650
has comment: http://stackoverflow.com/comment/36638282
has comment: http://stackoverflow.com/comment/36638419

http://stackoverflow.com/comment/36841094
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23919267
score: 0
has text: Why the cgal tag? It doesn't look like progal is related.

http://stackoverflow.com/comment/36588996
comment on: http://stackoverflow.com/q/23788175
score: 0
type: Comment
type: QuestionComment
has text: when correct the code apeare the same error

http://stackoverflow.com/a/23935424
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23826895
has comment: http://stackoverflow.com/comment/94975469
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23826895
has body: Turns out Drools uses the Eclipse JDT compiler to compile rules. Upgrading the JDT version did the trick. However if that fails, upgrading the Drools version might also help.

http://stackoverflow.com/comment/36596790
comment on: http://stackoverflow.com/q/23793885
score: 2
has text: Could you please post the code you tried but didn't work, so we will be able to answer your question more specifically.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36684626
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23840007
score: 0
has text: You should probably create a `JMenu`, then create a `JMenuItem` and add it to the `JMenu`.

http://stackoverflow.com/comment/36586105
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787943
has text: Since it's optional, what happens when you remove the MAVEN_OPTS altogether?

http://stackoverflow.com/a/24036266
has body: The answer to this was frustratingly simple. The XPATH I was using was not specific enough and returning multiple objects when I thought it was only returning one, it then was directing Seleniums attention to the first in the array which was not visible (as it correctly reporting). Once I changed my method to return the array of matching objects and simply cycle through until I found one that was both enabled and displayed to use Robert was my mothers brother. The dodgy XPATH issue comes from the fact that I checked the XPATH within firepath (in firefox) and this was correctly highlighting the object I wanted but selenium could somehow actually multiples of the same object (despite the page source not showing more than 1 object) and this wasn't highlighted to me until I used the firefox Selenium addin to record my actions. So the lesson learned here is to not trust an XPATH generated via firepath 100% if it doesnt appear to be working without checking in the Selenium IDE first...!
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54996203
downvote count: 0
answers question: http://stackoverflow.com/q/23833592
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23833592

http://stackoverflow.com/comment/54941575
has text: @PacoAbato did you get any solution ?
score: 0
comment on: http://stackoverflow.com/q/23934218
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23809724
has body: In order to JSF to change the value of the variable "viewType" in the bean, it must have a getter (getViewType()) and a setter (setViewType(...)) (or have public access).
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23808665

http://stackoverflow.com/comment/47565753
comment on: http://stackoverflow.com/a/23841614
type: Comment
score: 0
type: AnswerComment
has text: Thank you for this. This resolved my issue with "java.exe finished with non-zero exit value 2"..

http://stackoverflow.com/comment/36615340
has text: Not `Java.util.Date` itself is deprecated - just the constructor that takes a single string. How is `gettIME` defined in your code?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23800372

http://stackoverflow.com/a/23922627
has body: Use VisualVM to discover how many instances (how many ImageIcons, how many JLabels, etc.) are in memory. Once you know which instances are in memory (and how much memory each consumes) you can know the cause of your problem.
type: Answer
answers question: http://stackoverflow.com/q/23922447
score: 0

http://stackoverflow.com/comment/36587124
type: QuestionComment
comment on: http://stackoverflow.com/q/23788751
has text: Can u show me it in JSfiddle ? OR please paste full Javascript code here..
score: 0
type: Comment

http://stackoverflow.com/comment/36604602
has text: It is the same. You also have Locale on Android. Just not the main method :)
comment on: http://stackoverflow.com/a/23798019
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23901162
has comment: http://stackoverflow.com/comment/36801969
has title: How to tokenize if there is different length between words
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36801822
answer count: 1
has answer: http://stackoverflow.com/a/23901296
has comment: http://stackoverflow.com/comment/36801841
tagged with: tokenize
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36801736
has comment: http://stackoverflow.com/comment/36802129
has comment: http://stackoverflow.com/comment/36801760
has comment: http://stackoverflow.com/comment/36801712
upvote count: 0
has comment: http://stackoverflow.com/comment/36801779
has comment: http://stackoverflow.com/comment/36801922
has body: So, I read and write back to it. Some of the spaces between strings in the file are of different length, and I was wondering how I could check to see if the length between words is different I CAN ONLY USE substring and indexOf FOR THIS PROJECT public class Tokenize { public static void main(String[] args) throws IOException { { final String DELIMITER = " "; final String DELIMITER_TAB = " "; int index = 0; BufferedReader inputFile = new BufferedReader(new FileReader(INPUT_FILE)); PrintWriter outputFile = new PrintWriter(new FileWriter(OUTPUT_FILE)); } } I want everything to be a separate line, like Special
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36801875
score: -3

http://stackoverflow.com/q/23807566
has comment: http://stackoverflow.com/comment/36634719
has body: I receive the error message (java.sql.SQLException) java.sql.SQLException: Before start of result set when I am trying to get a record from a MySQL database. This is the code I am using: public TimelineJDBC(String name, String startTime){ final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; final String DB_URL = "jdbc:mysql://localhost/TimeLineDB"; final String USER = "root"; final String PASS = "XXXX"; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(DB_URL, USER, PASS); String sql= "SELECT * FROM TIMELINE WHERE NAME= 'MyLife2' AND STARTTIME= '2008-02-01';"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql); this.timeline.setId(rs.getInt("ID")); this.timeline.setName(rs.getString("NAME")); this.timeline.setDescriprion(rs.getString("DESCRIPTION")); this.timeline.setStartTime(rs.getString("STARTTIME")); this.timeline.setEndTime(rs.getString("ENDTIME")); this.timeline.setPicture(rs.getString("PICTURE")); TimeUnit enumVal = TimeUnit.valueOf(rs.getString("SCALE")); this.timeline.setScale(enumVal); } catch(SQLException ex){ System.err.println("Error in retrieving a timeline record from database:"+ ex.getMessage()); } catch (Exception e){ System.err.println(e.getMessage()); } } Once trying to read the result set this.timeline.setId(rs.getInt("ID")); this SQLException is thrown: (java.sql.SQLException) java.sql.SQLException: Before start of result set I am aware of the issue where you have to go to the next result set (rs.next();) but this doesn't seem to help, since the next result set is null. Here's a screenshot showing what is returned in the initial result set: https://i.sstatic.net/6NB6b.jpg When trying to run the query manually on the same database, a correct ResultSet is formed, so it seems the problem doesn't lie with the database.
tagged with: java
has comment: http://stackoverflow.com/comment/36622817
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23807852
answer count: 2
score: 0
tagged with: sql
upvote count: 1
has comment: http://stackoverflow.com/comment/36623833
downvote count: 1
has answer: http://stackoverflow.com/a/23807808
has comment: http://stackoverflow.com/comment/36622102
favorite count: 0
has comment: http://stackoverflow.com/comment/36622619
has title: MySQL, using JDBC in a Java application - Seemingly empty result set, but query is well formed
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/a/23908590
score: 3
has body: In my experience, linked lists are more efficient than array lists in one case only - where you frequently want to add or remove multiple elements from random points within the list in a single pass through it. In every other case, an array list is usually better - faster lookup, random access, less memory. If ArrayDeque is based on an array - it is likely to not need to allocate additional node objects for each item stored within it. Since a stack usually has items added / removed to the end of the list, an array based solution is likely to be more efficient
upvote count: 3
has comment: http://stackoverflow.com/comment/36815486
answers question: http://stackoverflow.com/q/23908511
type: Answer
has comment: http://stackoverflow.com/comment/36815310
downvote count: 0

http://stackoverflow.com/q/23866019
has comment: http://stackoverflow.com/comment/36734163
type: Question
has answer: http://stackoverflow.com/a/23866056
has comment: http://stackoverflow.com/comment/36734162
has answer: http://stackoverflow.com/a/23866154
upvote count: 2
tagged with: java
score: 0
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36735246
type: UnansweredQuestion
has body: I want to make a executable jar which can run in only one machine.once it is run in any machine it can not be run in another machine. Means i want to make one license per user type application. I want to make this application using Java. Any help on this would be appreciated. Thanks in advance.
has title: Want to make a application like one license per user in java
favorite count: 0

http://stackoverflow.com/a/23792644
has comment: http://stackoverflow.com/comment/36708116
has comment: http://stackoverflow.com/comment/36702107
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36643335
answers question: http://stackoverflow.com/q/23786574
has comment: http://stackoverflow.com/comment/36644006
upvote count: 1
has comment: http://stackoverflow.com/comment/36600962
has body: The sentences, I need my model separate from the GUI. This presents a problem since 99% of tutorials suggest to call for repaint within other methods. and Now, I have read that by putting the main thread to sleep, you give the EDT time to run the repaint. don't sound quite right to me, so I'll try to clear things up a bit and maybe If you reevaluate the fundamental ideas you had behind those statements you can find the piece of information that you were missing. First of all, always keep in mind this scheduling model that we were talking about. You can not say "EDT do this for me now!". It is always "EDT here's one more task you need to do, do it when you are done with whatever you are doing". So the EDT has a queue of "tasks" to do and goes through it consuming one by one. These tasks are usually created by events: pressing a button gives the EDT a task to do, when the state of a component of the GUI changes some listeners may be notified and enqueue some work in the EDT. However, you can also straight up say "EDT execute this piece of code, later". This is what you do with invokeLater, you schedule a work to do in the EDT whenever it's free. Even if you call invokeLater from the EDT the task is scheduled, not executed at the moment. The same happens with invokeAndWait yes, the code is executed sequentially as if it was executed at the moment, but it is still an scheduled work. So repaint() is no exception to this. repaint() doesn't repaint the GUI, but rather schedules the repainting of the GUI. However repaint() is exceptional in the sense that it can be called from outside the EDT! This is not surprising now that we know that the only thing that does is scheduling a certain work, it does not actually mess with the GUI so you can call it wherever you want. This means that the line SwingUtilities.invokeLater(processEventsRunnable); where processEventsRunnable basically executes a repaint() is meaningless and the whole tick system overly complex and unnecesary. You…
type: Answer
has comment: http://stackoverflow.com/comment/36600749

http://stackoverflow.com/a/23926473
has comment: http://stackoverflow.com/comment/36852185
type: Answer
accepted answer of: http://stackoverflow.com/q/23926329
score: 3
downvote count: 1
upvote count: 4
has body: You'll have to iterate over the enum set: for (Color p : Color.values()) { // keep track of min "index" } Remember that an enum is essentially collection of predefined object instances. RED(100) is calling the Color(int value) constructor. That said, I could make a color enum with values defined like this: RED("best", 14, 3.33546) Hence, the logic for finding the minimum "index" will be different case by case.
has comment: http://stackoverflow.com/comment/36887248
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23926329

http://stackoverflow.com/q/23923470
has body: I have this set up - Java application is collecting and pushing data to mongodb for client side to retrieve and display. I want to try to use meteor for the client side. What is the best approach with meteor: use DDPClient to connect to meteor's mongodb and only push data to it or configure meteor to point to my existing mongodb that is already collecting data from my Java application
accepted answer: http://stackoverflow.com/a/23926439
type: AnsweredQuestion
tagged with: ddp
score: 1
tagged with: java
type: Question
tagged with: mongodb
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23926439
tagged with: meteor
has title: meteor and java app data push
upvote count: 1

http://stackoverflow.com/q/23783324
has answer: http://stackoverflow.com/a/23802136
tagged with: apache-camel
has answer: http://stackoverflow.com/a/23880084
has title: Passing S3 Bucket Name with as a Parameter from properties file to aws-s3 camel component
type: Question
answer count: 2
tagged with: apache
score: 0
type: UnansweredQuestion
tagged with: maven
has body: I have a camel route end point as below where I want to replace the hardcoded s3 bucket name and replace with a parameter and pass it from a Properties file. <to uri="aws-s3://input-test-bucket?amazonS3Client=#aws-s3-client"/> I have a bean as below which passes the aws-s3-client containing the access key and the secret key The values for the aws.accessKey and the aws.secretKey are coming from a properties file from where I want the bucket name also to be taken. Please could anyone let me know how to add the bucket name to the bean and pass it to the aws-s3 route as a parameter.
tagged with: java

keyword
tags question: http://stackoverflow.com/q/23822375
tag name: keyword
tags question: http://stackoverflow.com/q/23863527
type: Tag

http://stackoverflow.com/comment/36832589
score: 0
comment on: http://stackoverflow.com/q/23917326
type: Comment
type: QuestionComment
has text: @BheshGurung please dude, read my question again... i'm asking about memory allocation size inside heap, size() will be 0 by default if i use it... but my question is different

http://stackoverflow.com/q/23862594
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Not able to read merge fields from docx file using docx4j
tagged with: docx4j
has comment: http://stackoverflow.com/comment/36736175
tagged with: xml-parsing
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
has comment: http://stackoverflow.com/comment/36728980
tagged with: mailmerge
has body: I am using this example to get all the merge fields using docx4j While using this I am getting below exception. I am using docx4j 3.1.0 version . I also used same file given in the example . Exception in thread "main" java.lang.IllegalAccessError: tried to access class org.apache.xml.serializer.ExtendedContentHandler from class org.apache.xalan.transformer.TransformerImpl at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1233) at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1060) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1268) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251) at org.docx4j.XmlUtils.transform(XmlUtils.java:992) at org.docx4j.XmlUtils.transform(XmlUtils.java:883) at org.docx4j.model.fields.FieldsPreprocessor.complexifyFields(FieldsPreprocessor.java:94) at org.docx4j.model.fields.merge.MailMerger.performMerge(MailMerger.java:385) at com.test.word.FieldsMailMerge.main(FieldsMailMerge.java:84)
has comment: http://stackoverflow.com/comment/36733945
type: UnansweredQuestion

http://stackoverflow.com/comment/36801779
has text: You should just use for(String token: lineOfText.split(DELIMITER+"+")) System.out.println(token);
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23901162
type: Comment

http://stackoverflow.com/q/23783641
tagged with: playframework
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23785638
upvote count: 4
type: AnsweredQuestion
score: 3
tagged with: java
has body: I am working on a project where I have to integrate Sencha ExtJS with Play! Framework java project. But could not find any such tutorial or module in Play! documentation.I am curious if this is possible to do? Can someone provide me any tutorial or existing Play 2.x example where Sencha ExtJS is been used as a front end? Thanks a lot!
type: Question
has title: Play! Framework Java Project integration with Sencha ExtJS?
tagged with: extjs
accepted answer: http://stackoverflow.com/a/23785638

http://stackoverflow.com/comment/36676468
type: Comment
comment on: http://stackoverflow.com/q/23834884
score: 0
has text: Well that is the problem, how can I promise that all the clients call await before the notifyall apply?
type: QuestionComment

http://stackoverflow.com/q/23913865
has title: Java - Counting how many times an integer appears in a matrix
tagged with: matrix
upvote count: 0
has answer: http://stackoverflow.com/a/23913954
has body: I need to find how many times a certain integer appears in a matrix and whatever I do, the result I get is always "0". Most probably the answer is simple, but I just can't find it, and I would appreciate some help. :) This is my code: int m, n, c, d, nr = 0, x; Scanner in = new Scanner(System.in); System.out.println("Enter the number of rows:"); m = in.nextInt(); System.out.println("Enter the number of columns:"); n = in.nextInt(); int matrix[][] = new int[m][n]; System.out.println("Enter the elements of the matrix:"); for ( c = 0 ; c &lt; m ; c++ ) for ( d = 0 ; d &lt; n ; d++ ) matrix[c][d] = in.nextInt(); System.out.println("Enter the value for number x:"); x = in.nextInt(); for ( c = 0 ; c &lt; m ; c++ ) { if(c == x) nr++; } for ( d = 0 ; d &lt; n ; d++ ) { if(d == x) nr++; } System.out.println("Number x appears " + nr + " times.");` P.S. I'm pretty new to Java.
has answer: http://stackoverflow.com/a/23914029
favorite count: 0
has comment: http://stackoverflow.com/comment/36825378
score: -2
has answer: http://stackoverflow.com/a/23913961
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23913954
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36825292
type: Question
possible better answer: http://stackoverflow.com/a/23913979
answer count: 6
has answer: http://stackoverflow.com/a/23913979
has answer: http://stackoverflow.com/a/23914038
has answer: http://stackoverflow.com/a/23913984

http://stackoverflow.com/comment/36973152
type: Comment
has text: That's right. It may be not possible to spot on x86 hardware due to some implementation details, but Sparc or PowerPC can allow such a reordering.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23991842

http://stackoverflow.com/a/23924135
has body: Technically, double clicking a cell and typing in a cell (which supports text editing) essentially boils down to the same thing. You can actually double click a text editable cell to start the editing process Cell editability comes to down to two factors, the result of TableModel#isCellEditable and TableCellEditor#isCellEditable, when these two methods return true a cell can be placed into edit mode. A text editable cell is, generally, a special case, where the cell can be edited by typing in the cell while it has focus and double clicking (and pressing F2 in most cases). The case for providing more than one mechanism for initializing the editing process will come down to decisions made over usability and existing conventions across multiple platforms. It's likely that some attempt was made to mix expectations where possible so users of different platforms could feel more comfortable with the process, but this is simply speculation. The problem is, even amongst users of a single platform, there are different expectations about how something like this works, so rather the supply a single trigger, the system has been designed to allow for multiple triggers, where it would be applicable. For example, it wouldn't make sense for a cell containing an image to allow the user to edit the cell simply by typing in it. Updated If you take a look at the isCellEdtiable method for DefaultCellEditor... public boolean isCellEditable(EventObject anEvent) { if (anEvent instanceof MouseEvent) { return ((MouseEvent)anEvent).getClickCount() &gt;= clickCountToStart; } return true; } You will note that the only event that actually stops a cell from entering edit mode is a MouseEvent, but only when the number of mouse clicks is less than clickCountToStart, which is set to 2 when using a JTextField as the editor, otherwise it's 1
has comment: http://stackoverflow.com/comment/36885791
has comment: http://stackoverflow.com/comment/36862681
has comment: http://stackoverflow.com/comment/36881668
has comment: http://stackoverflow.com/comment/36845855
has comment: http://stackoverflow.com/comment/36846584
upvote count: 3
has comment: http://stackoverflow.com/comment/36918707
has comment: http://stackoverflow.com/comment/36846505
has comment: http://stackoverflow.com/comment/36846713
has comment: http://stackoverflow.com/comment/36846468
has comment: http://stackoverflow.com/comment/36846306
has comment: http://stackoverflow.com/comment/36905913
type: Answer
has comment: http://stackoverflow.com/comment/36846895
has comment: http://stackoverflow.com/comment/36846829
has comment: http://stackoverflow.com/comment/36885682
has comment: http://stackoverflow.com/comment/36846673
answers question: http://stackoverflow.com/q/23924066
score: 3
has comment: http://stackoverflow.com/comment/36848582
downvote count: 0
has comment: http://stackoverflow.com/comment/36849356
has comment: http://stackoverflow.com/comment/36845814

http://stackoverflow.com/q/23880797
has body: Basically I'm trying to dynamically add buttons when I click another button When I click the "Add a Class" button I would like the "Math button to appear above it like so: Link , the "Math" button is just an example of what it should look like, it is not programmed dynamically. Currently, when I click the "Add a Class" button, this is what happens: link I would like the dynamically added button in this case "New button" to look identical to "Math" Here is my xml layout file: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#7BEDFC" > <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Classes" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#FFFFFF" android:textStyle="bold" /> Roundedcorners drawable file: <?xml version="1.0" encoding="utf-8"?> <corners android:radius="10dip" /> <stroke android:width="1dip" android:color="#FFFFFF" /> <gradient android:angle="-90" android:startColor="#FFFFFF" android:endColor="#FFFFFF" /> <corners android:radius="10dip" /> <stroke android:width="1dip" android:color="#FFFFFF" /> <solid android:color="#FFFFFF"/> <corners android:radius="10dip" /> <stroke android:width="1dip" android:color="#FFFFFF" /> <gradient android:angle="-90" android:startColor="#FFFFFF" android:endColor="#FFFFFF" /> Relevant part of activity file: public class MainActivity extends ActionBarActivity { LinearLayout buttonsLayout; Button addClass; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonsLayout = (LinearLayout) findViewById(R.id.classesLayout); addClass = (Button) findViewById(R.id.bClass); addClass.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Button newButton = new Button(MainActivity…
tagged with: xml-layout
answer count: 1
favorite count: 0
tagged with: android
downvote count: 1
has title: Translating features from xml to java
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/23881100
accepted answer: http://stackoverflow.com/a/23881100

http://stackoverflow.com/comment/36623589
has text: Message Selectors are a part of JMS specification. No matter what vendor you use be it RabbitMQ, ActiveMQ or Websphere you will have Message selectors. You may want to see RabbitMQ documentation to see how it is used.
type: Comment
comment on: http://stackoverflow.com/a/23808291
score: 0
type: AnswerComment

http://stackoverflow.com/q/23883106
has comment: http://stackoverflow.com/comment/36766782
linked to: http://stackoverflow.com/q/11904691
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23883565
score: 2
has comment: http://stackoverflow.com/comment/36767366
upvote count: 2
has title: java.lang.ClassNotFoundException: Didn't find class "com.google.android.maps.MapView"
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36767058
has answer: http://stackoverflow.com/a/23883355
answer count: 2
has body: I am trying to add Map functionality to my app. My IDE is AndroidStudio. I've gone to the SDK Manager and installed both Google Play services and Google repository. Then, in my gradle file, I've added google play services: dependencies { compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:support-v4:19.1.+' compile 'com.google.android.gms:play-services:4.3.23' compile fileTree(dir: 'libs', include: ['*.jar']) } After this, I've synced the project with the gradle files. In my fragment, I've added MapView (and my API key). No error during compile, however, I get this during runtime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.maps.MapView" on path: DexPathList[[zip file "/data/app/com.app.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.blueforcemedia.blueforcetracker-1, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) } What am I doing wrong?
has comment: http://stackoverflow.com/comment/36766811
tagged with: google-maps
downvote count: 0
has comment: http://stackoverflow.com/comment/36766519
favorite count: 0

http://stackoverflow.com/q/23854915
has answer: http://stackoverflow.com/a/23855114
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36713223
has body: This doesn't output properly. I've read to use \\ but that gives me another error. any help/alternatives? string = string.replaceAll("a", newAlphabet.substring(0,1)); string = string.replaceAll("b", newAlphabet.substring(1,2)); string = string.replaceAll("c", newAlphabet.substring(2,3)); string = string.replaceAll("d", newAlphabet.substring(3,4)); string = string.replaceAll("e", newAlphabet.substring(4,5)); This is just part of the code. I'm trying to change a message so that every letter of the alphabet is changed to another letter. Like a jumped alphabet abcdefghijklmnopqrstuvwxyz would change to something like zmlapqokxswncdejibvhfurtgy so a = z etc when I try get the output, half of it is correct and some is just plain wrong, and I don't know why
has comment: http://stackoverflow.com/comment/36713203
has answer: http://stackoverflow.com/a/23854946
has answer: http://stackoverflow.com/a/23854971
answer count: 3
downvote count: 1
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/36713302
type: UnansweredQuestion
type: Question
has title: Java replaceAll wrong output

http://stackoverflow.com/a/35290554
answers question: http://stackoverflow.com/q/23779758
type: Answer
upvote count: 1
score: 1
has body: I think EPartService.isPartVisible(MPart) (rather than MPart.isVisible()) solves your first problem.
downvote count: 0

http://stackoverflow.com/a/23821022
has comment: http://stackoverflow.com/comment/36648763
has comment: http://stackoverflow.com/comment/36675271
has comment: http://stackoverflow.com/comment/36648737
has comment: http://stackoverflow.com/comment/36663851
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36648711
has comment: http://stackoverflow.com/comment/36662313
type: Answer
answers question: http://stackoverflow.com/q/23820940
has comment: http://stackoverflow.com/comment/36649117
has comment: http://stackoverflow.com/comment/36648764
score: 1
has body: First, I would start with a Timer of some sort, I'm going to use a Swing Timer as it easy, but you could use a java.util.Timer instead... private Timer updateTimer; //... updateTimer = new Time(10000, new ActionListener() { public void actionListener(ActionEvent e) { } }); updateTimer.setRepeats(false); updateTimer.start(); This allows you to be notified in about 10 seconds time... Then you need a SwingWorker that can do the actual work... public class UpdateWorker extends SwingWorker&lt;TableModel, Void&gt; { private Monitor monitor; private Timer updateTimer; public UpdateWorker(Monitor monitor, Timer updateTimer) { this.monitor = monitor; this.updateTimer = updateTimer; } @Override protected TableModel doInBackground() throws Exception { Vector&lt;Vector&gt; rowData = dbmonitor.getJobsData(); Vector columnNames = dbmonitor.getColumnNames(); DefaultTableModel model = new DefaultTableModel(rowData, columnNames); return model; } @Override protected void done() { try { TableModel model = get(); monitor.updateTable(model); } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); } updateTimer.restart(); } } Now in the actionPerformed method of the ActionListener assigned to the timer, you would do something like.. public void actionListener(ActionEvent e) { UpdateWorker worker = new UpdateWorker(monitor, this); worker.execute(); } To execute the worker. The reason for having a non-repeating timer is to ensure that the next update is set for n seconds from when the update completes, so you don't get overlapping updates Oh, and this will require to update your Monitor to accept a TableModel rather then the Vectors you are using to create one, it's just simpler that way...
has comment: http://stackoverflow.com/comment/36681463
has comment: http://stackoverflow.com/comment/36649245
has comment: http://stackoverflow.com/comment/36649224

http://stackoverflow.com/comment/36581406
type: QuestionComment
comment on: http://stackoverflow.com/q/23785861
score: 0
has text: Do you mean like ${project.plugin.configuration.deployLocation} ?
type: Comment

http://stackoverflow.com/a/54324863
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23860533
score: 1
downvote count: 0
has body: I had a similar problem, and could think of three different intermediate structures from which to create a copy of the stream: a List, an array and a Stream.Builder. I wrote a little benchmark program, which suggested that from a performance point of view the List was about 30% slower than the other two which were fairly similar. The only drawback of converting to an array is that it is tricky if your element type is a generic type (which in my case it was); therefore I prefer to use a Stream.Builder. I ended up writing a little function that creates a Collector: private static &lt;T&gt; Collector&lt;T, Stream.Builder&lt;T&gt;, Stream&lt;T&gt;&gt; copyCollector() { return Collector.of(Stream::builder, Stream.Builder::add, (b1, b2) -&gt; { b2.build().forEach(b1); return b1; }, Stream.Builder::build); } I can then make a copy of any stream str by doing str.collect(copyCollector()) which feels quite in keeping with the idiomatic usage of streams.

http://stackoverflow.com/q/23831886
has body: Answer is found : ${account[prop]} instead of ${account.get(prop)} works Accounts is a list of map with type like //[{"id":"1","location":"warehouse1"},{"id":"2","location":"warehouse2"}] ArrayList&lt;HashMap&lt;String, String&gt;&gt; t = m.t(); root.put("accounts", t); Writer out = null; try { out = context.response.getWriter(); T.getViewTpl(tplName).process(root, out); } catch (IOException | TemplateException ex) { T.logger.error(T.class.getName(), ex); } finally { try { out.close(); } catch (IOException ex) { T.logger.error(T.class.getName(), ex); } } it is to be rendered as a table. One account one row, and one property of account one column. Below code doesn't work. How it could be done? Thanks in advance! &lt;table&gt; &lt;#list accounts as account&gt; &lt;tr&gt; &lt;#list account?keys as prop&gt; &lt;td&gt;${account.get(prop)}&lt;/td&gt; &lt;/#list&gt; &lt;/tr&gt; &lt;/#list&gt; &lt;/table&gt; Freemarker error is: FreeMarker template error The following has evaluated to null or missing: ==&gt; account.get [in template "account.tpl" at line 14, column 23]
accepted answer: http://stackoverflow.com/a/23832092
linked to: http://stackoverflow.com/q/1497777
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23832092
tagged with: java
has title: Freemarker iterating over hashmap keys in a list
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23852520
upvote count: 0
score: -1
tagged with: freemarker
answer count: 2
has answer: http://stackoverflow.com/a/23852520
favorite count: 0

projectile
tags question: http://stackoverflow.com/q/23859015
tag name: projectile
tags question: http://stackoverflow.com/q/23862178
type: Tag

http://stackoverflow.com/a/23916513
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23915482
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36831577
answers question: http://stackoverflow.com/q/23915482
type: Answer
has body: Adding a second to your pom should work. My guess is that you aren't specifying a unique for each phase. I have my project laid out like so: src/main/resources/foo |_a.txt |_b.txt src/main/resources/bar |_c.txt src/main/resources/baz |_d.txt src/main/resources/fum |_e.txt |_f.txt After a clean validate I end up with my files copied like so: target/location-1 |_a.txt |_b.txt |_c.txt target/location-2 |_d.txt |_e.txt |_f.txt using the following plugin definition in my pom.xml maven-resources-plugin 2.6 copy-resources-1 validate copy-resources ${project.build.directory}/location-1 src/main/resources/foo true src/main/resources/bar true copy-resources-2 validate copy-resources ${project.build.directory}/location-2 src/main/resources/baz true src/main/resources/fum true You should be able to use the above as an example to get your install and xsd files copied.
score: 2

http://stackoverflow.com/q/23854041
has comment: http://stackoverflow.com/comment/36711801
tagged with: java
has body: I have a server application and a client application, and a List (an ArrayList to be specific) exists at the server. The client sends the server some information, the server modifies parts of the List, and sends it to the client by serializing it over the network. The first time this is done, the client receives the List (or is it a copy of/reference to the original?), but after that, the client's List never changes though the server sends a modified version. The server is surely modifying the List because watching it in a debugger clearly shows the modifications. The client-side code is like List&lt;Type&gt; fromServer = new ArrayList&lt;&gt;(); ... // send information ... fromServer = (List&lt;Type&gt;) in.readObject(); and the server-side like List&lt;Type&gt; toClient = new ArrayList&lt;&gt;(); ... // get information from client // add/modify list elements ... out.writeObject(toClient); where in and out are input/output streams over sockets. Why does this happen and what can I do to fix this problem? Is it occuring because the List is assumed to be unchanged? Thanks for your attention!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23854206
has title: Serialization of Frequently Changing List
type: Question
possible better answer: http://stackoverflow.com/a/23854158
has answer: http://stackoverflow.com/a/23854158
tagged with: serialization
accepted answer: http://stackoverflow.com/a/23854206
score: 0
answer count: 2

http://stackoverflow.com/a/23953918
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23925538
has body: Use this Card.find.byId().orderBy("id asc"); //this will give the sorted order by id (entity)
downvote count: 0

http://stackoverflow.com/comment/36767099
comment on: http://stackoverflow.com/q/23882447
has text: How do I add trustedcert entries using keytool?
score: 0
type: Comment
type: QuestionComment

jar
tags question: http://stackoverflow.com/q/23857035
tags question: http://stackoverflow.com/q/23888240
tags question: http://stackoverflow.com/q/23919541
tags question: http://stackoverflow.com/q/23910331
tags question: http://stackoverflow.com/q/23787622
tags question: http://stackoverflow.com/q/23830151
tags question: http://stackoverflow.com/q/23929388
tags question: http://stackoverflow.com/q/23827960
tags question: http://stackoverflow.com/q/23835233
tags question: http://stackoverflow.com/q/23851354
tags question: http://stackoverflow.com/q/23901050
tags question: http://stackoverflow.com/q/23854130
tags question: http://stackoverflow.com/q/23937475
tags question: http://stackoverflow.com/q/23854419
tags question: http://stackoverflow.com/q/23921298
tags question: http://stackoverflow.com/q/23870654
tags question: http://stackoverflow.com/q/23834385
type: Tag
tags question: http://stackoverflow.com/q/23817747
tags question: http://stackoverflow.com/q/23873460
tags question: http://stackoverflow.com/q/23849239
tags question: http://stackoverflow.com/q/23898218
tags question: http://stackoverflow.com/q/23798392
tags question: http://stackoverflow.com/q/23903087
tags question: http://stackoverflow.com/q/23849471
tags question: http://stackoverflow.com/q/23929819
tag name: jar
tags question: http://stackoverflow.com/q/23846325
tags question: http://stackoverflow.com/q/23871175
tags question: http://stackoverflow.com/q/23817482
tags question: http://stackoverflow.com/q/23896341
tags question: http://stackoverflow.com/q/23905333
tags question: http://stackoverflow.com/q/23815817
tags question: http://stackoverflow.com/q/23852974
tags question: http://stackoverflow.com/q/23915619
tags question: http://stackoverflow.com/q/23916949
tags question: http://stackoverflow.com/q/23808286
tags question: http://stackoverflow.com/q/23845766
tags question: http://stackoverflow.com/q/23835324
tags question: http://stackoverflow.com/q/23891128
tags question: http://stackoverflow.com/q/23826009
tags question: http://stackoverflow.com/q/23834716
tags question: http://stackoverflow.com/q/23889972
tags question: http://stackoverflow.com/q/23787254

http://stackoverflow.com/comment/36768647
type: Comment
comment on: http://stackoverflow.com/a/23884180
has text: Thanks. I also uses the default proguard config stored in my SDK. For Retrace, do you mean using logcat? Theres no error in my logcat
type: AnswerComment
score: 0

http://stackoverflow.com/q/23872613
has title: AlertDialog not be shown when receiving sms
has comment: http://stackoverflow.com/comment/36747601
has comment: http://stackoverflow.com/comment/36748330
has comment: http://stackoverflow.com/comment/36746632
has answer: http://stackoverflow.com/a/23874901
answer count: 1
has comment: http://stackoverflow.com/comment/36747714
has comment: http://stackoverflow.com/comment/36746594
has comment: http://stackoverflow.com/comment/36747978
favorite count: 0
has comment: http://stackoverflow.com/comment/36747151
has comment: http://stackoverflow.com/comment/36748102
has comment: http://stackoverflow.com/comment/36746649
has comment: http://stackoverflow.com/comment/36748820
tagged with: android
tagged with: android-alertdialog
has comment: http://stackoverflow.com/comment/36746731
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23874901
score: 0
tagged with: java
upvote count: 1
has body: I work on an app this sending a sms and showing the received sms as an AlertDialog but AlertDialog Not be shown when receiving SMS here is the Code Of my project: MainActivity: package com.am7.masirinfo; public class MainActivity extends Activity { TextView tv; SharedPreferences prefs; Button sendBtn; EditText txtphoneNo; EditText txtMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageButton btn2 = (ImageButton) findViewById(R.id.btn2); btn2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); System.exit(0); } }); ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#8A0441"))); bar.show(); bar.setIcon(R.drawable.bar); bar.setDisplayShowTitleEnabled(false); bar.setDisplayUseLogoEnabled(true); bar.setDisplayHomeAsUpEnabled(false); TextView tx = (TextView)findViewById(R.id.textView1); Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/font.ttf"); tx.setTypeface(custom_font); TextView tx1 = (TextView)findViewById(R.id.textView2); Typeface custom_font1 = Typeface.createFromAsset(getAssets(), "fonts/gmail.ttf"); tx1.setTypeface(custom_font1); TextView tx2 = (TextView)findViewById(R.id.textViewMessage); tx2.setTypeface(custom_font); TextView tx3 = (TextView)findViewById(R.id.textView3); TextView tx4 = (TextView)findViewById(R.id.textView4); sendBtn = (Button) findViewById(R.id.btnSendSMS); txtphoneNo = (EditText) findViewById(R.id.editTextPhoneNo); txtMessage = (EditText) findViewById(R.id.editTextSMS); sendBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { sendSMSMessage(); } }); } protected void sendSMSMessage() { Log.i("Send SMS", ""); String phoneNo = txtphoneNo.getText().toString(); String message = txtMessage.getText().toString(); try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTe…
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36746417
has comment: http://stackoverflow.com/comment/36747268

python
tags question: http://stackoverflow.com/q/23909210
tags question: http://stackoverflow.com/q/23859707
tags question: http://stackoverflow.com/q/23846012
tags question: http://stackoverflow.com/q/23877147
tags question: http://stackoverflow.com/q/23890939
tag name: python
tags question: http://stackoverflow.com/q/23827025
tags question: http://stackoverflow.com/q/23933513
type: Tag
tags question: http://stackoverflow.com/q/23870859
tags question: http://stackoverflow.com/q/23920431
tags question: http://stackoverflow.com/q/23857670
tags question: http://stackoverflow.com/q/23817840

http://stackoverflow.com/comment/36863018
has text: I just done that but getting error---org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
comment on: http://stackoverflow.com/a/23929197
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36871186
has text: What is the ps2 SQL? Have you tested the SQL to make sure it returns rows?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23938276
score: 1

http://stackoverflow.com/q/23902159
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36803763
tagged with: mouse-cursor
favorite count: 0
has comment: http://stackoverflow.com/comment/36803796
accepted answer: http://stackoverflow.com/a/23902201
has comment: http://stackoverflow.com/comment/36803825
has comment: http://stackoverflow.com/comment/36803933
has comment: http://stackoverflow.com/comment/36803814
has comment: http://stackoverflow.com/comment/36803718
has title: Java custom cursor won't work on new computer
type: AnsweredQuestion
has body: I recently bought a new computer and I moved my projects from my old one to my new one. I did a compilation on all of my projects and they all worked fine, and most of them still do on my new computer, but one project in particular wouldn't display the custom cursor that I had moved. I made sure that I moved the picture with the project just to rule that out. I rewrote the source to match the new location on my new computer, but it still won't display. It gives me the error message: Exception in thread "main" java.lang.IndexOutOfBoundsException: invalid hotSpot at sun.awt.CustomCursor.&lt;init&gt;(Unknown Source) at sun.awt.windows.WCustomCursor.&lt;init&gt;(Unknown Source) at sun.awt.windows.WToolkit.createCustomCursor(Unknown Source) at wtalfvn.Window.&lt;init&gt;(Window.java:32) at wtalfvn.Main.main(Main.java:9) My old computer is a 32 bit and my new one is a 64 bit, both run on Windows 7, I am using eclipse Kepler, but does it matter when using the Cursor and Toolkit? Here is my code I used to create my Cursor Image cursor = Toolkit.getDefaultToolkit().getImage("graphx/PNG/cursor.png"); Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(cursor,new Point(this.getX(),this.getY()), "cursor"); this.setCursor(c); EDIT: Here is the whole code for those who want to see it. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Window extends JFrame{ Image ico= Toolkit.getDefaultToolkit().getImage("graphx/ico/icon.PNG"); TextBox tb=new TextBox(); public Window(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800,600); setVisible(true); setFocusable(true); getContentPane().setBackground(Color.BLACK); setIconImage(ico); setLocationRelativeTo(null); setResizable(false); setTitle("MYTITLE"); addKeyListener(new KeyAdapter(){ public void keyTyped(KeyEvent e) { if (e.getKeyChar()==KeyEvent.VK_ESCAPE){ System.exit(0); } } }); Image cursor = Toolkit.getDefaultToolkit().getImage( getClass().getResource("/graphx/PNG/cursor.png")); Cursor c …
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36803807
has answer: http://stackoverflow.com/a/23902201
tagged with: eclipse

http://stackoverflow.com/q/23937475
tagged with: web-applications
upvote count: 1
type: Question
tagged with: jar
has comment: http://stackoverflow.com/comment/36870727
has comment: http://stackoverflow.com/comment/36869464
has title: HTML: how to deploy applet (preferably .jar file)
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36869577
downvote count: 0
has comment: http://stackoverflow.com/comment/36869657
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17187520
has comment: http://stackoverflow.com/comment/36871005
answer count: 0
score: 1
tagged with: java
has body: As the title explains it, I need to deploy a java app inside html document. I tried: and: It would be optimal, if I could deploy .jar file (aplication was made with NetBeans and the index.html file is in root of the application's folder).
has comment: http://stackoverflow.com/comment/36869619

http://stackoverflow.com/comment/36846636
has text: Oh wow, and the stupidity sinks in... Thanks a ton man, I completely see what I did wrong now
comment on: http://stackoverflow.com/a/23924532
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23811885
answers question: http://stackoverflow.com/q/23811851
has body: Yes, jaja++ will increment jaja to 2, but the result of that expression is still 1, and *2*2 will yield 4, which is assigned to jaja, overwriting the 2.
score: 0
accepted answer of: http://stackoverflow.com/q/23811851
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36631344
type: Answer

http://stackoverflow.com/comment/36681329
has text: *I'll test this in a bit if I don't get an answer.* Please test before asking.
comment on: http://stackoverflow.com/q/23838330
type: Comment
type: QuestionComment
score: 5

http://stackoverflow.com/a/23795100
type: Answer
accepted answer of: http://stackoverflow.com/q/23794997
downvote count: 0
answers question: http://stackoverflow.com/q/23794997
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/83499219
has body: Normally RMI codebase URLs are HTTP URLs, and they normally refer to a JAR file, not a directory. -Djava.rmi.server.codebase=file:/C:/Users/samue_000/pubic_html/classes That's a file: URL, and it's only going to work on the same system it applies to. If the server is on a different host it won't make head or tail of that. However as it is all on the same machine it should work. Can you post the remote interface?
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36783496
has comment: http://stackoverflow.com/comment/36616807
has comment: http://stackoverflow.com/comment/36643499

xss
tags question: http://stackoverflow.com/q/23810101
tags question: http://stackoverflow.com/q/23804229
type: Tag
tag name: xss

http://stackoverflow.com/q/23921389
downvote count: 0
has title: Java Servlet - Redirect URL
tagged with: servlets
has comment: http://stackoverflow.com/comment/36840253
has comment: http://stackoverflow.com/comment/36840314
accepted answer: http://stackoverflow.com/a/23921640
has comment: http://stackoverflow.com/comment/36840540
favorite count: 0
linked to: http://stackoverflow.com/q/8570805
possible better answer: http://stackoverflow.com/a/23921671
has answer: http://stackoverflow.com/a/23921671
tagged with: servlet-filters
has body: The URLs of my website are www.example.com/?id=THEPRODUCTID#i where THEPRODUCTID is an alphanumeric string. Please note that #i is present at the end. The problem is that Google crawlers are ignoring the #i specified on Sitemap.xml, so the results I can see on Google are www.example.com/?id=THEPRODUCTID. As a quick solution, I want to create a servlet that redirects www.example.com/?id=THEPRODUCTID to www.example.com/?id=THEPRODUCTID#i. I am not sure how to do the mapping, or if it should be a filter, redirect, forward,... any guidance is very much appreciated.
type: AnsweredQuestion
tagged with: hashbang
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36840282
upvote count: 1
linked to: http://stackoverflow.com/q/10786042
type: Question
has answer: http://stackoverflow.com/a/23921640
has comment: http://stackoverflow.com/comment/36839969
answer count: 2
tagged with: google-crawlers
has comment: http://stackoverflow.com/comment/36840277

http://stackoverflow.com/q/23837424
has comment: http://stackoverflow.com/comment/36683613
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36692049
has comment: http://stackoverflow.com/comment/36689806
has comment: http://stackoverflow.com/comment/36691852
has comment: http://stackoverflow.com/comment/36680753
has comment: http://stackoverflow.com/comment/36689701
has answer: http://stackoverflow.com/a/23837633
has answer: http://stackoverflow.com/a/23838595
has comment: http://stackoverflow.com/comment/36680731
has comment: http://stackoverflow.com/comment/36690795
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/36680292
type: Question
has comment: http://stackoverflow.com/comment/36683576
has comment: http://stackoverflow.com/comment/36689705
has comment: http://stackoverflow.com/comment/36684938
has comment: http://stackoverflow.com/comment/36685756
has comment: http://stackoverflow.com/comment/36679551
has comment: http://stackoverflow.com/comment/36689564
score: 0
has title: JLabel Icon not showing after change
answer count: 2
has body: I tried looking up this question, but most of the answers are that the file path is wrong, but that's most likely not the case. The file works the 1st time I use it. I am making a battleships game, and use JLabels to show ships on map. I want to make a button to rotate ship from horizontal to vertical but it's icon disappears when I try to change it. When I run this constructor code: public Ship(int size, String direction, boolean active, Client c, ClientGUI cg) { this.c = c; this.cg = cg; health = size; this.active = active; this.direction = direction; file = "img/" + Integer.toString(health) + direction + ".png"; // String try { System.out.println(file); tx = ImageIO.read(new File(file)); // BufferedImage } catch (IOException e) { e.printStackTrace(); } texture = new JLabel(new ImageIcon(tx)); if (direction.equals("v")) texture.setBounds(0, 0, 40, 40 * size); else texture.setBounds(0, 0, 40 * size, 40); texture.setVisible(true); } everything works and I can see the image. But then I try to rotate it, using pretty much the same code: void rotate() { if (direction.equals("h")) { direction = "v"; file = "img/" + Integer.toString(health) + direction + ".png"; try { System.out.println(file); tx = ImageIO.read(new File(file)); } catch (IOException e) { e.printStackTrace(); } texture.setBounds(0,0,40, 40 * size); texture.setIcon(new ImageIcon(tx)); } else { direction = "h"; file = "img/" + Integer.toString(health) + direction + ".png"; try { System.out.println(file); tx = ImageIO.read(new File(file)); } catch (IOException e) { e.printStackTrace(); } texture.setIcon(new ImageIcon(tx)); texture.setBounds(0,0,40 * size, 40); } cg.repaint(); // not sure if I need to do this } and it disappears... I tried placing two ships, one is rotated, it's just missing the JLabel or the icon on JLabel.
tagged with: jlabel

http://stackoverflow.com/q/23849850
type: Question
has comment: http://stackoverflow.com/comment/36709686
has comment: http://stackoverflow.com/comment/36709481
score: 0
has comment: http://stackoverflow.com/comment/36709117
has comment: http://stackoverflow.com/comment/36709633
tagged with: hsqldb
has body: I am building a simple spring web application for educational purposes and I have a little problem with the persistence level- java.lang.IllegalStateException: EntityManager is closed is thrown when I try to get something from the database. The objects are persisted, but when I get try to make a query that exception is thrown. So I am using Hibernate with HSQL inmemory db and here is my persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> org.hibernate.ejb.HibernatePersistence <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:testDB"/> <property name="sqltool.charset" value="UTF-8" /> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="show_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create"/> <property name="current_session_context_class" value="thread"/> <property name="hibernate.show_sql" value="true" /> The stacktrace from the error is the following: SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/web-app] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: EntityManager is closed] with root cause java.lang.IllegalStateException: EntityManager is closed at org.hibernate.jpa.internal.EntityManagerImpl.checkOpen(EntityManagerImpl.java:105) at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:491) at web.task.dao.ConnectionDao.getConnectionsCount(ConnectionDao.java:67) at web.task.transformation.ConnectionTransformator.getPagesCount(ConnectionTransformator.java:48) at web.task.business.ConnectionService.getPagesCount(ConnectionService.java:45) at web.task.controllers.Conne…
has comment: http://stackoverflow.com/comment/36709542
has comment: http://stackoverflow.com/comment/36709071
has comment: http://stackoverflow.com/comment/36709150
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15939932
has comment: http://stackoverflow.com/comment/36709329
tagged with: spring
answer count: 0
has comment: http://stackoverflow.com/comment/36709256
has comment: http://stackoverflow.com/comment/36709218
tagged with: java
has comment: http://stackoverflow.com/comment/36709451
has title: java.lang.IllegalStateException: EntityManager is closed with HSQL
has comment: http://stackoverflow.com/comment/36705456

http://stackoverflow.com/comment/36729015
has text: Thnanks.. I also needed to set the data coming from DB into those textboxes @JqueryLearner
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23862648
score: 0

http://stackoverflow.com/q/23896128
has title: How to Store stock ticker updates as daily weekly monthly etc
tagged with: postgresql
type: Question
tagged with: datetime
has answer: http://stackoverflow.com/a/23903884
score: 0
answer count: 1
tagged with: java
has body: I have a need to backup stock data into "day", "past seven days", "1 month", "3 months" and "5 years" tables. whats the best way in doing this. Storing the current data real time in one table and moving it into these tables accordingly at the end of the day at a certain time, is the initiative I have taken. Data are symbol, trade price, date
type: UnansweredQuestion

http://stackoverflow.com/q/23796918
tagged with: terminal
upvote count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36602615
has body: I am currently writing a java program that is something similar to a cookbook. I have everything built, but unfortunately, I have no recipes. I searched around and found http://allrecipes.com/. I had looked at the source and found lines that contained the ingredients, the recipes, nutritional facts. I remember using grep in terminal, and I quickly found lynx to be useful. This is what I have so far (for a sample page). To get 100 lines after the first mention of Ingredients: lynx -dump "http://allrecipes.com/Recipe/Potato-Crunchy-Tenders/" | grep -n -A 100 "Ingredients" To get the line number of the "Ingredients": lynx -dump "http://allrecipes.com/Recipe/Beef-Tips-and-Noodles/" | grep -n "Ingredients" | cut -f1 -d: I have done a few examples and have found that the recipes start 6 lines after the "Ingredients" line, and a new ingredient is every other line, like so: "135:Ingredients [66]Edit and Save 136- 137- Original recipe makes 6 servings [67]Change Servings 138- Makes 6___________________ servings (*) US ( ) Metric [68]Adjust Recipe 139- ([69]Help) 140- * [ ] 141- 1/2 cup vegetable oil for frying 142- * [ ] 143- 1 1/2 cups milk 144- * [ ] 145- 1 egg 146- * [ ] 147- 1 (7.6 ounce) package garlic flavored instant mashed potatoes " My goal is to somehow get just the ingredients in a text file that I can parse with java (Which I am comfortable with). I hope to do the same thing with the recipe. This way, I can do this automatically for many recipes so I don't have to get all of these by hand. Is there a way to do this in java that is easier? Cheers.
score: -2
has title: How to search through a webpage to find a certain text
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23797718
favorite count: 0

jersey
tags question: http://stackoverflow.com/q/23885109
tags question: http://stackoverflow.com/q/23868027
tags question: http://stackoverflow.com/q/23828309
tags question: http://stackoverflow.com/q/23854986
tags question: http://stackoverflow.com/q/23808594
tags question: http://stackoverflow.com/q/23783839
tags question: http://stackoverflow.com/q/23787234
tags question: http://stackoverflow.com/q/23788458
tags question: http://stackoverflow.com/q/23899934
tags question: http://stackoverflow.com/q/23855793
tags question: http://stackoverflow.com/q/23913561
tags question: http://stackoverflow.com/q/23789437
tags question: http://stackoverflow.com/q/23836144
tags question: http://stackoverflow.com/q/23785789
tags question: http://stackoverflow.com/q/23865626
tag name: jersey
tags question: http://stackoverflow.com/q/23790752
tags question: http://stackoverflow.com/q/23884481
tags question: http://stackoverflow.com/q/23805082
tags question: http://stackoverflow.com/q/23932436
tags question: http://stackoverflow.com/q/23923474
tags question: http://stackoverflow.com/q/23907806
tags question: http://stackoverflow.com/q/23884169
tags question: http://stackoverflow.com/q/23784185
tags question: http://stackoverflow.com/q/23917844
tags question: http://stackoverflow.com/q/23869768
type: Tag
tags question: http://stackoverflow.com/q/23866308
tags question: http://stackoverflow.com/q/23930776
tags question: http://stackoverflow.com/q/23778958
tags question: http://stackoverflow.com/q/23936240

http://stackoverflow.com/comment/36757971
type: Comment
comment on: http://stackoverflow.com/q/23878509
score: 0
has text: Is the phone connected to your local network? And have you tried turning off mobile data?
type: QuestionComment

http://stackoverflow.com/comment/133074215
type: AnswerComment
type: Comment
has text: I'm guilty of using WRT sometimes, myself. Your use here doesn't make sense.
score: 2
comment on: http://stackoverflow.com/a/51688975

http://stackoverflow.com/a/33958024
type: Answer
answers question: http://stackoverflow.com/q/23901398
score: 0
has body: Try this c: if (dt &lt; (1f / max_frames)) { float sleepTime = (1f / max_frames) - dt; try { Thread.sleep((long) sleepTime); } catch (InterruptedException ex) { LogTool.logError(ex.getLocalizedMessage()); ex.printStackTrace(); } }

http://stackoverflow.com/q/23939109
upvote count: 2
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/23962669
type: Question
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/json
has title: sane representation of lists in XML and JSON using MoXY
score: 2
accepted answer: http://stackoverflow.com/a/23962669
answer count: 1
downvote count: 0
tagged with: moxy
favorite count: 0
has body: I need to expose a JAX-RS resource in XML and JSON, part of which will include passing in (potentially large) lists of integers. I'm using MoXY as my JAXB / JSON provider. The problem that I run into is that I cannot figure out how to expose a list of integers that works well in both XML and JSON. If I use @XmlList @XmlElement(name = "Values", type = Integer.class) protected List<Integer> values; Then JSON is (un)marshaled as ... "Values" : "0 1 2 4" ... which is undesirable when dealing with large numbers of numbers. If the @XmlList annotation is omitted, then the JSON is dealt with properly, but the XML ... 0 1 2 4 ... is parsed as [124] instead of [0, 1, 2, 4]. By using @XmlElementWrapper (and telling MoXY to "useWrapperAsArrayName") @XmlElementWrapper(name = "Values", required = true) @XmlElement(name = "Value") protected List<Object> values = new ArrayList<Object>(); Good JSON is achieved ... "Values" : [0, 1, 2, 4] ... but this imposes the very tedious XML format of ... 0 1 2 4 ... Anyone have any suggestions as to how to proceed? I can't imagine this is an uncommon use-case, yet I am thoroughly stumped.
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/75204016
downvote count: 0
upvote count: 2
has body: A simple way to check if a Runnable - or any other functional interface - has been implemented by a Lambda is to check if the class is synthetic but the interface's function isn't: Class clz = suspectedObject.getClass(); var isLambda = clz.isSynthetic() && !clz.getDeclaredMethod("run").isSynthetic(); Note that this will also detect function references (this::run) - I don't think there's a way to distinguish between that form and an anonymous lambda. I want to use this method to log the type of the object in a nicer way - my framework sometime logs the names of provided interface implementations to let the user know in which part of their code they have a problem, and lambda's toString() is next to useless. Not that I've yet figured out what is a useful way to represent the notion of "you should look at this specific lambda and not any of the other dozens of lambdas in your class".
type: Answer
answers question: http://stackoverflow.com/q/23870478
score: 2

http://stackoverflow.com/comment/36854584
type: QuestionComment
comment on: http://stackoverflow.com/q/23928068
score: 0
type: Comment
has text: Did you increase jvm.properties settings already to avoid crashes http://www-01.ibm.com/support/docview.wss?uid=swg21617708?

http://stackoverflow.com/comment/36808004
comment on: http://stackoverflow.com/q/23903726
has text: Sometimes I don't know which element of cache need to be updated.I need to reload all of it from database,but I can't shutdown the service?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23929880
has body: I am using 2 JBOSS ejb services in my project that runs in Tomcat. When I am running my project, an exception occurs, Caused by:java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: java.io.OptionalDataException at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306) at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143) at org.jboss.remoting.Client.invoke(Client.java:525) at org.jboss.remoting.Client.invoke(Client.java:488) at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:184) at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68) at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101) at com.sun.proxy.$Proxy34.create(Unknown Source) ..... Please tell me why these happens.what has to be done to run a ejb service in jboss from a client in tomcat?
tagged with: java
has answer: http://stackoverflow.com/a/23987592
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/36962972
type: AnsweredQuestion
tagged with: ejb
tagged with: jboss
tagged with: tomcat6
score: 0
accepted answer: http://stackoverflow.com/a/23987592
has title: what has to be done to run a ejb service in jboss from a client in tomcat
answer count: 1

http://stackoverflow.com/comment/36688878
comment on: http://stackoverflow.com/q/23842117
score: 0
has text: Actually, there is one `outer_map` which has 8 same `inner_map`s except their keys.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36717508
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23857246
has text: Show us what you have done and where the error is...
score: 1

http://stackoverflow.com/a/23846766
downvote count: 0
has body: I suggest using a web-based approach to writing the back-end (e.g. a web service, either SOAP or Rest), and then communicating between the swing app and the back-end app via HTTP / HTTPS. This is how mobile apps are typically written, and your swing desktop app is no different from a mobile app in this respect. As far as frameworks for the back end, both Spring MVC and Grails make this pretty easy. Do yourself a huge favor and stay away from EJB unless you really need.it and understand why.
answers question: http://stackoverflow.com/q/23844560
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/36856404
has text: I have a problem with String, not int or long.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23930453

relative-path
type: Tag
tags question: http://stackoverflow.com/q/23896840
tag name: relative-path
tags question: http://stackoverflow.com/q/23815676

http://stackoverflow.com/comment/36723229
type: Comment
comment on: http://stackoverflow.com/a/23859101
type: AnswerComment
has text: Getting all availabe networks + signal strength doesn't help you?
score: 0

http://stackoverflow.com/comment/36711329
score: 0
has text: @YekhezkelYovel: The actions within a single thread will always _appear_ to be executed in program order. Regarding multiple threads, the execution will _appear_ to be [sequentially consistent](http://en.wikipedia.org/wiki/Sequential_consistency), if there are no data races. Your code contains a data race on `helper`, if the variable isn't `volatile`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23853705

http://stackoverflow.com/q/23898855
has answer: http://stackoverflow.com/a/23899044
has comment: http://stackoverflow.com/comment/36797548
type: Question
has comment: http://stackoverflow.com/comment/36799291
score: 0
has comment: http://stackoverflow.com/comment/36798928
has comment: http://stackoverflow.com/comment/36798546
has comment: http://stackoverflow.com/comment/36798962
has answer: http://stackoverflow.com/a/23899071
answer count: 3
has body: Im working on an RSS reader software. I get items with their pubDate (publish date) values as string, convert them to Date object, and put them to my DB. However, when I check my DB, I saw some interesting values such as the date of tomorrow. I research this situation and found that it is about time zone value Z. For example when I get "Mon, 26 May 2014 21:24:29 -0500", it becomes "2014-05-27 05:24:29", the next day ! All I want is to get dates in any timezone and convert them to date in common timezone, such as my country's. Here is my code : public static String convert(String datestr) throws ParseException { DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); Date date = formatter.parse(datestr); SimpleDateFormat resultFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return resultFormatter.format(date); } And I use the method like that : System.out.println(convert("Mon, 26 May 2014 21:24:29 -0500")); The output is : 2014-05-27 05:24:29 Any idea ?
tagged with: timezone
has comment: http://stackoverflow.com/comment/36797611
has answer: http://stackoverflow.com/a/23899179
has comment: http://stackoverflow.com/comment/36799142
has comment: http://stackoverflow.com/comment/36798343
has comment: http://stackoverflow.com/comment/36799332
type: UnansweredQuestion
has title: How to convert date strings from different TimeZones to Date object in one TimeZone
has comment: http://stackoverflow.com/comment/36799170
has comment: http://stackoverflow.com/comment/36798480
has comment: http://stackoverflow.com/comment/36798314
has comment: http://stackoverflow.com/comment/36797721
tagged with: java
tagged with: date

groovy
tags question: http://stackoverflow.com/q/23832759
tags question: http://stackoverflow.com/q/23832870
type: Tag
tags question: http://stackoverflow.com/q/23829844
tags question: http://stackoverflow.com/q/23788363
tags question: http://stackoverflow.com/q/23932785
tags question: http://stackoverflow.com/q/23805576
tags question: http://stackoverflow.com/q/23914211
tags question: http://stackoverflow.com/q/23796404
tags question: http://stackoverflow.com/q/23883911
tags question: http://stackoverflow.com/q/23892162
tags question: http://stackoverflow.com/q/23906748
tags question: http://stackoverflow.com/q/23891189
tags question: http://stackoverflow.com/q/23817051
tag name: groovy

http://stackoverflow.com/comment/77882055
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23860533
has text: Could you elaborate more on "process one way"... are you consuming the objects? Mapping them? partitionBy() and groupingBy() can get you directly to 2+ lists, but you might benefit from mapping first or just having a decision fork in your forEach().

http://stackoverflow.com/q/23819737
has body: I am trying to add a way of viewing my current location to my application and can't figure out how to do it without getting errors. I currently have the two incorrectly stored in separate activities (Markers locations in one activity and my location in other activity) and can't seem to combine them. Sorry about the poor attempt at describing my problem, hopefully this code will help more. MainActivity package com.kieranmaps.v2maps; import java.util.Hashtable; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.app.ActivityManager; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.os.Build; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.kieranmaps.v2maps.R; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; import com.nostra13.universalimageloader.cache.memory.impl.FIFOLimitedMemoryCache; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener; public class MainActivity extends FragmentActivity { private GoogleMap googleM…
has answer: http://stackoverflow.com/a/23819763
type: UnansweredQuestion
tagged with: java
tagged with: android-maps-v2
type: Question
tagged with: google-maps
answer count: 1
has title: Putting current location into maps application
score: 0
tagged with: google-maps-markers
tagged with: android

http://stackoverflow.com/a/23877736
answers question: http://stackoverflow.com/q/23875588
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23875588
score: 0
has comment: http://stackoverflow.com/comment/36776541
type: Answer
has comment: http://stackoverflow.com/comment/36771833
has comment: http://stackoverflow.com/comment/36768022
has comment: http://stackoverflow.com/comment/36770420
has body: The object mapper created in the constructor in your example is not configured to support the JAXB annotations by default. You should either re-use the internal mapper provided by the JacksonJaxJsonProvider super class, or configure your mapper to support the JAXB annotations. Here is a link at the Jackson JAX-RS wiki. Here is a question based example of a subclass of JacksonJaxJsonProvider which customizes the internal object mapper in the constructor (not very elegant solution though). Note that I've inverted the serialization settings from the original question since they don't change the defaults to show the difference in the output from the different providers. public class JacksonProvider { public static class JacksonIncludeNullJsonProvider extends JacksonJaxbJsonProvider { public JacksonIncludeNullJsonProvider() { // must be the first call to initialize the mapper configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); _mapperConfig.getConfiguredMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); } } public static class Bean { @XmlElement(name = "xmlField1") public final String field1; public final String field2; public final String field3 = null; public final Map&lt;String, Object&gt; field4 = Collections.emptyMap(); public Bean(String field1, String field2) { this.field1 = field1; this.field2 = field2; } } public static void main(String[] args) throws IOException { JacksonIncludeNullJsonProvider provider = new JacksonIncludeNullJsonProvider(); JacksonJaxbJsonProvider provider2 = new JacksonJaxbJsonProvider(); Bean bean = new Bean("a", "b"); provider.writeTo(bean, Bean.class, null, null, MediaType.APPLICATION_JSON_TYPE, null, System.out); System.out.println(); provider2.writeTo(bean, Bean.class, null, null, MediaType.APPLICATION_JSON_TYPE, null, System.out); } } Output: {"xmlField1":"a","field2":"b"} {"xmlField1":"a","field2":"b","field3":null,"field4":{}}

http://stackoverflow.com/comment/36692583
comment on: http://stackoverflow.com/q/23844057
type: Comment
type: QuestionComment
has text: Wait a minute, this message comes from a **native** method of the `Thread` class. How many instances of `SheduleInMemRemove` (and thus, of `Timer`/`Thread`) are you creating?
score: 0

http://stackoverflow.com/q/23789819
has title: Working with SVG FILES in iReport gives JRExpressionEvalException: Error evaluating expression : Source Text
type: Question
tagged with: jasper-reports
linked to: http://stackoverflow.com/q/7891250
upvote count: 1
answer count: 1
tagged with: batik
favorite count: 0
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion
tagged with: ireport
has body: I've been working in an web project where the client needs to show a report like an Id card. I designed the structure of the report in Illustrator and exported as SVG, so BatikRenderer handles the file and shows it in the report. And in iReport just include the fields I'm going to show. So basically it works in iReport Designer 5.5.0. When I Compile it and shows the preview. It seems like everything is ok. Here is my jrxml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="prueba" whenNoDataType="AllSectionsNoDetail" language="groovy" pageWidth="180" pageHeight="288" columnWidth="180" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="2cedbacf-8972-4cbe-bf07-7d3af62126d5"&gt; &lt;detail&gt; &lt;band height="288" splitType="Stretch"&gt; &lt;image&gt; &lt;reportElement x="0" y="0" width="180" height="288" uuid="3c8031c1-70ca-4e47-be8e-735b90b7797a"/&gt; &lt;imageExpression class="net.sf.jasperreports.engine.JRRenderable"&gt;&lt;![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstanceFromLocation("svg-design.svg")]]&gt;&lt;/imageExpression&gt; &lt;/image&gt; &lt;/band&gt; &lt;/detail&gt; &lt;/jasperReport&gt; I used the other variation with the absolute path and it works too : &lt;![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("/Users/RogelioMonge/Dropbox/Adepafut/src/java/com/adepafut/common/reports/svg-design.svg"))]]&gt; The problem is when I try to execute the report from my app. Im using my report with an Empty Data Source, just for the SVG test, I need to achieve this first so I can continue with the filling of the report with the DataSource. Here is the dummy code I used to test the report: try { Map&lt;String, Object&gt; parameters = new HashMap&…
downvote count: 0
has answer: http://stackoverflow.com/a/24025758
score: 1
tagged with: java

http://stackoverflow.com/a/51769216
answers question: http://stackoverflow.com/q/23919938
has body: It's like Michael Pralow say. Just to add a concrete example you can set the isolation level by instantiating a default transaction attribute : DefaultTransactionAttribute transactionWithIsolationReadCommited = new DefaultTransactionAttribute(); transactionWithIsolationReadCommited.setIsolationLevel(TransactionAttribute.ISOLATION_READ_COMMITTED); And then use it in the step builder. Hope it helps!
score: 2
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/36822471
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23911874
has text: @SteveC Matching Java Virtual Machines (3): -bash: syntax error near unexpected token `(' Olkun-MacBook-Pro:~ olkunmustafa$ 1.7.0_55, x86_64:"Java SE 7"/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home -bash: 1.7.0_55,: command not found Olkun-MacBook-Pro:~ olkunmustafa$ 1.6.0_65-b14-462, x86_64:"Java SE 6"/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -bash: 1.6.0_65-b14-462,: command not found Olkun-MacBook-Pro:~ olkunmustafa$ 1.6.0_65-b14-462, i386:"Java SE 6"/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -bash: 1.6.0_65-b14-462,
type: Comment

http://stackoverflow.com/comment/36815491
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23905216
has text: `getCs‌​sValue` returns css value of particular element. If you define `padding` in `td`, you need to call the method on `td` element.

http://stackoverflow.com/a/23806742
has body: First make sure to implement onclicklistener in your class.... public void startGame(View v){ String randText = ""; String test = "10"; String test1 = "11"; Random randGen = new Random(); int rando = randGen.nextInt(10); randText = Integer.toString(rando); TextView RandomValue = (TextView) findViewById(R.id.randomValueTv); RandomValue.setText(randText); randomNumbersRbra(); TimerGame(); Button start = (Button)findViewById(R.id.startGameBtn); start.setVisibility(View.INVISIBLE); TextView go = (TextView)findViewById(R.id.tvGo); go.setVisibility(View.VISIBLE); Button btnTap1 = (Button)findViewById(R.id.tap1); Button btnTap2 = (Button)findViewById(R.id.tap2); Button btnTap3 = (Button)findViewById(R.id.tap3); Button btnTap4 = (Button)findViewById(R.id.tap4); Button btnTap5 = (Button)findViewById(R.id.tap5); Button btnTap6 = (Button)findViewById(R.id.tap6); Button btnTap7 = (Button)findViewById(R.id.tap7); Button btnTap8 = (Button)findViewById(R.id.tap8); Button btnTap9 = (Button)findViewById(R.id.tap9); TextView tvtest = (TextView)findViewById(R.id.scoreTv); tvtest.setText(test.toString()); //OnClickListener like below: btnTap1.setOnClickListener(this); btnTap2.setOnClickListener(this); } //And override method like below: @Override public void onClick(View view) { switch (view.getId()) { case R.id.tap1: // do something break; case R.id.tap2: //do something break; default: break; } }
type: Answer
has comment: http://stackoverflow.com/comment/36623000
answers question: http://stackoverflow.com/q/23806615
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23806615
score: 0

http://stackoverflow.com/comment/36866496
score: 0
comment on: http://stackoverflow.com/q/23932131
type: QuestionComment
type: Comment
has text: After a while I found out that it's mapped to a string in xslt, so I just had to do: test="$whatever = 'true'"

http://stackoverflow.com/a/23820410
has comment: http://stackoverflow.com/comment/36648447
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36662139
has body: This is the way you link css files in html &lt;link href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css" rel="stylesheet" type="text/css"&gt;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23820373

http://stackoverflow.com/comment/36659635
comment on: http://stackoverflow.com/q/23826007
score: 0
type: Comment
type: QuestionComment
has text: it's dfs.permissions (note 's')

http://stackoverflow.com/comment/36573172
has text: you dont have to iterate all the object. you should query the DB only for employees which has a specific manager. SELECT * from EMPLOYEE where manager_id = "xxxx";
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23781119
type: Comment

http://stackoverflow.com/comment/36681869
type: Comment
comment on: http://stackoverflow.com/a/23838626
has text: for "3" you get `1,2,4,5,6,7,8,9,10,11,12,114,15`
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36660979
comment on: http://stackoverflow.com/q/23827729
has text: You can persist the values on submit and retrieve back to show them on the next request.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/23905592
type: Answer
has body: public void showCancelableProgressDialog(String title, String message, int pbarstyle, String cancelLabel, OnClickListener cancelListener) { dialog = new ProgressDialog(context); dialog.setTitle(title); dialog.setMessage(message); dialog.setIndeterminate(true); //if you are not showing proper progress dialog.setProgressStyle(pbarstyle); //the style you want like horizontal progress bar or spinner type dialog.setCancelable(true); dialog.setMax(100); dialog.setButton(DialogInterface.BUTTON_NEGATIVE, cancelLabel, cancelListener); dialog.show(); } while calling this menthod you can do like this Thread th = new Thread(){ @Override public void run (){ showCancelableProgressDialog(your title, your message, ProgressDialog.STYLE_HORIZONTAL, activity.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // handle what your cancel button needs to do } }); } } th.start(); check out with this one....
has comment: http://stackoverflow.com/comment/36813461
score: 0
has comment: http://stackoverflow.com/comment/36814698
answers question: http://stackoverflow.com/q/23905215

http://stackoverflow.com/comment/36793941
comment on: http://stackoverflow.com/a/23882892
type: AnswerComment
score: 0
type: Comment
has text: Let's see if the distinct keyword would help. I updated my response containing that one too.

http://stackoverflow.com/q/23841222
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36689733
tagged with: eclipse
has body: I am trying to code a chat in my java software, i have 2 eclipses running on my windows 7. one of the eclipses includes a project "ServerListener" which contains a class Server.java and the other eclipse includes a project "Client" and contains a class cl.java. I am sending messages from my cl.java to the server.java each time the server receives a message he send it back to the cl.java (the one i sent the message from) to make sure it's connected. (THIS PART WORKS FINE sending message to the server and back from the server to the same client) my question is : how to let the server.java send the message to another client instead of the original client? if i run another eclipse with the same project as "Client" i want to the two eclipses to chat together this is the Server.java: import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; public class Server { ServerSocket serverSocket; ArrayList&lt;ServerThread&gt; allClients = new ArrayList&lt;ServerThread&gt;(); public static void main(String[] args) { new Server(); } public Server() { // ServerSocket is only opened once !!! try { serverSocket = new ServerSocket(6000); System.out.println("Waiting on port 6000..."); boolean connected = true; // this method will block until a client will call me while (connected) { Socket singleClient = serverSocket.accept(); // add to the list ServerThread myThread = new ServerThread(singleClient); allClients.add(myThread); myThread.start(); } // here we also close the main server socket serverSocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } class ServerThread extends Thread { Socket threadSocket; String msg; boolean isClientConnected; InputStream input; ObjectInputStream ois; OutputStream output; ObjectOutputStream oos; // ObjectOutputStream public ServerTh…
score: 0
type: UnansweredQuestion
tagged with: sockets
has title: Client - Server : How to Let Server send the received message to another client instead of sending it back to original client?
has comment: http://stackoverflow.com/comment/36695112
answer count: 0

http://stackoverflow.com/comment/36767669
type: Comment
has text: You are missing to set a parameter in the query before you execute.
comment on: http://stackoverflow.com/a/23883673
type: AnswerComment
score: 0

http://stackoverflow.com/q/23850093
tagged with: java
type: Question
score: 0
has title: How to print 2D array to terminal window
answer count: 1
has answer: http://stackoverflow.com/a/23850123
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11383070
duplicate of: http://stackoverflow.com/q/11383070
has body: public static void main(String [] args) { //Initializes Array double[][] results = new double[7][6]; //Attach original methods Catapult[][] data = new Catapult[7][6]; //Prints Heading printHeading(); //For-loop inputs data into original methods for (int i = 0; i &lt;= 6; i++) { for (int j = 0; j &lt; 6; j++) { data[i][j] = new Catapult((double) (i + 5) * 5.0, (double) (j + 4) * 5.0); data[i][j].convertDegreesToRadians(); data[i][j].convertMPHToMetersPerSec(); System.out.println(); System.out.println(data[i][0] + "" + data[i][j] + "" + data[i][j+1] + "" + data[i][j+2] + data[i][j+3] + " " + data[i][j+4] + " " + data[i][j+5]); } } Whenever I try to print this, the values are null. How do I properly print the values of i and j within the 2d array?

jmh
tags question: http://stackoverflow.com/q/23938699
tag name: jmh
tags question: http://stackoverflow.com/q/23858961
type: Tag
tags question: http://stackoverflow.com/q/23884486
tags question: http://stackoverflow.com/q/23891586

http://stackoverflow.com/comment/36790587
comment on: http://stackoverflow.com/q/23895283
has text: did you tried with any of these ? Your_frame.toFront(); Your_frame.toBack(); Your_frame.setEnabled(False);
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36683596
type: AnswerComment
comment on: http://stackoverflow.com/a/23837343
type: Comment
has text: Ya, that worked. So, instead of going down and calculating the level, you've taken the bottom up approach to return the values and add it and then compare. I think I need to practice more! But thank you.
score: 0

http://stackoverflow.com/q/23904221
tagged with: swtbot
tagged with: junit
answer count: 1
accepted answer: http://stackoverflow.com/a/27510093
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: eclipse
type: Question
tagged with: ant
has title: Exception while dispatching event org.osgi.service.event.Event error while running SWTBot tests using ant
has answer: http://stackoverflow.com/a/27510093
has body: I am running the SWT-Bot tests using ant. The eclipse opens properly and runs the test cases. But very frequently I see the following error, !MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/visible/SET] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@29fcf1ba !STACK 0 java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:4378) at org.eclipse.swt.SWT.error(SWT.java:4312) at org.eclipse.swt.SWT.error(SWT.java:4283) at org.eclipse.swt.widgets.Widget.error(Widget.java:481) at org.eclipse.swt.widgets.Control.setParent(Control.java:4505) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.handleEvent(PartRenderingEngine.java:206) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4491) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(…

http://stackoverflow.com/a/23921179
score: 0
answers question: http://stackoverflow.com/q/23920397
type: Answer
has body: First of all I suggest you to check out the Bridge design pattern. You should have a hierarchy for handling data (printing to File, Console, etc.), and another hierarchy for your data builders - they should be loosely coupled, as classes have to be coherent and crated because of one reason, as a best practice. In addition, we use the Decorator pattern to extend the default behavior of classes. Your FileDecorator, LoggerOutputDecator classes have their own responsibilities, they do not extend the "decorated" object's default behavior. I think you should have two different hierarchies as mentioned, but the hierarchy of data handlers should not be implemented in data way (do not use the Decorator pattern, because they do not decorate anything). I think it would be cleaner to build data with a builder and iterate over handlers. Each handler should be called and the data built by the builder should be passed as a parameter.

http://stackoverflow.com/comment/36813004
score: 0
type: Comment
has text: Well check the file and directory permissions then!
comment on: http://stackoverflow.com/a/23867922
type: AnswerComment

http://stackoverflow.com/a/23828692
has comment: http://stackoverflow.com/comment/36662947
upvote count: 2
has body: Yes, matches matches the whole string, so you should use ".*#+.*"
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36662731
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23828593
has comment: http://stackoverflow.com/comment/36662683
accepted answer of: http://stackoverflow.com/q/23828593

http://stackoverflow.com/q/23916122
upvote count: 1
has title: Calling the proper constructor based on input length
favorite count: 0
tagged with: compiler-errors
tagged with: constructor
has answer: http://stackoverflow.com/a/23916259
possible better answer: http://stackoverflow.com/a/23916653
type: AnsweredQuestion
has body: I have a Point class. The point can be both in 2-D and 3-D. I am deciding this based on the length of the coordinate array passed to the constructor. double x, y, z; int dimension; Point(double x, double y, double z) { this.x = x; this.y = y; this.z = z; dimension = 3; } Point(double x, double y) { this.x = x; this.y = y; this.z = 0; dimension = 2; } Point(double[] p) { if(p.length == 2) this(p[0], p[1]); else if(p.length == 3) this(p[0], p[1], p[2]); } The last constructor gives error because constructor call must be the first statement in a constructor. Is there a way to achieve what I'm doing?
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23916312
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36829569
has answer: http://stackoverflow.com/a/23916653
answer count: 3
accepted answer: http://stackoverflow.com/a/23916259

http://stackoverflow.com/q/23936433
has body: I know the Swing single-thread rule (from Java Concurrency in Practice): Swing components and models should be created, modified, and queried only from the event-dispatching thread. Is the converse also true? I maintain some transaction logging code that writes event information to a file and it sometimes does this on the EDT. Is this a bad practice?
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36867464
has answer: http://stackoverflow.com/a/23936514
accepted answer: http://stackoverflow.com/a/23936514
has comment: http://stackoverflow.com/comment/36872997
has comment: http://stackoverflow.com/comment/36872204
downvote count: 0
answer count: 1
favorite count: 0
has title: Should non-Swing code be executed on non-EDT threads?
type: AnsweredQuestion
tagged with: event-dispatch-thread
upvote count: 3
tagged with: swing

http://stackoverflow.com/q/23823156
tagged with: java
tagged with: jakarta-mail
score: 0
answer count: 3
has title: Cannot connect to Gmail SMTP using JavaMail api
tagged with: gmail
has body: I have written the following two java classes - public class EmailUtil { public static void sendEmail(Session session, String toEmail, String subject, String body){ try { MimeMessage msg = new MimeMessage(session); //set message headers msg.addHeader("Content-type", "text/HTML; charset=UTF-8"); msg.addHeader("format", "flowed"); msg.addHeader("Content-Transfer-Encoding", "8bit"); msg.setFrom(new InternetAddress("no_reply@no_reply.com", "NoReply-NP")); msg.setReplyTo(InternetAddress.parse("no_reply@no_reply.com", false)); msg.setSubject(subject, "UTF-8"); msg.setText(body, "UTF-8"); msg.setSentDate(new Date()); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail, false)); System.out.println("Message is ready"); Transport.send(msg); System.out.println("EMail Sent Successfully!!"); } catch (Exception e) { e.printStackTrace(); } } } public class TLSEmail { public static void main(String[] args) { final String fromEmail = "*****@gmail.com"; final String password = "*****"; final String toEmail = "****@gmail.com"; System.out.println("TLSEmail Start"); Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); //SMTP Host props.put("mail.smtp.port", "587"); //TLS Port props.put("mail.smtp.auth", "true"); //enable authentication props.put("mail.smtp.starttls.enable", "true"); //enable STARTTLS //create Authenticator object to pass in Session.getInstance argument Authenticator auth = new Authenticator() { //override the getPasswordAuthentication method protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(fromEmail, password); } }; Session session = Session.getInstance(props, auth); EmailUtil.sendEmail(session, toEmail,"TLSEmail Testing Subject", "TLSEmail Testing Body"); } } When I run this, I get the following error - javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587; nested exception is: java.net.SocketException: Permission denied: connect How D…
has answer: http://stackoverflow.com/a/35141822
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23826216
type: Question
has answer: http://stackoverflow.com/a/52704812

http://stackoverflow.com/a/23791073
type: AcceptedAnswer
has body: As stated here fatJar is a regular jar task (I assume that You're using this plugin), so You can configure it with standard DSL, search for archiveName. Should be doable. When it comes to passing command line arguments use -P switch to pass the desired class. Then refer to it using project variable.
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23787622
score: 5
answers question: http://stackoverflow.com/q/23787622

http://stackoverflow.com/comment/60577809
comment on: http://stackoverflow.com/a/23903856
type: Comment
has text: How do I "exclude the transitive hibernate-core dependency from other external dependencies"?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36621389
has text: MultiMap multiMap = new MultiValueMap(); ^ symbol: class MultiMap location: class same_test
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23807049
score: 0

http://stackoverflow.com/q/23835571
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23835772
tagged with: java
linked to: http://stackoverflow.com/q/17360106
type: Question
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/23835778
score: 4
has title: How to close a text file using java
has body: If i have opened a text file using Desktop API in java and i want to close it again only using the code? I have opened it like this Desktop d=Desktop.getDesktop(); try { d.open(new File("C:/Users/home/Desktop/123.txt")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Thread.sleep(2000); Now i want to close it?how will i do it,what code do i have to Write,Since there is no method in the Desktop API of the java
answer count: 3
linked to: http://stackoverflow.com/q/54686
has answer: http://stackoverflow.com/a/23835770
favorite count: 0
accepted answer: http://stackoverflow.com/a/23835778
has answer: http://stackoverflow.com/a/23835772

http://stackoverflow.com/q/23917076
has comment: http://stackoverflow.com/comment/36831531
type: AnsweredQuestion
has body: Im doing nashorn lately and so went to read about the java.util.concurrent. Ive an issue where i can run simple executors like : Executors.newFixedThreadPool(); new ThreadPoolExecutor(); The snippets of code runs, but after the task is over the console process doesnt stop like if it hangs waiting something. Any reason why this happens ?
tagged with: java
has comment: http://stackoverflow.com/comment/36831410
has title: Executor.execute() hangs definitely
type: Question
accepted answer: http://stackoverflow.com/a/23917191
score: 0
has answer: http://stackoverflow.com/a/23917191
answer count: 1

http://stackoverflow.com/a/23907010
answers question: http://stackoverflow.com/q/23906838
type: Answer
has comment: http://stackoverflow.com/comment/36829313
has body: import java.io.StringReader; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; import org.xml.sax.InputSource; public class Demo { public static void main(String[] args) throws Exception { String xml = " hellowrold "; String xpath = "/div/text()"; XPath xPath = XPathFactory.newInstance().newXPath(); String childHtml = xPath.evaluate(xpath, new InputSource(new StringReader(xml))); System.out.println(childHtml); xpath = "/p"; String result = xPath.evaluate(xpath, new InputSource(new StringReader(childHtml))); System.out.println(result); } } Xpath is used to traverse XML. You can do much more with XPath. In your case the problem is with CDATA tags that are hiding the elements which you want to extract. The above should help you get away with that. What has been done above ? first extract the CDATA tags as separate xml and then apply xpath on it.
has comment: http://stackoverflow.com/comment/36829140
score: 0

http://stackoverflow.com/q/23940911
tagged with: java
type: Question
tagged with: bean-validation
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23940912
has body: I have been running into a lot of trouble trying to get custom Bean Validation constraints to successfully leverage Spring's dependency injection. For example I might define a constraint: @Constraint(validatedBy = { CustomConstraintValidator.class }) @Documented @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) @Retention(RetentionPolicy.RUNTIME) public @interface CustomConstraint { String message() default "custom.constraint.error"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } Validator Implementation @Component public class CustomConstraint implements ConstraintValidator&lt;CustomConstraint, String&gt; { @Autowired private SomeSpringBean someSpringBean; @Override public void initialize(CustomConstraint constraintAnnotation) { } @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value != null) { SomeObject storedValue = someSpringBean.find(value); return storedValue != null; } return true; } } The standard way to setup Bean Validation with RESTeasy is to pull in: org.jboss.resteasy:resteasy-validator-provider-11:3.0.6.Final However when the validation is executed at runtime, any @Autowired field is always null. Versions Spring: 4.0.4.Release RESTeasy: 3.0.6.Final
answer count: 1
favorite count: 0
tagged with: resteasy
type: UnansweredQuestion
has title: Getting Spring 4 dependency injection working with RESTeasy 3 validator
tagged with: spring
score: 1

http://stackoverflow.com/a/23984012
upvote count: 1
has body: I able to run Perl scripts like: print "Content-type: text/html\n\n"; foreach $key (keys %ENV) { print "$key --> $ENV{$key} "; } with this perl.xml in my webapps folder: <?xml version="1.0" encoding="ISO-8859-1"?> /perl F:\perl_scripts org.eclipse.jetty.servlets.CGI *.pl commandPrefix C:\Perl64\bin\perl.exe Path F:\perl_scripts Hope this helps.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23805309

http://stackoverflow.com/a/23779252
accepted answer of: http://stackoverflow.com/q/23779148
score: 0
has body: There are two possibilities: lng is null. locationis null. I haven't fully debugged your code, just a quick browse and I see that location is a member field and in the method where the latitude and longitude are set the location member fied is set in the if() { part, but in the else { part you assume that it has already been assigned.
has comment: http://stackoverflow.com/comment/36610889
type: Answer
has comment: http://stackoverflow.com/comment/36570401
answers question: http://stackoverflow.com/q/23779148
type: AcceptedAnswer

http://stackoverflow.com/comment/36742776
score: 0
type: Comment
type: QuestionComment
has text: What exactly are you trying to display, and what is the required functionality for the dialog?
comment on: http://stackoverflow.com/q/23869758

http://stackoverflow.com/comment/36596264
type: QuestionComment
comment on: http://stackoverflow.com/q/23793527
score: 3
has text: Can you explain why you must use `double` instead of `float`?
type: Comment

http://stackoverflow.com/comment/36820964
type: Comment
type: QuestionComment
has text: as far as i know absolute paths dont work if your application runs under tomcat. if the absolute path worked i wouldn`t be asking this question because it should work properly when i ran it for first time.
comment on: http://stackoverflow.com/q/23911110
score: 0

http://stackoverflow.com/a/23858762
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36720882
has comment: http://stackoverflow.com/comment/36720904
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23858620
has comment: http://stackoverflow.com/comment/36720846
answers question: http://stackoverflow.com/q/23858620
has comment: http://stackoverflow.com/comment/36720925
has body: Simply try with TypeToken that will return a Map&lt;String, Map&lt;String, String&gt;&gt; as Type. Reader reader=new BufferedReader(new FileReader(new File("resources/json.txt"))); Type type = new TypeToken&lt;Map&lt;String, Map&lt;String, String&gt;&gt;&gt;() {}.getType(); Map&lt;String, Map&lt;String, String&gt;&gt; data = new Gson().fromJson(reader, type); // pretty printing System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(data)); output: { "mappings": { "s54dsf45fzd324": "135sdq13sod1tt3", "21sm24dsfp2ds2": "123sd56f4gt4ju4" } }
upvote count: 5
has comment: http://stackoverflow.com/comment/36720913

http://stackoverflow.com/q/23900452
has answer: http://stackoverflow.com/a/23944722
score: 0
tagged with: lambdaj
answer count: 1
has body: I am learning LambdaJ and everytime I need to achieve a task I have to check at existing examples and modify them in order to use lambdaj. I have started using it but I think I'm missing something here that would like to ask you. I'm not clear about using having method. I don't understand how it works and how I can I use it. I have debugged, decompiled and read its documentation but I don't find the "way of thinking" lambda. having javadoc says: static HasArgumentWithValue having(A argument, org.hamcrest.Matcher matcher) Creates an hamcrest matcher that is evalued to true if the value of the given argument satisfies the condition defined by the passed matcher. I've used having in examples like this: List&lt;User&gt; result = filter(having(on(User.class).getAge(), greaterThan(20)), list); I understand that having applies a harmcrest matcher to an argument and repeats that all over the list. But my question is how does having works? How do I think in a functional way on lambdaj?
accepted answer: http://stackoverflow.com/a/23944722
has title: How does Lambdaj having work?
type: AnsweredQuestion
tagged with: java
type: Question

image
tags question: http://stackoverflow.com/q/23788440
tags question: http://stackoverflow.com/q/23842610
tags question: http://stackoverflow.com/q/23899345
tags question: http://stackoverflow.com/q/23894576
tags question: http://stackoverflow.com/q/23799664
tags question: http://stackoverflow.com/q/23795090
tags question: http://stackoverflow.com/q/23803250
tags question: http://stackoverflow.com/q/23929819
tags question: http://stackoverflow.com/q/23900115
tags question: http://stackoverflow.com/q/23884849
tags question: http://stackoverflow.com/q/23901889
tags question: http://stackoverflow.com/q/23906402
tags question: http://stackoverflow.com/q/23877596
tags question: http://stackoverflow.com/q/23881004
tags question: http://stackoverflow.com/q/23837704
tags question: http://stackoverflow.com/q/23939966
tags question: http://stackoverflow.com/q/23906199
tags question: http://stackoverflow.com/q/23849364
tags question: http://stackoverflow.com/q/23851049
tags question: http://stackoverflow.com/q/23896235
tags question: http://stackoverflow.com/q/23792441
tags question: http://stackoverflow.com/q/23917518
tags question: http://stackoverflow.com/q/23793537
tags question: http://stackoverflow.com/q/23820232
tags question: http://stackoverflow.com/q/23877330
tags question: http://stackoverflow.com/q/23887739
tag name: image
tags question: http://stackoverflow.com/q/23811258
tags question: http://stackoverflow.com/q/23900684
tags question: http://stackoverflow.com/q/23803027
tags question: http://stackoverflow.com/q/23918514
tags question: http://stackoverflow.com/q/23883383
type: Tag
tags question: http://stackoverflow.com/q/23899515
tags question: http://stackoverflow.com/q/23864896
tags question: http://stackoverflow.com/q/23822401

jakarta-mail
tags question: http://stackoverflow.com/q/23820794
tags question: http://stackoverflow.com/q/23782628
tags question: http://stackoverflow.com/q/23866315
tag name: jakarta-mail
type: Tag
tags question: http://stackoverflow.com/q/23797705
tags question: http://stackoverflow.com/q/23780543
tags question: http://stackoverflow.com/q/23882558
tags question: http://stackoverflow.com/q/23802924
tags question: http://stackoverflow.com/q/23883911
tags question: http://stackoverflow.com/q/23823156
tags question: http://stackoverflow.com/q/23885901
tags question: http://stackoverflow.com/q/23911196
tags question: http://stackoverflow.com/q/23902218

http://stackoverflow.com/comment/36841841
has text: What are the size of images? How many images are you loading?
comment on: http://stackoverflow.com/q/23922447
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23929899
has title: Finding Palindromes in an Array
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/23929980
has comment: http://stackoverflow.com/comment/36855392
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23929980
possible better answer: http://stackoverflow.com/a/23929976
tagged with: java
has body: For this assignemnt, I think that I got it right, but when I submit it online, it doesn't list it as correct even though I checked with Eclipse. The prompt: Write a method isPalindrome that accepts an array of Strings as its argument and returns true if that array is a palindrome (if it reads the same forwards as backwards) and /false if not. For example, the array {"alpha", "beta", "gamma", "delta", "gamma", "beta", "alpha"} is a palindrome, so passing that array to your method would return true. Arrays with zero or one element are considered to be palindromes. My code: public static void main(String[] args) { String[] input = new String[6]; //{"aay", "bee", "cee", "cee", "bee", "aay"} Should return true input[0] = "aay"; input[1] = "bee"; input[2] = "cee"; input[3] = "cee"; input[4] = "bee"; input[5] = "aay"; System.out.println(isPalindrome(input)); } public static boolean isPalindrome(String[] input) { for (int i=0; i&lt;input.length; i++) { // Checks each element if (input[i] != input[input.length-1-i]){ return false; // If a single instance of non-symmetry } } return true; // If symmetrical, only one element, or zero elements } As an example, {"aay", "bee", "cee", "cee", "bee", "aay"} returns true in Eclipse, but Practice-It! says it returns false. What is going on?
type: Question
has answer: http://stackoverflow.com/a/23929976
tagged with: arrays
tagged with: palindrome

http://stackoverflow.com/q/23784496
type: Question
tagged with: automated-tests
answer count: 1
score: 0
has body: I want to run an automated test-case generation tool on the class Realm.java of project Async-HTTP-Client. I located its path: [dario@bob async-http-client]$ find /home/dario/async/553/prefix -name Realm.java /home/dario/async/553/prefix/async-http-client/api/src/main/java/org/asynchttpclient/Realm.java Hence set the classpath to: [dario@bob async-http-client]$ echo $CLASSPATH /home/dario/async/553/prefix/async-http-client/api/src/main/java:/home/dario/async/553/prefix/async-http-client/evosuite-tests:/home/dario/testEnv/684131/prefix/rhino/lib/xbean.jar:/home/dario/evosuite/target/evosuite-0.1-SNAPSHOT-jar-minimal.jar But when I run the command to generate tests: [dario@bob async-http-client]$ ~/evosuite/target/bin/EvoSuite -class org.asynchttpclient.Realm -projectCP /home/dario/async/553/prefix/async-http-client/api/src/main/java:/home/dario/testEnv/684131/prefix/rhino/lib/xbean.jar * EvoSuite 0.1-SNAPSHOT * Unknown class: org.asynchttpclient.Realm I am told the class is non-existent. Ideas?
type: UnansweredQuestion
has title: Error setting classpath
tagged with: unit-testing
tagged with: java
has answer: http://stackoverflow.com/a/23785786

http://stackoverflow.com/q/23832513
has body: This java code is written for reading a text File which is like this: AL B C DF E FBI GL H IB J K LNH java code: try{ BufferedReader in = new BufferedReader(new FileReader(defaultFile)); while ( (str = in.ReadLine()) != null) { StringTokenizer es = new StringTokenizer(str, "\t"); Parameter param = new Parameter(); param.setParameterName(es.nextToken()); param.setParameterType(es.nextToken()); ... parameterVector.addElement(param); } in.Close(); } catch (Exception ex) { return ("can not find valid default parameter file"); } I want to convert this code to C#. To be able to read the text file one line at a time( with respect to the column) I need to have something like a token. I could not find any equivalent for the StringTokenizer in C# so I thought about defining the space between the column like (' ') but it does not work for the str.columns(space) which is defined as an argument. This is what I am doing : try{ System.IO.StreamReader inBuffer = new System.IO.StreamReader(@"C:\Users\WriteLines2.txt"); while ( (str = inBuffer.ReadLine()) != null) { char[] space = {' '}; string[] columns = str.Split(space); Parameter param = new Parameter(); param.setParameterName(str.columns(space)); param.setParameterType(str.columns(space)); } inBuffer.Close(); } catch (Exception ex) { return ("can not find valid default parameter file"); } Does anyone have any idea that how do I read a text file with respect to the columns. Thanks in advance
has comment: http://stackoverflow.com/comment/36669975
has answer: http://stackoverflow.com/a/23832553
possible better answer: http://stackoverflow.com/a/23832849
has title: File I/O in java and C#
has comment: http://stackoverflow.com/comment/36670244
has comment: http://stackoverflow.com/comment/36670126
has comment: http://stackoverflow.com/comment/36670183
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23832553
tagged with: java
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23832849
score: 0
answer count: 2

http://stackoverflow.com/a/23831919
downvote count: 0
type: Answer
has body: I believe the best way to generate jasper report templates is,if possible, to use an external program, i reccomend ireport. below are tutorials created by the jasper team: http://community.jaspersoft.com/wiki/ireport-designer-tutorials-help Can't say if there are advantages in integrating jasper with spring though
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23831210

http://stackoverflow.com/comment/36824068
score: 1
type: Comment
type: QuestionComment
has text: A static context like that is going to cause a huge memory leak
comment on: http://stackoverflow.com/q/23913096

http://stackoverflow.com/q/23929249
linked to: http://stackoverflow.com/q/9554636
upvote count: 0
has answer: http://stackoverflow.com/a/23935046
has answer: http://stackoverflow.com/a/23929373
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/36854233
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has title: How to switch back to previous JFrame from another JFrame?
has comment: http://stackoverflow.com/comment/36856253
tagged with: java
has body: I am a student who is trying to create a simple application using Leap motion controller API's. So, what I have is a screen on which I am performing a circle gesture to go to next screen. I have created a simple GUI implementing a circle gesture on both the screens. But, I am having trouble when I want to switch back to previous screen. The full code can be found here: https://github.com/samarth003/codeGist Please help me in this regard.
downvote count: 1
type: Question

http://stackoverflow.com/a/23918098
upvote count: 1
has body: Your question is related to jBoss AS7, the UsersRoles login module is for user and roles files only. You need to use the Database login module. Here is a post on how to use it http://middlewaremagic.com/jboss/?p=387
score: 1
has comment: http://stackoverflow.com/comment/36839990
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23874517
has comment: http://stackoverflow.com/comment/36866027
answers question: http://stackoverflow.com/q/23874517

http://stackoverflow.com/comment/36827591
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23914846
type: Comment
has text: From the `GregorianCalendar` javadoc: "Week 1 of a month (the days with `WEEK_OF_MONTH = 1`) is the earliest set of at least `getMinimalDaysInFirstWeek()` contiguous days in that month, ending on the day before `getFirstDayOfWeek()`. Unlike week 1 of a year, week 1 of a month may be shorter than 7 days, need not start on `getFirstDayOfWeek()`, and will not include days of the previous month. Days of a month before week 1 have a `WEEK_OF_MONTH` of 0.

http://stackoverflow.com/q/23796154
favorite count: 0
has comment: http://stackoverflow.com/comment/37545302
accepted answer: http://stackoverflow.com/a/29949953
score: 2
has comment: http://stackoverflow.com/comment/36601146
upvote count: 2
has body: I would like to update a specific block in the world's texture without replacing the block or registering multiple blocks. I am using Forge version 1.7.2, recommended version.
has comment: http://stackoverflow.com/comment/36601065
has comment: http://stackoverflow.com/comment/36619424
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36601132
tagged with: minecraft-forge
has title: Is there a way to dynamically update block textures after initialization?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29949953
has comment: http://stackoverflow.com/comment/36601391
answer count: 1
downvote count: 0
tagged with: minecraft

http://stackoverflow.com/q/23879387
has comment: http://stackoverflow.com/comment/36759878
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36759724
has body: public class EnclosingClass{ public void enclosingClassMethod(){ InnerClass iC = new InnerClass(); ic.innerClassPrivateMethod(); // this one works but why the following line doesn't //work InnerClass.innerClassPrivateMethod(); // Why I can't call the method like this? } public class InnerClass{ private void innerClassPrivateMethod(){ } } } Why we can't call the innerClassPrivateMethod() like InnerClass.innerClassPrivateMethod()? I see "Cannot make a static reference to the non-static method innerClassPrivateMethod() from the type EnclosingClass" If I change both the innerClassPrivateMethod and enclosingClassMethod as private I get error for InnerClass iC = new InnerClass(); as "No enclosing instance of type Basics6 is accessible. Must qualify the allocation with an enclosing instance of type enclosingClass."
has comment: http://stackoverflow.com/comment/36759781
score: -4
has comment: http://stackoverflow.com/comment/36759700
has comment: http://stackoverflow.com/comment/36759659
has comment: http://stackoverflow.com/comment/36759649
tagged with: private
has comment: http://stackoverflow.com/comment/36799601
has answer: http://stackoverflow.com/a/23879683
possible better answer: http://stackoverflow.com/a/23879618
has title: Why can't we access private methods of inner class from the enclosing class?
has answer: http://stackoverflow.com/a/23879618
has comment: http://stackoverflow.com/comment/36759633
linked to: http://stackoverflow.com/q/2042813
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36759656
downvote count: 6
accepted answer: http://stackoverflow.com/a/23879683
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36759758
tagged with: oop
tagged with: java

http://stackoverflow.com/q/23857245
downvote count: 2
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36718060
score: -2
tagged with: java
tagged with: jtable
has body: package dmaze2; import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class Dmaze2 extends JPanel { JTable jt; public Dmaze2() { String[] columns = {"1","2","3","4","5","6","7","8"}; Object[][] table={{"f","f","f","f","f","f","f","f"}, //if this table is string makes problem to add picture {"f","f","f","f","f","f","f","f"}, {"f","f","f","f","f","f","f","f"}, {"f","f","f","f","f","f","f","f"}, {"f","f","f","o","f","f","f","f"}, {"f","f","f","f","f","f","f","f"}, {"f","f","f","f","f","f","f","f"}, {"f","f","f","f","f","f","f","f"}}; int num=0; ImageIcon Icon = new ImageIcon("x.png"); //i have the image in all files of the project to be sure it finds it for (int i = 0; i &lt; 8 ; i++) { int a=1; for (int j = 0; j&lt;7 &amp;&amp; a&lt;8; j++,a++) { if(table[i][j]=="f" &amp;&amp; table[i][a]=="f") { num=num+1; table[i][j]=Icon; //if i try to enter the image here it will show it as x.png (as string) instead of the actual picture table[i][a]="u"; } } //int b=1; for (int j = 0; j&lt;8 &amp;&amp; i&lt;7; j++) { if(table[i][j]=="f" &amp;&amp; table[i+1][j]=="f") { num=num+1; table[i][j]="u";//we put the block used table[i+1][j]="u"; } } System.out.println(""); } jt = new JTable(table,columns); { } jt.setPreferredScrollableViewportSize(new Dimension(350,363)); jt.setFillsViewportHeight(true); JScrollPane jps = new JScrollPane(jt); add(jps); } public static void main(String[] args) { JFrame jf = new JFrame(); Dmaze2 t = new Dmaze2(); jf.setTitle("Depth First Search"); jf.setSize(500, 500); jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.add(t); } }
tagged with: cell
linked to: http://stackoverflow.com/q/23854130
upvote count: 0
has title: Instead of the picture it shows me the x.png inside the cell, how can i make it SHOW the actual picture or put some background color when value=="1"
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23857324
tagged with: imageicon
linked to: http://stackoverflow.com/q/513832
linked to: http://stackoverflow.com/q/9864267
type: UnansweredQuestion

http://stackoverflow.com/comment/92056494
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23877814
type: AnswerComment
has text: @testerjoe2 - you're right, while its a pretty image it does make it hard to read - like the old html days where people would have a yellow background with white text - makes your eyes want to bleed!

http://stackoverflow.com/comment/36856292
comment on: http://stackoverflow.com/q/23930142
score: 0
type: Comment
type: QuestionComment
has text: typing `java -version` into my shell gives me `OpenJDK Client VM (build 23.25-b01, mixed mode, sharing)`. I have jdk, right?

http://stackoverflow.com/comment/36694477
has text: If you can answer for both that will be great if possible please update answer
comment on: http://stackoverflow.com/a/23844554
score: 0
type: AnswerComment
type: Comment

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/23866428
tags question: http://stackoverflow.com/q/23828671
tags question: http://stackoverflow.com/q/23841103
tags question: http://stackoverflow.com/q/23883014
tags question: http://stackoverflow.com/q/23816338
tags question: http://stackoverflow.com/q/23850794
type: Tag
tags question: http://stackoverflow.com/q/23819452
tags question: http://stackoverflow.com/q/23860364
tags question: http://stackoverflow.com/q/23874274
tags question: http://stackoverflow.com/q/23866385
tags question: http://stackoverflow.com/q/23844107
tags question: http://stackoverflow.com/q/23787943

http://stackoverflow.com/a/23813138
type: Answer
has body: You could do this in your code : XML &lt;Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="match_parent" /&gt; Java public class MainActivity extends Activity implements OnItemSelectedListener{ private Spinner spinner; private static final String[]paths = {"item 1", "item 2", "item 3"}; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); spinner = (Spinner)findViewById(R.id.spinner); ArrayAdapter&lt;String&gt;adapter = new ArrayAdapter&lt;String&gt;("CLASS-NAME".this, android.R.layout.simple_spinner_item,paths); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); } public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int position, long id) { switch (position) { case 0: // What ever you want to happen when item 1 selected break; case 1: // What ever you want to happen when item 2 selected break; case 2: // What ever you want to happen when item 3 selected break; } } }
score: 0
answers question: http://stackoverflow.com/q/23812574

http://stackoverflow.com/comment/36687485
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23841454
has text: thanks!. Actually i tried with tx.commit() before 'executeupdate'. now i got it right.
type: Comment

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/23799561
tags question: http://stackoverflow.com/q/23839723
tags question: http://stackoverflow.com/q/23920801
tags question: http://stackoverflow.com/q/23845766
tag name: osx-mavericks

http://stackoverflow.com/q/23868712
has title: Templates for JSP pages
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36740342
has answer: http://stackoverflow.com/a/23884446
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23884317
accepted answer: http://stackoverflow.com/a/23884317
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23880804
has body: I am looking for a way for create a template for jsp pages with a similar behavior of the genereic class from Java? What I have now: in my folder of views (WEB-INF/view/jsp), I have a list of directories with the same fours files, with receive names of his functons (like, new item, change item, remove item, list). In each one of this groups, the jsp pages save ou read data from one specific Entity class from my project. For my Dao classes, for example, I have something like that: Generic class public class Dao&lt;E&gt; { private final Class&lt;E&gt; entity; @Autowired protected SessionFactory sessionFactory; protected Session getCurrentSession(){ return sessionFactory.getCurrentSession(); } public Dao(Class&lt;E&gt; classe) { this.entity = classe; } public boolean remove(E transientInstance) { ... } ... } and this way, each Dao class have a structure similar to this: @Repository public class FornecedorDao extends Dao&lt;Fornecedor&gt; { public FornecedorDao() { super(Fornecedor.class); } } Is there any to acomplish something similar to that for jsp pages? (I prefer a solution which don't need add to my project other framework, besides Spring). UPDATE Explaining better each one of the pages from each folder: new_item.jsp -> it's just a form from where I submit the data to server. each field of the form is a atribute from my Entity class. change_item.jsp -> same as new_item.jsp, plus a hidden field with the atribute id (primary key) of the class. remove_item.jsp -> have a form with only one field: a hidden one with the id of the element to be removed. list.jsp -> receives a list of items and generate a table where each column is a atribute from my entity class. what I wish acomplish, by example, it's something like this: in the template, I will have the html code for the form or the table. this pages have no style: a jquery code read them, strip the title and body content, and add this data to a div in my jsp page dashboard.jsp. in each one of the page, i like to tell…
answer count: 3
has comment: http://stackoverflow.com/comment/36739673
favorite count: 0
has comment: http://stackoverflow.com/comment/36739751
tagged with: spring
has answer: http://stackoverflow.com/a/23880804

http://stackoverflow.com/q/23931816
has comment: http://stackoverflow.com/comment/36858700
has body: I am trying to store the result of public static void readGrades() into method array int[]grades. But I fail to do so. I tried ArrayList and other stuff but unfortunately. public static int[]grades; public static void main(String[] args) { readGrades(); } public static void readGrades(){ Scanner in=new Scanner(System.in); System.out.print("How many students there are : "); int numberOfStudents=in.nextInt(); for(int i=1;i&lt;=numberOfStudents;i++){ System.out.print("Enter the grade of the students : "); int grades1=in.nextInt(); grades1++; }
possible better answer: http://stackoverflow.com/a/23931915
has comment: http://stackoverflow.com/comment/36858732
has answer: http://stackoverflow.com/a/23931915
accepted answer: http://stackoverflow.com/a/23931884
has comment: http://stackoverflow.com/comment/36859652
has comment: http://stackoverflow.com/comment/36859124
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36859460
tagged with: java
has title: How do I store void method result into int array method
type: Question
has comment: http://stackoverflow.com/comment/36859299
has comment: http://stackoverflow.com/comment/36859296
has answer: http://stackoverflow.com/a/23931884
score: 0
answer count: 2
tagged with: arrays

http://stackoverflow.com/a/23883660
has comment: http://stackoverflow.com/comment/36768697
score: 0
has comment: http://stackoverflow.com/comment/36768490
has comment: http://stackoverflow.com/comment/36767520
type: Answer
has comment: http://stackoverflow.com/comment/36767724
has comment: http://stackoverflow.com/comment/36768731
has body: That must be: rs=st.executeQuery("select Metrics.Metric_Name " + "from Metrics INNER JOIN Report ON Metrics.Report_ID=Report.Report_ID " + "where Report.Report_Name like '%"+s+"%' and IsNull (Metrics.Segment_ID) " ); The check if null use is null not == null
has comment: http://stackoverflow.com/comment/36768979
has comment: http://stackoverflow.com/comment/36768573
answers question: http://stackoverflow.com/q/23883619

http://stackoverflow.com/comment/36830916
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23916579
score: 0
has text: i don't know what ip address need to insert into Socket client = new Socket("", 4444); my android device and pc are connected into same local network

http://stackoverflow.com/a/23857981
has comment: http://stackoverflow.com/comment/36719401
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36719186
has body: According to apache it is recommended to have a single instance of HttpClient per communication component or even per application. But you need to keep in mind before implementing such a Singleton HttpClient. Make sure you are using a Thread to do all your downloading in the background and don't use the UI Thread. Maintain a queue for all the download requests. All these requests need to be queued and run one after the other. In case you switch an Activity before the HttpClient queue is clear, the queue should be cleared so that it does not start the loading of your components of the new activity. Close the client when everything finished.
answers question: http://stackoverflow.com/q/23857766
has comment: http://stackoverflow.com/comment/36719384
accepted answer of: http://stackoverflow.com/q/23857766
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36719627

http://stackoverflow.com/a/23909461
downvote count: 0
has body: In such situation you can use a stream cipher instead of a block cipher. Note that block ciphers can also be used as stream ciphers, for example the AES in counter mode. If you have to use a block cipher and all your fields are larger than one block you can use cipher text stealing. Both methods give you an output that has the same length as the input when regarded as byte array. There may be difficulties to represent the output byte array as a string in the same length as the input.
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37318872
answers question: http://stackoverflow.com/q/23909149

http://stackoverflow.com/q/23812803
tagged with: jclouds
type: Question
has answer: http://stackoverflow.com/a/23819430
answer count: 1
has body: I am trying to test this example http://jclouds.apache.org/guides/filesystem/ but I get this error on the line: BlobStoreContext context = ContextBuilder.newBuilder("filesystem") .overrides(properties) .buildView(BlobStoreContext.class); error: 13:39:23 ERROR main step.AbstractStep - Encountered an error executing the step java.lang.NoClassDefFoundError: com/google/gson/TypeAdapter at org.jclouds.rest.config.RestModule.configure(RestModule.java:62) at com.google.inject.AbstractModule.configure(AbstractModule.java:59) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223) at com.google.inject.spi.Elements.getElements(Elements.java:101) at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103) at com.google.inject.Guice.createInjector(Guice.java:95) at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:403) at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:327) at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:618) at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:598) Thanks!
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36638803
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36639822
has title: jclouds filesystem example

arraylist
tags question: http://stackoverflow.com/q/23818228
tags question: http://stackoverflow.com/q/23786955
tags question: http://stackoverflow.com/q/23834763
tags question: http://stackoverflow.com/q/23938667
tags question: http://stackoverflow.com/q/23912554
tags question: http://stackoverflow.com/q/23920316
tags question: http://stackoverflow.com/q/23930221
tags question: http://stackoverflow.com/q/23828068
tags question: http://stackoverflow.com/q/23909480
tags question: http://stackoverflow.com/q/23811253
tags question: http://stackoverflow.com/q/23875386
tags question: http://stackoverflow.com/q/23831157
tags question: http://stackoverflow.com/q/23798205
tags question: http://stackoverflow.com/q/23920425
tags question: http://stackoverflow.com/q/23902073
tags question: http://stackoverflow.com/q/23814063
tags question: http://stackoverflow.com/q/23842571
tags question: http://stackoverflow.com/q/23783550
tags question: http://stackoverflow.com/q/23932200
tags question: http://stackoverflow.com/q/23918707
tags question: http://stackoverflow.com/q/23894260
tags question: http://stackoverflow.com/q/23874913
tags question: http://stackoverflow.com/q/23788496
tags question: http://stackoverflow.com/q/23927866
tags question: http://stackoverflow.com/q/23836415
tags question: http://stackoverflow.com/q/23900351
tags question: http://stackoverflow.com/q/23866459
tags question: http://stackoverflow.com/q/23923852
tags question: http://stackoverflow.com/q/23789515
tags question: http://stackoverflow.com/q/23869417
tags question: http://stackoverflow.com/q/23841213
tags question: http://stackoverflow.com/q/23853590
tags question: http://stackoverflow.com/q/23793885
tags question: http://stackoverflow.com/q/23803762
tags question: http://stackoverflow.com/q/23851143
tags question: http://stackoverflow.com/q/23929542
tags question: http://stackoverflow.com/q/23917326
tags question: http://stackoverflow.com/q/23935455
tags question: http://stackoverflow.com/q/23788369
tags question: http://stackoverflow.com/q/23824684
tags question: http://stackoverflow.com/q/23783365
tags question: http://stackoverflow.com/q/23892576
tags question: http://stackoverflow.com/q/23785976
tags question: http://stackoverflow.com/q/23858408
tags question: http://stackoverflow.com/q/23883589
tags question: http://stackoverflow.com/q/23914666
tags question: http://stackoverflow.com/q/23852430
tags question: http://stackoverflow.com/q/23902823
tags question: http://stackoverflow.com/q/23872559
tags question: http://stackoverflow.com/q/23844711
tags question: http://stackoverflow.com/q/23898340
tags question: http://stackoverflow.com/q/23881232
tags question: http://stackoverflow.com/q/23805942
tags question: http://stackoverflow.com/q/23925951
tags question: http://stackoverflow.com/q/23888289
tags question: http://stackoverflow.com/q/23859699
tags question: http://stackoverflow.com/q/23935796
tags question: http://stackoverflow.com/q/23904358
type: Tag
tags question: http://stackoverflow.com/q/23794576
tags question: http://stackoverflow.com/q/23823076
tags question: http://stackoverflow.com/q/23829989
tags question: http://stackoverflow.com/q/23920677
tags question: http://stackoverflow.com/q/23934832
tags question: http://stackoverflow.com/q/23838886
tag name: arraylist
tags question: http://stackoverflow.com/q/23828938
tags question: http://stackoverflow.com/q/23830640
tags question: http://stackoverflow.com/q/23852593
tags question: http://stackoverflow.com/q/23870518
tags question: http://stackoverflow.com/q/23837205
tags question: http://stackoverflow.com/q/23860595

http://stackoverflow.com/comment/36834839
score: 0
has text: Sorry to hear that. In case my last comment was not clear, I was suggesting ramping up to the volume setting from 0, rather than starting at a given volume with the line. And/or: perhaps set the value prior to launching the Clip. I'd also as a diagnostic check, send the db values to a file or stdout to check whether or not there are any large jumps in that value.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23876358

http://stackoverflow.com/q/23905176
has comment: http://stackoverflow.com/comment/36809332
has comment: http://stackoverflow.com/comment/36809577
answer count: 1
has body: I took response from server using bluetooth got like this. Now I need to get data from this string. String is like { "k2": { "mk1": "mv1", "mk2": [ "lv1", "lv2" ] } } But it's not converting to JSONObject. I need to get all values from here.
has comment: http://stackoverflow.com/comment/36809352
has comment: http://stackoverflow.com/comment/36813900
downvote count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/36809246
has comment: http://stackoverflow.com/comment/36809220
favorite count: 0
has title: data from Json string
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36809317
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23905599
accepted answer: http://stackoverflow.com/a/23905599
type: Question
upvote count: 2

http://stackoverflow.com/comment/36869415
has text: I tried this but it only displays a blank JPanel. What is wrong? `TitleScreen title = new TitleScreen(this); ScrollingShooter game = new ScrollingShooter(this); JPanel cards = new JPanel(new CardLayout()); cards.add(title, "title"); cards.add(game, "game"); CardLayout cardLayout = (CardLayout) cards.getLayout(); cardLayout.show(cards, "title";`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23902467

http://stackoverflow.com/comment/36812470
type: Comment
comment on: http://stackoverflow.com/q/23790333
score: 0
type: QuestionComment
has text: @FuzzyTree That didn't change anything. Good catch though.

http://stackoverflow.com/comment/36835117
comment on: http://stackoverflow.com/q/23916211
score: 0
has text: So far I always thought a maven parent is also the module pom that is used to build the entire application.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36596347
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23793449
has text: when you run 'whoami' on command line do you get root or vk?
score: 0

http://stackoverflow.com/a/23860891
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23860661
has comment: http://stackoverflow.com/comment/36725612
downvote count: 0
has body: What you really need is to understand exactly what static and non-static actually mean. First, some background. Apologies if some of this is already familiar to you. Java is an object oriented language, you create a class to act as a template for a specific type of object, defining what attributes (variables) that it has, and how it behaves (methods). These attributes and behaviours belong to objects of that class: public class Person { private String forename; private String surname; public Person(String forename, String surname) { this.forename = forename; this.surname = surname; } public String getFullName() { return forename + " " + surname; } public static void main(String[] args) { Person john = new Person("John", "Doe"); } } The above code defines a template for creating objects of the type Person, each having a forename and a surname, both of the type String. It also defines a behaviour that allows you to get a Person's full name using the getFullName() method. Both forename and surname, as well as getFullName() are examples of non-static fields/methods. That is, they belong to a specific Person object. Importantly: none of these can exist without a Person object being created first. In this case we have a Person object called john which has a forename of "John" and a surname of "Doe". If we were to call john's getFullName() method: john.getFullName(); Then we'd get "John Doe" back. The opposite of this is static. Static things do not belong to an object, instead, they belong to a class. public class Person { private String forename; private String surname; private static String species = "Homo sapiens"; public Person(String forename, String surname) { this.forename = forename; this.surname = surname; } public String getFullName() { return forename + " " + surname; } public static void main(String[] args) { Person john = new Person("John", "Doe"); } } Here the String species doesn't belong to john, it belongs to Person. Static methods and variables don't nee…

http://stackoverflow.com/a/23833090
answers question: http://stackoverflow.com/q/23817051
score: 1
has body: Okay this ended up being a little convoluted. The colors are indeed affected by the Java > Editor > Syntax Coloring > Javadoc section. But, owing to the unique way Eclipse preferences are made, those preferences will not affect the Javadocs unless you follow a fairly specific routine. *note, this routine only applies to a very specific situation: If you load up a syntax coloring by using Color Theme and you don't like how the JavaDoc elements are colored in Groovy, but do like how they show up in Java. It ought to be controlled by Java, but for some reason it's not, and clicking apply on the current Java color scheme doesn't do anything. Basically, you need to change the color to something else, apply it, then change it back to the original color and apply it. And apparently you have to do it while these elements are on a text page that you can see running in the background (Eclipse syntax colors changes are like sub atomic particles apparently.) This will make it so that the Java syntax coloring is able to over-write whatever the Color Theme tool did to the Groovy preferences... Anyway, yeah, it's a bit convoluted and is probably a bug. But at least it can be worked around.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36778769
type: Comment
type: QuestionComment
has text: Your understanding is wrong. Due to generic erasure, the `(E[])` cast doesn't actually do anything.
score: 1
comment on: http://stackoverflow.com/q/23889506

http://stackoverflow.com/comment/36567787
type: AnswerComment
has text: Thanks, no idea why I didn't think of this.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23778205

http://stackoverflow.com/comment/36633917
type: Comment
comment on: http://stackoverflow.com/a/23813066
type: AnswerComment
has text: Oh, yeah, my point is that I'd like the parameter *values* to be in the annotations, not in a separate file like TestNG apparently requires. In the example you posted, I'd have to put the parameter values in testng.xml for example, which is a very cumbersome compared to the approach taken by NUnit. I'm curious on whether any of these frameworks can work in a similar way, with parameter values in the test annotation, not in an external place.
score: 0

http://stackoverflow.com/comment/36783307
type: AnswerComment
has text: I added the id myself because it was easier for me to get to the element like this. I think the problem is not how to get the element, but rather how to get the attribute of an element. That is why I wrote my example code like this.
type: Comment
comment on: http://stackoverflow.com/a/23891510
score: 0

http://stackoverflow.com/q/23928758
type: Question
has comment: http://stackoverflow.com/comment/71300399
has comment: http://stackoverflow.com/comment/89398434
has comment: http://stackoverflow.com/comment/72610232
has comment: http://stackoverflow.com/comment/109251387
linked to: http://stackoverflow.com/q/26982040
answer count: 6
has comment: http://stackoverflow.com/comment/70723185
has title: Google push notifications - Unauthorized WebHook callback channel
tagged with: google-drive-api
has answer: http://stackoverflow.com/a/52704706
has comment: http://stackoverflow.com/comment/42760619
tagged with: google-api
has answer: http://stackoverflow.com/a/39395386
has answer: http://stackoverflow.com/a/69638761
upvote count: 23
has comment: http://stackoverflow.com/comment/66085794
has comment: http://stackoverflow.com/comment/59198947
has answer: http://stackoverflow.com/a/24588802
has answer: http://stackoverflow.com/a/53612907
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/71341542
has answer: http://stackoverflow.com/a/52093708
has body: I'm facing problem with Google push notifications (for drive). I use service account which works perfectly for all other drive operations except drive changes watch. Below is application code which now fails with "Unauthorized WebHook callback channel" exception. I also dumped requests and responses which are generated when drive.changes.watch.execute is called. Target notification address is whitelisted in APIs &amp; auth Push control panel (I even listed it in Javascript origins and referrers) and now I'm stuck with this 401 Unauthorized error. Does someone know where I'm making mistake? Thanks for any help. PrivateKey serviceAccountPrivateKey = SecurityUtils.loadPrivateKeyFromKeyStore(SecurityUtils.getPkcs12KeyStore(), p12File, "notasecret", "privatekey", "notasecret"); JsonFactory jsonFactory = new JacksonFactory(); HttpTransport t = GoogleNetHttpTransport.newTrustedTransport(); GoogleCredential gc = new GoogleCredential.Builder() .setTransport(t) .setJsonFactory(jsonFactory) .setServiceAccountScopes(Collections.singleton(DriveScopes.DRIVE)) .setServiceAccountPrivateKey(serviceAccountPrivateKey) .setServiceAccountId(Config.SERVICE_ACCOUNT_ID) .setServiceAccountUser(Config.SERVICE_ACCOUNT_USER) .build(); drive = new Drive.Builder(t, jsonFactory, null).setHttpRequestInitializer(gc).setApplicationName(cfg.getStringParam(Config.GAE_APPLICATION_NAME)).build(); // THIS WORKS Changes.List request = drive.changes().list(); ChangeList changes = request.execute(); // THIS DOES NOT WORK Channel channel = new Channel(); channel.setId(UUID.randomUUID().toString()); channel.setType("web_hook"); channel.setAddress(Config.PUSH_NOTIFICATION_ADDRESS); Channel c = drive.changes().watch(channel).execute(); -------------- REQUEST -------------- POST https://www.googleapis.com/drive/v2/changes/watch Accept-Encoding: gzip Authorization: Bearer XXX User-Agent: XXX Google-HTTP-Java-Client/1.17.0-rc (gzip) Content-Type: application/json; charset=UTF-8 Content-Length: 118 CONFIG: curl -v …
tagged with: google-api-java-client
downvote count: 0
has comment: http://stackoverflow.com/comment/70709075
score: 23
favorite count: 0

http://stackoverflow.com/comment/36830859
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23915838
has text: @HotLicks Yeah saw that mentioned a good bit. I'm lost as to why it doesn't work as expected. See the socket won't allow a lot of calls every second so I need to do this.
score: 0

http://stackoverflow.com/comment/36750027
has text: If it helped you then kindly accept as answer. Hv fun coding.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23863421

http://stackoverflow.com/q/23864791
score: 0
answer count: 1
type: UnansweredQuestion
has body: i am using Java Metro framework for publishing web services, i configure the ssl handshake to require a ssl certificate from client, how can i catch the ssl client certificate details in my server code ? Thanks for help
tagged with: glassfish-3
tagged with: java
type: Question
tagged with: ssl
has title: using Java-Metro, from server side, how to get ssl client certificate details?
tagged with: java-metro-framework
has answer: http://stackoverflow.com/a/25551736

http://stackoverflow.com/comment/39153245
has text: The .exe is a wrapper which calls JNI_CreateJavaVM to start up the JVM. It also loads some memory preferences from the registry to pass to the JVM (i.e. via -Xmx).
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23816764

http://stackoverflow.com/q/23913762
score: 54
type: Question
tagged with: android
upvote count: 54
has answer: http://stackoverflow.com/a/69319280
has answer: http://stackoverflow.com/a/35553778
favorite count: 0
has answer: http://stackoverflow.com/a/61209577
has answer: http://stackoverflow.com/a/23913900
answer count: 7
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/62517890
has answer: http://stackoverflow.com/a/70318294
has title: Best method to measure execution time in Android?
has body: What is best method to measure execution time of Android code snippet? I have a section of code before and after which I want to place timestamps to find out it's execution time (e.g. one in onCreate() and another in onDestroy() method of activity). I have tried Time.toMillies(false), but it only returns seconds to me (with constant 000 at the end). I also tried two java functions: System.currentTimeMillis() and System.nanoTime(). First one returns milliseconds of epoch time, second doesn't. What would be the best way to measure execution time and get good precision?
has answer: http://stackoverflow.com/a/23913848
downvote count: 0

http://stackoverflow.com/q/23861619
accepted answer: http://stackoverflow.com/a/23861709
linked to: http://stackoverflow.com/q/19152526
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23861709
has title: How to read lambda expression bytecode using ASM
type: Question
answer count: 2
has body: How can I read the bytecode instructions from the body of a lambda expression using ASM?
downvote count: 1
tagged with: java-bytecode-asm
favorite count: 0
score: 8
upvote count: 9
possible better answer: http://stackoverflow.com/a/35223119
linked to: http://stackoverflow.com/q/23133243
has answer: http://stackoverflow.com/a/35223119

yaml
tags question: http://stackoverflow.com/q/23839506
tags question: http://stackoverflow.com/q/23882404
tag name: yaml
type: Tag

http://stackoverflow.com/comment/36860820
has text: so is it safe for me to think about underscore before a variable name as a member variable that could be referred to by the `this` keyword? Some people are claiming on this post that the convention is used to highlight private variables.
type: AnswerComment
comment on: http://stackoverflow.com/a/23932791
score: 0
type: Comment

http://stackoverflow.com/q/23888240
has comment: http://stackoverflow.com/comment/36776328
downvote count: 0
score: 1
tagged with: import
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36776414
has comment: http://stackoverflow.com/comment/36776562
upvote count: 1
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/36777066
accepted answer: http://stackoverflow.com/a/23888299
has body: I am trying to import a file which is in the jar file. I have used many versions of the jar file but i cannot able to figure out which version of the jar will support that import statement. This is the statement that i am trying to import import com.google.appengine.repackaged.com.google.common.util.Base64; and this is the jar file link that i have downloaded and added to my eclipse project classpath http://www.java2s.com/Code/Jar/a/Downloadappengineapi120jar.htm Please help in importing the above statement with a suitable jar file. Thanks in advance public void String signPolicyDocument(String policyDocument, String secret) { try { Mac mac = Mac.getInstance("HmacSHA1"); byte[] secretBytes = secret.getBytes("UTF8"); SecretKeySpec signingKey = new SecretKeySpec(secretBytes, "HmacSHA1"); mac.init(signingKey); byte[] signedSecretBytes = mac.doFinal(policyDocument.getBytes("UTF8")); String signature = Base64.encode(signedSecretBytes); return signature; } catch (InvalidKeyException e) { throw new RuntimeException(e); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
favorite count: 0
has title: error in importing the file from jar in java
linked to: http://stackoverflow.com/q/3280353
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23888299
has comment: http://stackoverflow.com/comment/36776216
type: AnsweredQuestion

http://stackoverflow.com/a/23855137
type: Answer
downvote count: 0
score: 1
has body: Add static main function and than initiate your class inside: public static void main(String[] args) { Kartuves obj = new Kartuves(); obj.init(); // Or do whatever you need } And you should not use diacritic in class names or variables. Than you can export executable file from Eclipse.
answers question: http://stackoverflow.com/q/23855030
upvote count: 1

http://stackoverflow.com/comment/36727762
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23860881
has text: Thank you so much for your help. In the interest of time, I did not get to simplifying the if statements but I did change the statement in the move() method and also added a statement that checks the validity of jump2 and jump1 in the jump2() method. So far I have not gotten any of the Out of Bounds exceptions however for some reason in some cases (specifically if the red piece is on the far right or far left side of the board) the piece chooses not to jump over the adjacent black piece as intended. Instead it simply stays put and does nothing. Any advice?

http://stackoverflow.com/comment/36708016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23828865
score: 0
has text: @Joe: This doesn't exactly read like a duplicate of that question to me. It seems that the OP wants to *avoid* invoking an exception case.

http://stackoverflow.com/a/23876627
answers question: http://stackoverflow.com/q/23876580
has body: UDP packets are not 100% successful. There is a fair chance your packet will arrive late or even never. Your issue could be caused by almost anything. If you want a guaranteed connection, try using TCP. TCP is much more reliable at the cost of speed.
score: 0
type: Answer

http://stackoverflow.com/q/23856549
tagged with: jsp
tagged with: tomcat
tagged with: servlets
has comment: http://stackoverflow.com/comment/36716283
accepted answer: http://stackoverflow.com/a/23856741
favorite count: 0
possible better answer: http://stackoverflow.com/a/38548409
upvote count: 2
has answer: http://stackoverflow.com/a/38548409
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36716345
score: 1
has body: There error I get when I attempt to start the local Tomcat 7 server in Eclipse: 'Starting Tomcat v7.0 Server at localhost' has encountered a problem. Server Tomcat v7.0 Server at localhost failed to start. These are the steps I took: Create a new project called "test". Create a new index.jsp file. Create a new servlet called "Testservlet". Package name: testpackage Configure a new build path for Web App Libraries. Add an External JAR from the Tomcat 7 directory I add servlet-api.jar. This is the path structure in Eclipse: The contents of the web.xml file: <?xml version="1.0" encoding="UTF-8"?> test index.jsp Testservlet testpackage.Testservlet Testservlet /Testservlet Contents of the Testservlet.java file: package testpackage; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(description = "a test servlet", urlPatterns = { "/Testservlet" }) public class Testservlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("text/html"); out.println("This is a test servlet"); } } Next I add the project to the Tomcat server and attempt to start the server. Which is when I get the error stopping the server from running. If I remove the servlet related markup from the web.xml file the server starts perfectly fine. This is the markup I remove: Testservlet testpackage.Testservlet Testservlet /Testservlet I assume that I need the above markup in the web.xml in order for the servlet to display when I navigate to test/Testservlet though? Especially when I deploy the project to a remote server. What am I doing wrong here?
tagged with: java
has comment: http://stackoverflow.com/comment/36716352
has title: Tomcat 7 server failed to start after creating a servlet using eclipse
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23856741
answer count: 2

http://stackoverflow.com/q/23923835
tagged with: uuid
tagged with: java
has title: Get the connection associated with an Atmosphere @ManagedService message
type: Question
has body: In this example, is there a way to modify this method @org.atmosphere.config.service.Message(encoders = {JacksonEncoder.class}, decoders = {JacksonDecoder.class}) public Message onMessage(Message message) throws IOException { logger.info("{} just send {}", message.getAuthor(), message.getMessage()); return message; } so I can get the UUID (available in the AtmosphereResource upon connection) so that I know which connection the message is coming from? I have tried adding an AtmosphereResource parameter, but it doesn't work (no message is received).
upvote count: 3
has answer: http://stackoverflow.com/a/23924013
answer count: 1
favorite count: 0
tagged with: atmosphere
type: UnansweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/q/23822969
upvote count: 7
downvote count: 1
accepted answer: http://stackoverflow.com/a/23823120
has body: How can I temporarily disable a package in a project from compiling in Java EE IDE? The package has some source files that I want to prevent from compiling temporarily.
possible better answer: http://stackoverflow.com/a/23823922
favorite count: 0
has comment: http://stackoverflow.com/comment/36652002
has answer: http://stackoverflow.com/a/47724395
has answer: http://stackoverflow.com/a/23823120
type: AnsweredQuestion
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/36652099
has answer: http://stackoverflow.com/a/23823922
type: Question
has title: how to temporarily disable a package in a project from compiling in Java EE IDE
tagged with: eclipse
answer count: 3

http://stackoverflow.com/q/23820026
has comment: http://stackoverflow.com/comment/36646606
upvote count: 1
possible better answer: http://stackoverflow.com/a/23820164
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23822485
score: -1
has comment: http://stackoverflow.com/comment/36650070
has comment: http://stackoverflow.com/comment/36652191
type: Question
has answer: http://stackoverflow.com/a/23820248
tagged with: validation
tagged with: jsp
tagged with: struts2
answer count: 3
has body: I am doing programmatic validation, when I click the submit button, the validate method has been called, but it shows NullPointerException. It won't validate, but I am unable to find my mistake. index.jsp: <%@ taglib uri="/struts-tags" prefix="s"%> <s:actionerror /> <s:form action="insert"> <s:textfield name="" key="user.name" /> <s:textfield name="" key="user.pass" /> <s:submit value="login" /> </s:form> UserLogin.java: package jack; import com.opensymphony.xwork2.ActionSupport; public class UserLogin extends ActionSupport { private String username; private String password; //getter and setter method @Override public void validate() { System.out.println("validate"); if (this.username.equals("") || username.length() == 0) { this.addFieldError(username, getText("user.wrong")); } if (this.password.equals("") || password.length() == 0) { this.addFieldError(password, getText("pass.wrong")); } } @Override public String execute() throws Exception { System.out.println("execute"); return SUCCESS; } } struts.xml: <?xml version="1.0" encoding="UTF-8"?> /success.jsp /error.jsp /index.jsp struts.properties: struts.custom.i18n.resources=Mybundle Mybundle.properties: user.name=username user.pass=password user.wrong=enter username pass.wrong=enter password
has title: Validate method getting NullPointerException during login in Struts2
has answer: http://stackoverflow.com/a/23822485
favorite count: 0
has answer: http://stackoverflow.com/a/23820164
downvote count: 2

http://stackoverflow.com/a/57159734
has body: Using -keep is a bad practice and you should never do it .You almost never want to use -keep; if you do need a ProGuard rule, you usually want one of the more specific variants -keepclassmembers - This protects only the members of the class from shrinking and obfuscation. -keepnames - This allows shrinking for classes and members, but not obfuscation. That is, any unused code is going to get removed. But the code that is kept will keep its original names. -keepclassmembernames - Unused classes are removed, the remaining classes are renamed, unused members of those classes are removed, but then the remaining members keep their original names. For more information please read this PS - this is what I did for Gson -keepclassmembernames class rscom.pojo.** { &lt;fields&gt;; }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23826171
downvote count: 0
has comment: http://stackoverflow.com/comment/111715578
type: Answer

http://stackoverflow.com/q/23854958
has comment: http://stackoverflow.com/comment/36713378
type: Question
has title: Applet content works with Eclipse but not in my browser
tagged with: eclipse
score: 0
tagged with: japplet
has body: Hello I am trying to make an applet from my Java application. My application starts with a Testpan.java class which extends a JPanel. I made a AppletLauncher.java class to use it in an applet. I compiled this AppletLauncher with Eclipse as either an applet, either an application. In both cases my program works. However when I try to load it in my web browser using a html file, the contained Testpan JPanel doesn't show at all. I first suspected it had to do with the paint() metho used in my applet class, however it works with Eclipse. I don't understand why it does not work inside my web browser (Firefox). I think I used JApplet's methods correctly, didn't I? Here is my AppletLauncher.java code: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import javax.swing.Box; import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.JPanel; public class AppletLauncher extends JApplet { public static Dimension dimWindow = new Dimension(500,300) ; protected Testpan tp; public AppletLauncher() { } // Common initialization for either JApplet or JFrame private void initContainer(Container container) { System.out.println("initCOntainer"); //container.setLocation(10, 10); container.setPreferredSize(dimWindow); tp = new Testpan(); tp.setVisible(true); container.add(tp); //container.add(new Testpan(), BorderLayout.SOUTH); //setBackground(Color.red); } @Override public void init() { System.out.println("Initializing..."); EventQueue.invokeLater(new Runnable() { public void run() { initContainer(AppletLauncher.this); } }); } @Override public void destroy() { System.out.println("Destroying applet..."); } public void paint(Graphics g) { System.out.println("paint AppletLauncher"); g.drawString("Hello wor\nld!", 100, 50); setBackground(Color.red); tp.paint(g); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { Syst…
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36734204
answer count: 0
tagged with: java

http://stackoverflow.com/q/23797794
has comment: http://stackoverflow.com/comment/36604435
has comment: http://stackoverflow.com/comment/36605163
tagged with: jeditorpane
answer count: 0
score: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
downvote count: 1
has title: simple web browser which can parse css page too
has comment: http://stackoverflow.com/comment/36605855
linked to: http://stackoverflow.com/q/2438201
tagged with: java
has comment: http://stackoverflow.com/comment/36604241
has comment: http://stackoverflow.com/comment/36604148
type: Question
has comment: http://stackoverflow.com/comment/36605888
tagged with: browser
has comment: http://stackoverflow.com/comment/36604162
has comment: http://stackoverflow.com/comment/36605766
has comment: http://stackoverflow.com/comment/36604146
has body: I am designing a web browser..It Is displaying the web pages but now the problem is....it is not parsing the page properly (i.e when i browse for "Google" page with my web browser,it is displaying but with a blue background and not aligned properly too)....can anyone help me by saying how to parse(cascading style sheet) in HTML with java swing,,A part of code is displayed below class Page extends JPanel implements Action Listener { JPanel head; JTextField addrbar; JEditorPane webpage; JScrollPane scr; JLabel statusbar; JButton homebtn,refreshbtn,gobtn,hisbtn,bookbtn,shbtn; public Page() { setLayout(new BorderLayout()); head=new JPanel(); head.setLayout(new FlowLayout()); homebtn=new JButton("Home"); homebtn.addActionListener(this); head.add(homebtn); addrbar=new JTextField(100); addrbar.addActionListener(this); head.add(addrbar); gobtn=new JButton("Go"); gobtn.addActionListener(this); head.add(gobtn); hisbtn=new JButton("History"); System.out.println("action"); hisbtn.addActionListener(this); head.add(hisbtn); bookbtn=new JButton(new ImageIcon("Z://Browser/Source/Resources/Images/bkk.jpg")); bookbtn.addActionListener(this); head.add(bookbtn); shbtn=new JButton("Show Bookmarks"); shbtn.addActionListener(this); head.add(shbtn); refreshbtn=new JButton("Refresh"); head.add(refreshbtn); statusbar=new JLabel(); try{ URL url = new URL("http://www.google.com"); PrintWriter ps=new PrintWriter(new FileWriter("Z://Browser/Source/history.txt",true)); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy_HH:mm:ss"); Date date1 = new Date(); // ps.print(url +"_"+date.getDate()+"_"+(date.getMonth()+1)+"#"); ps.print(url +"_"+dateFormat.format(date1)+"#"); ps.close(); addrbar.setText(url.toString()); webpage=new JEditorPane(url); webpage.setEditable(false); webpage.addHyperlinkListener(new SimpleLinkListener(webpage,addrbar,statusbar)); scr=new JScrollPane(webpage, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(head,BorderLayout.N…
favorite count: 0
has comment: http://stackoverflow.com/comment/36605259

http://stackoverflow.com/a/23841547
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23841232
type: Answer
has body: Based on your comment, sounds like a CyclicBarrier would fit your need exactly. From the docs (emphasis mine): A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. The barrier is called cyclic because it can be re-used after the waiting threads are released. Unfortunately, I haven't used them myself, so I can't give you specific pointers on them. I think the basic idea is you construct your barrier using the two-argument constructor with the barrierAction. Have your n threads await() on this barrier after this task is done, after which barrierAction is executed, after which the n threads will continue. From the javadoc for CyclicBarrier#await(): If the current thread is the last thread to arrive, and a non-null barrier action was supplied in the constructor, then the current thread runs the action before allowing the other threads to continue. If an exception occurs during the barrier action then that exception will be propagated in the current thread and the barrier is placed in the broken state.

http://stackoverflow.com/q/23892649
type: Question
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23892797
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23892797
tagged with: web.xml
tagged with: jetty
type: AnsweredQuestion
has body: I am deploying a war file to tomcat, however I am wanting to override my deployment descriptor web.xml, the purpose is to have a web app customized for different environments. I use a jetty demo launcher rather than deploying to tomcat each time, I found out that jetty can do this which works: Server server = new Server(9090); WebAppContext context = new WebAppContext("src/main/webapp", "/"); List&lt;String&gt; overrideDescriptors = new ArrayList&lt;String&gt;(); overrideDescriptors.add("src/main/resources/jetty-override-web.xml"); context.setOverrideDescriptors(overrideDescriptors); context.setClassLoader(Thread.currentThread().getContextClassLoader()); server.setHandler(context); server.start(); server.join(); I'm no tomcat warrior or anything so please bear with me. My question is is there any config in tomcat I can use to achieve the same thing for when I deploy my war file?
tagged with: java
has title: Web.xml Override Descriptors for tomcat?

http://stackoverflow.com/a/23926441
answers question: http://stackoverflow.com/q/23926350
score: 0
has body: I can see two bugs. (1) The line that reads for(i=x,k=0;i &gt;(x+len);i++,k++) should read for(i=x,k=0;i &gt;(x-len);i--,k++) I think it's line 89. (2) The bug that's causing this exception is the fact that every time you've got a whole lot of conditions separated by &amp;&amp;, the first one should be &amp;&amp; and the subsequent ones should be ||. For example, if((grid[x][i]!='*')&amp;&amp; (grid[x][i]!=word.charAt(k)) &amp;&amp; ((y+len) &gt;15)) { should read if((grid[x][i]!='*')&amp;&amp; (grid[x][i]!=word.charAt(k)) || ((y+len) &gt;15)) { because you need to return that this square is an unsafe place to start the word if y + len &gt; 15 regardless of what is found at each of the grid squares that you're checking. Similarly, with all the other conditions that look like this.
type: Answer

http://stackoverflow.com/comment/36629434
type: Comment
type: QuestionComment
has text: Also, remember not to create too many strings. Use a `StringBuilder` to hold them, as `String` is immutable.
score: 0
comment on: http://stackoverflow.com/q/23798229

http://stackoverflow.com/a/23848055
answers question: http://stackoverflow.com/q/23847729
type: Answer
accepted answer of: http://stackoverflow.com/q/23847729
score: 1
has body: Spring comes with an SpringJUnit4ClassRunner and a @ContextConfiguration -annotation. If you use them, then spring will reuse the same Spring Context in different tests. So a Spring test class can look like this: package com.queomedia; import javax.annotation.Resource; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; @RunWith(SpringJUnit4ClassRunner.class) //@Transactional @ContextConfiguration(SpringTestContext.APPLICATION) public class SpringContextTest { @Autowire private ApplicationContext applicationContext; //Test that the spring context can been loaded @Test public void testSpringContextLoad() { Assert.assertNotNull("application context expected", this.applicationContext); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/36700468
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23801950
tagged with: java
has comment: http://stackoverflow.com/comment/36611854
type: Question
accepted answer: http://stackoverflow.com/a/23802247
answer count: 1
downvote count: 0
has title: Spring 4 and Java 8 Invalid byte tag exception
favorite count: 0
score: 38
upvote count: 38
has comment: http://stackoverflow.com/comment/37303804
tagged with: spring
has answer: http://stackoverflow.com/a/23802247
tagged with: java-8
has body: I am trying to run a simple JUnit test using Spring and Java 8 JDK: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) @WebAppConfiguration public class UserServicesTest{ @Test public void testJava8() { Set<String> strings = new HashSet<>(); strings.add("a"); strings.add("b"); strings.add("c"); strings.stream().filter(a -> a.equals("a")).forEach(p -> p.toString()); } And I get this runtime error on startup: org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18 at org.aspectj.apache.bcel.classfile.Constant.readConstant(Constant.java:133) at org.aspectj.apache.bcel.classfile.ConstantPool.<init>(ConstantPool.java:45) at org.aspectj.apache.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:186) at org.aspectj.apache.bcel.classfile.ClassParser.parse(ClassParser.java:131) at org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository.loadJavaClass(NonCachingClassLoaderRepository.java:262) at org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository.loadClass(NonCachingClassLoaderRepository.java:242) at org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository.loadClass(NonCachingClassLoaderRepository.java:249) at org.aspectj.weaver.reflect.Java15AnnotationFinder.getAnnotations(Java15AnnotationFinder.java:202) at org.aspectj.weaver.reflect.ReflectionBasedResolvedMemberImpl.unpackAnnotations(ReflectionBasedResolvedMemberImpl.java:211) at org.aspectj.weaver.reflect.ReflectionBasedResolvedMemberImpl.hasAnnotation(ReflectionBasedResolvedMemberImpl.java:163) at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(ExactAnnotationTypePattern.java:109) at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(ExactAnnotationTypePattern.java:96) at org.aspectj.weaver.patterns.AnnotationPointcut.matchInternal(AnnotationPointcut.java:156) at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137) at org.aspectj.weaver.internal.tools.PointcutExp…
tagged with: jakarta-ee
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23622426

http://stackoverflow.com/comment/36866054
score: 0
comment on: http://stackoverflow.com/q/23934725
type: Comment
has text: That doesn't look like XML to me - presumably the tags like ` ` are supposed to be ` `. Please edit the question and fix the XML to be well-formed.
type: QuestionComment

http://stackoverflow.com/comment/47147647
comment on: http://stackoverflow.com/q/23916710
has text: i have the same problem, we are using <hadoop-hdfs.version>2.5.0-cdh5.2.0</hadoop-hdfs.version> <hadoop-common.version>2.5.0-cdh5.2.0</hadoop-common.version>
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36774777
has text: @curtisLoew please the updated code. yes it is overriden
comment on: http://stackoverflow.com/q/23887325
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36679879
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23837689
score: 2
has text: set format pattern to `yyyy`

http://stackoverflow.com/comment/36611735
has text: @joachim ya any random 100 is fine. is there way to do it without using loop?
comment on: http://stackoverflow.com/q/23801811
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36706023
comment on: http://stackoverflow.com/q/23851064
score: 0
type: Comment
type: QuestionComment
has text: So what's the desired output for `"2100"`?

http://stackoverflow.com/q/23830221
tagged with: jpa
score: 0
possible better answer: http://stackoverflow.com/a/23830330
answer count: 2
has answer: http://stackoverflow.com/a/23830330
type: AnsweredQuestion
has title: Hibernate/JPA : How to do the query that return the attribute of the DAO?
has answer: http://stackoverflow.com/a/23830529
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/23830529
has body: I have these 2 classes : public class E1 { int id; E2 e; // getters and setters } public class E2 { int id; // attributes, getters and setters } What would be the right JPA Query that will return the right E2 instance using E1 id attribute ? E2 findE2ByE1Id(int E1Id) { // which query here? }

http://stackoverflow.com/a/23789307
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36588957
has body: The basic code for adding (or removing) a component from a visible frame is: panel.add(...); panel.revalidate(); panel.repaint(); In your case the "panel" would be the content pane of your JFrame. Also, when you do custom painting, you also need to override the getPreferredSize() method of the panel, so the layout manager can use this information to set the size/location of the panel.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36590463
has comment: http://stackoverflow.com/comment/36588350
answers question: http://stackoverflow.com/q/23788776
accepted answer of: http://stackoverflow.com/q/23788776
type: AcceptedAnswer

http://stackoverflow.com/a/23874459
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36751066
has comment: http://stackoverflow.com/comment/36750942
has body: It's very simple code. Make sunnyButton and cloudyButton as instance member. Simply check for the source of the action event and hide the source component and show the other one. public void actionPerformed(ActionEvent e) { if (sunnyButton == e.getSource()) { sunnyButton.setVisible(false); cloudyButton.setVisible(true); } else if (cloudyButton == e.getSource()) { sunnyButton.setVisible(true); cloudyButton.setVisible(false); } ... }
downvote count: 0
answers question: http://stackoverflow.com/q/23874314
type: Answer

http://stackoverflow.com/comment/36771440
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23885589
has text: If you create a [custom matcher](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/CustomMatcher.html) then you can do whatever you want to match the objects. Have you tried this? If so, what happened?
type: Comment

http://stackoverflow.com/comment/36739652
comment on: http://stackoverflow.com/q/23869016
has text: That would be the `+`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37032527
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23782769
has text: Urban Airship's SDK will automatically register your device tokens or APIDs for you. I recommend viewing their sample applications or their docs here: http://docs.urbanairship.com/build/android.html and here: http://www.urbanairship.com/resources/developer-resources

http://stackoverflow.com/a/23922248
accepted answer of: http://stackoverflow.com/q/23921555
score: 17
type: AcceptedAnswer
downvote count: 0
has body: Dont use a CameraInputController, but instead implement InputProcessor and use that class in the call to Gdx.input.setInputProcessor. For example: public class MyGdxGame extends ApplicationAdapter implements InputProcessor { And in the create method: Gdx.input.setInputProcessor(this); You'll have to implement all methods as shown in this link, except for the touchDown and touchDragged method which require additional code: private int dragX, dragY; @Override public boolean touchDown (int x, int y, int pointer, int button) { dragX = x; dragY = y; return true; } @Override public boolean touchDragged (int x, int y, int pointer) { float dX = (float)(x-dragX)/(float)Gdx.graphics.getWidth(); float dY = (float)(dragY-y)/(float)Gdx.graphics.getHeight(); dragX = x; dragY = y; cam.position.add(dX * 10f, dY * 10f, 0f); cam.update(); return true; } Here the dX and dY values is the amount that user has dragged on the screen within the range between -1f and +1f. E.g. for dX a value of 0.5f means that the user dragged half the screen size to the right. Note that these are delta values since the last time the method was called. The method is likely to be called many times per drag operation. Therefor, the dX and dY will be small values. The call to cam.position.add(...) will actually move the camera and the call to cam.update(); will recalculate the values needed for rendering. I've used a multiplier of 10f for both the X and Y translation of the camera. This means that if the user fully drags from the left edge to the right edge of the screen, that the camera will move a total amount of 10 units to the right. You can adjust the value as needed. Note that this moves the camera on XY plane. If you need to move on e.g. the XZ plane, you need to adjust the call the cam.position.add(...) accordingly. Also, this doesn't change the direction of the camera. If you want to move the camera, while looking at the same location, you'll need to add cam.lookAt(0,0,0); just before cam.update();.
has comment: http://stackoverflow.com/comment/112358356
type: Answer
answers question: http://stackoverflow.com/q/23921555
upvote count: 17

http://stackoverflow.com/a/23925808
type: AcceptedAnswer
score: 0
type: Answer
has body: Try this. var Calendar = java.newInstanceSync("java.util.GregorianCalendar"); It will create a default GregorianCalendar using the current time in the default time zone.
accepted answer of: http://stackoverflow.com/q/23868148
answers question: http://stackoverflow.com/q/23868148

http://stackoverflow.com/q/23832593
tagged with: split
has body: I would like to split this string: C:\RCOUNT2013\2013_Extracted\Weekly ODEN Notices Report.12-28-2013.2013-12-29 07-20-51.pdf.log.0 on the \. What would the regex be? string.split("\\ \") // ?
has answer: http://stackoverflow.com/a/23832675
possible better answer: http://stackoverflow.com/a/23832687
has answer: http://stackoverflow.com/a/23832687
has answer: http://stackoverflow.com/a/23832681
answer count: 3
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36670190
has title: How to use String#split with a backslash character?
tagged with: regex
accepted answer: http://stackoverflow.com/a/23832681
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/comment/36778819
has text: JUnit = 4.11 & Mockito = 1.9.5
type: QuestionComment
comment on: http://stackoverflow.com/q/23887615
score: 0
type: Comment

http://stackoverflow.com/comment/36799353
has text: @user3681585 The LogCat output usually displays multiple stack traces. The first one won't be helpful, but if you look down you should see a line that says `Caused by:`, and the first lines at that point usually (but not always) tell you what line of your program caused the problem, and what exception was thrown. Sometimes you have to look further for another `Caused by:`.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23899900
type: QuestionComment

http://stackoverflow.com/q/23822624
has title: How to remove unnecessary space from a string using regular expression and trim in java
duplicate of: http://stackoverflow.com/q/2932392
type: Question
has answer: http://stackoverflow.com/a/23822775
has body: My requirement is remove all unnecessary spaces from a string with using regular expression. I have a string like this: "name=john age=26 year=1999"; I want to remove Unnecessary space between two eliminator, expecting output "name=john age=26 year=1999;"
has comment: http://stackoverflow.com/comment/36651532
has comment: http://stackoverflow.com/comment/36651363
has answer: http://stackoverflow.com/a/23822711
has comment: http://stackoverflow.com/comment/36651352
has comment: http://stackoverflow.com/comment/36651495
score: 0
has answer: http://stackoverflow.com/a/23822702
tagged with: string
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36651336
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/23822661
linked to: http://stackoverflow.com/q/2932392
tagged with: java

http://stackoverflow.com/a/23846079
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23846028
has body: Java WatchService API might be helpful for your problem.
has comment: http://stackoverflow.com/comment/36696226
downvote count: 0

http://stackoverflow.com/comment/36759674
type: QuestionComment
has text: Post a stack trace from logcat.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23879418

http://stackoverflow.com/q/23831903
type: Question
has comment: http://stackoverflow.com/comment/36669415
score: 5
tagged with: enums
has comment: http://stackoverflow.com/comment/36668780
upvote count: 5
has answer: http://stackoverflow.com/a/23832212
has comment: http://stackoverflow.com/comment/36668841
has answer: http://stackoverflow.com/a/23832110
possible better answer: http://stackoverflow.com/a/23832081
downvote count: 0
has comment: http://stackoverflow.com/comment/36668880
has comment: http://stackoverflow.com/comment/36668918
favorite count: 0
has answer: http://stackoverflow.com/a/23832555
accepted answer: http://stackoverflow.com/a/23832555
has answer: http://stackoverflow.com/a/23832116
answer count: 5
has title: Unique enum member values
has body: My problem: I want to specify a 1 to 1 connection between two enums. basically: enum MyEnum{ ENUM_VALUE_1, ENUM_VALUE_2, ENUM_VALUE_3, } enum MyOtherEnum{ OTHER_ENUM_VALUE_1(MyEnum.ENUM_VALUE_3), OTHER_ENUM_VALUE_2(MyEnum.ENUM_VALUE_1), OTHER_ENUM_VALUE_3, OTHER_ENUM_VALUE_4(MyEnum.ENUM_VALUE_2), private MyEnum pair; MyOtherEnum(MyEnum pair){ this.pair=pair; } } Given this code, what is the best way to make sure, that two instances of MyOtherEnum doesn't have the same MyEnum pair? I figured some solutions, but neither seem to be good. One solution is throw an exception in the constructor, but I'm not sure if that is even doable. Another solution is a special getter method, but it can be easily bypassed with simple MyOtherEnum.values() calls.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23832081
has comment: http://stackoverflow.com/comment/36668813

http://stackoverflow.com/comment/36591944
type: Comment
has text: It was that! Thank you a lot! You just saved my day, sir :D
comment on: http://stackoverflow.com/a/23791358
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36869673
score: 0
has text: soorry for not fomatted code =, but there is a problem with the website
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23937349

http://stackoverflow.com/comment/36828305
score: 0
has text: if I close terminal first then logout then it prints null
type: AnswerComment
comment on: http://stackoverflow.com/a/23902332
type: Comment

http://stackoverflow.com/a/23872689
type: Answer
accepted answer of: http://stackoverflow.com/q/23872483
answers question: http://stackoverflow.com/q/23872483
has body: If you decided for your implementation to use JButton, you should be aware that usually you don't use "click events" with them (although you, in theory, can use some sort of MouseListener combo to achieve this) - all AbstractButton subclasses have an ActionListener queue handling the default platform event of activating the button. You should thus focus on Actions instead of 'clicks' http://docs.oracle.com/javase/tutorial/uiswing/components/button.html#abstractbutton http://docs.oracle.com/javase/7/docs/api/javax/swing/Action.html#buttonActions If you're sure you want to monitor for long press events on JButton objects anyway, add a timer to the ActionListener, e.g. by means of System.currentTimeMillis(), to check the time difference between actions and/or use MouseListener (all java.awt.Component subclasses has addMouseListener() defined) with mousePressed/mouseReleased event time measurement to get the time delta so that you can detect the length of the 'press'.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36768758

http://stackoverflow.com/a/23783319
score: 4
accepted answer of: http://stackoverflow.com/q/23783165
has comment: http://stackoverflow.com/comment/36577794
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: First check if you are using a text viewer that displays your output correctly. If not, the problem might be your system encoding. FileUtils.write(file, string) uses the default system encoding, which in your system seems to be 8bit. The "ö" character however is encoded as two bytes, resulting in "Ã¶.". Use FileUtils.write(File file, CharSequence data, String encoding) instead, with an appropriate encoding: ISO 8859-1 (8bit standard, Latin-1) CP1252 (8bit proprietary, Windows default, extends Latin 1) MacRoman (8bit proprietary, Apple default) UTF-8 (16bit standard, Linux default) Latin-15 (not always supported) My suggestion is to use FileUtils.write(file, string, "UTF-8").
type: Answer
answers question: http://stackoverflow.com/q/23783165

http://stackoverflow.com/comment/36775860
has text: Please state your optimization goal *precisely*. What is the function you want to optimize and what are the restrictions?
comment on: http://stackoverflow.com/q/23887860
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36705281
comment on: http://stackoverflow.com/q/23850725
score: 0
has text: what do you exactly mean by a subset? From the example, I see that you probably mean a substring, is that correct?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36710759
comment on: http://stackoverflow.com/q/23853601
score: 0
type: Comment
type: QuestionComment
has text: Please try to read and search online before asking a very basic question

download
tags question: http://stackoverflow.com/q/23864865
tags question: http://stackoverflow.com/q/23816338
type: Tag
tag name: download
tags question: http://stackoverflow.com/q/23878992
tags question: http://stackoverflow.com/q/23901428
tags question: http://stackoverflow.com/q/23811448
tags question: http://stackoverflow.com/q/23899266

http://stackoverflow.com/comment/36595600
has text: @camickr, You're right. The graphics color part is being handled by another method, where I pass this graphics object to set the color appropriately.
comment on: http://stackoverflow.com/q/23792823
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40325143
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has body: As discussed in the comments above. I came to the conclusion to use SharedSecrets.getJavaLangAccess() as explained above in short term, but remove the dependency on sun.* package entirely as a long term solution. Basically I am changing my requirement itself so that it does not require getCallerClass functionality.
downvote count: 0
answers question: http://stackoverflow.com/q/23808803
accepted answer of: http://stackoverflow.com/q/23808803

http://stackoverflow.com/q/23869613
type: Question
tagged with: replace
upvote count: 4
possible better answer: http://stackoverflow.com/a/23869669
downvote count: 0
tagged with: string
has title: How to replace one or more \ in string with just \?
tagged with: replaceall
accepted answer: http://stackoverflow.com/a/23870306
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/52920183
has answer: http://stackoverflow.com/a/23869748
answer count: 5
type: AnsweredQuestion
score: 4
has body: Consider the string, this\is\\a\new\\string The output should be: this\is\a\new\string So basically one or more \ character should be replaced with just one \. I tried the following: str = str.replace("[\\]+","\") but it was no use. The reason I used two \ in [\\]+ was because internally \ is stored as \\. I know this might be a basic regex question, but I am able to replace one or more normal alphabets but not \ character. Any help is really appreciated.
tagged with: java
has answer: http://stackoverflow.com/a/23869669
has answer: http://stackoverflow.com/a/23869673
has answer: http://stackoverflow.com/a/23870306

http://stackoverflow.com/a/23887950
has comment: http://stackoverflow.com/comment/36775775
type: AcceptedAnswer
has body: Overriding the ListCellRenderer is a good approach, but you tried something overly complicated. Just display a certain string if you are rendering the cell -1 and there is no selection (value is null). You are not limited to display elements on the list. The following is an example program that demonstrates it: Full Code: import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; import javax.swing.SwingUtilities; public class ComboBoxTitleTest { public static final void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new ComboBoxTitleTest().createAndShowGUI(); } }); } public void createAndShowGUI() { JFrame frame = new JFrame(); JPanel mainPanel = new JPanel(); JPanel buttonsPanel = new JPanel(); frame.add(mainPanel); frame.add(buttonsPanel, BorderLayout.SOUTH); String[] options = { "Spain", "Germany", "Ireland", "The kingdom of far far away" }; final JComboBox comboBox = new JComboBox(options); comboBox.setRenderer(new MyComboBoxRenderer("COUNTRY")); comboBox.setSelectedIndex(-1); //By default it selects first item, we don't want any selection mainPanel.add(comboBox); JButton clearSelectionButton = new JButton("Clear selection"); clearSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { comboBox.setSelectedIndex(-1); } }); buttonsPanel.add(clearSelectionButton); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } class MyComboBoxRenderer extends JLabel implements ListCellRenderer { private String _title; public MyComboBoxRenderer(String title) { _title = title; } @Override public Component getListCellRendererComponent(JLis…
type: Answer
accepted answer of: http://stackoverflow.com/q/23882640
score: 11
answers question: http://stackoverflow.com/q/23882640
downvote count: 0
has comment: http://stackoverflow.com/comment/36783317
has comment: http://stackoverflow.com/comment/36775707
has comment: http://stackoverflow.com/comment/36807903
upvote count: 11

http://stackoverflow.com/a/23935279
has comment: http://stackoverflow.com/comment/64608620
accepted answer of: http://stackoverflow.com/q/23932483
answers question: http://stackoverflow.com/q/23932483
type: AcceptedAnswer
downvote count: 0
has body: Playing around in eclipse, it looks like it should be something like this: client.admin().indices().close(new CloseIndexRequest("test")); client.admin().indices().open(new OpenIndexRequest("test"));
type: Answer
has comment: http://stackoverflow.com/comment/36889703
score: 8
upvote count: 8

http://stackoverflow.com/comment/36844391
type: Comment
comment on: http://stackoverflow.com/a/23921671
score: 1
type: AnswerComment
has text: serlet-mapping content is not exactly a traditional regexp. Take a look at this link to understand what's allowed: http://stackoverflow.com/questions/8570805/can-we-user-regular-expression-type-patterns-in-web-xml

http://stackoverflow.com/a/23866725
score: 0
has body: I am not a Spring user, but a quick search shows me that this problem should have been fixed since 2.5.3. Maybe you want to comment on or reopen the ticket or maybe create a new one pointing to the old one: https://jira.spring.io/browse/SPR-4601
type: Answer
answers question: http://stackoverflow.com/q/23860365

http://stackoverflow.com/comment/36854226
comment on: http://stackoverflow.com/q/23929229
has text: id on the tag @Aleksandr M ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36629181
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23811160
has text: Use a `regex` or other method to check if it's a 5-digit number, then use the link above to see if it's a palindrome.

http://stackoverflow.com/comment/117390235
type: Comment
comment on: http://stackoverflow.com/a/23863162
has text: Varargs won't work for more than one array at the end of the arg list; in that case, array constructor `new T[]` is helpful. Therefore, can we say that the syntax *is* allowed as a literal argument to the enum element?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36828336
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23910816
has text: Thanks...but i have programmed 90% of my project in astyanax, so will have to stick to it.
type: Comment

http://stackoverflow.com/comment/36745383
comment on: http://stackoverflow.com/q/23872008
score: 0
type: Comment
type: QuestionComment
has text: You are trying to reference a button in another layout

http://stackoverflow.com/comment/36767595
has text: Where is the compiler error?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23883708

http://stackoverflow.com/a/35220381
type: Answer
has body: You must wait for gwt 2.8. Lambdas are not supported before gwt 2.8 version. You can try 2.8.0-beta1.
downvote count: 1
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/23920140

http://stackoverflow.com/a/23895847
accepted answer of: http://stackoverflow.com/q/23895693
type: Answer
answers question: http://stackoverflow.com/q/23895693
score: 1
upvote count: 1
has body: This is because findViewById() searches in the activity_main layout, while the button is located in the fragment's layout fragment_main. Move that piece of code in the onCreateView() method of the fragment: eg: //... View rootView = inflater.inflate(R.layout.fragment_main, container, false); Button add = (Button)rootView.findViewById(R.id.R.id.bAdd); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("Your total is " + counter); } }); Notice that now you access it through rootView view: eg: Button buttonClick = (Button)rootView.findViewById(R.id.button); otherwise you would get again NullPointerException.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36791593
has comment: http://stackoverflow.com/comment/36911094

http://stackoverflow.com/q/23791723
type: Question
has body: I am pretty new to dojo framework, now I have to build a grid using dojo and as I have searched over the net, I didn't find any information on build the grid where I can create the columns depending on the response I get from the server. So please need information on how to build grid with the column names taken from the json response. for example, if the rest response is: {"id":1,"name":"fuser","lastname":"luser"},{"id":2,"name":"fuser2","lastname":"luser2"} So the grid columns should be id, name, lastname created on the fly without hardcoding the columns names in the javascript. Thanks.
answer count: 2
has answer: http://stackoverflow.com/a/23795184
has answer: http://stackoverflow.com/a/23792180
tagged with: web-deployment
type: UnansweredQuestion
has title: How to create the grid columns on the fly in dojo?
tagged with: dojo
score: 0
tagged with: java

http://stackoverflow.com/q/23871516
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23878227
accepted answer: http://stackoverflow.com/a/23878227
type: Question
tagged with: xorg
upvote count: 1
answer count: 1
tagged with: x11
favorite count: 0
has body: We're developing some complexed application which consists of linux binary integrated with java jni calls (from JVM created in linux binary) from our custom made .jar file. All gui work is implemented and done by java part. Each time some gui property has to be changed or gui has to be repainted, it is done by jni call to JVM. Complete display/gui is repainted (or refreshed) as fast as JVM/java can handle it. It is done iteratively and frequently, few hunderds or thousands iterations per second. After some exact time, application is terminated with exit(1) which I caught with gdb to be called from _XIOError(). This termination can be repeated after more or less exact time period, e.g. after some 15h on x86 dual core 2.5GHz. If I use some slower computer, it lasts longer, like it is proportional to cpu/gpu speed. Some conclusion would be that some part of xorg ran out of some resource or something like that. Here is my backtrace: #0 0xb7fe1424 in __kernel_vsyscall () #1 0xb7c50941 in raise () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #2 0xb7c53d72 in abort () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #3 0xb7fdc69d in exit () from /temp/bin/liboverrides.so #4 0xa0005c80 in _XIOError () from /usr/lib/i386-linux-gnu/libX11.so.6 #5 0xa0003afe in _XReply () from /usr/lib/i386-linux-gnu/libX11.so.6 #6 0x9fffee7b in XSync () from /usr/lib/i386-linux-gnu/libX11.so.6 #7 0xa01232b8 in X11SD_GetSharedImage () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt_xawt.so #8 0xa012529e in X11SD_GetRasInfo () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt_xawt.so #9 0xa01aac3d in Java_sun_java2d_loops_ScaledBlit_Scale () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt.so I made my own exit() call in liboverrides.so and used it with LD_PRELOAD to capture exit() call in gdb with help of abort()/SIGABRT. After some debugging of libX11 and libxcb, I noticed that _XReply() got NULL reply (response from xcb_wait_for_reply()) that causes call to _XIOError() and exit(1). Going more deeply in l…
tagged with: linux
has title: _XReply() terminates app with _XIOError()
tagged with: xcb
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/23788496
downvote count: 1
has body: I just wrote this function to add values into Multidimensional arraylist, but dont get it why all added values overwrites into recent added value. I need to figure out why this happening. As javadoc says it has to act like this " Appends the specified element to the end of this list". And i dont see any place at his code, where previously added value could be overwriten . One more strange thing is that size of array increases Here is my output: [0.4, 0.42, 0.4, 1.2200000000000002, 0.0010000000000000009] after add 0 [0.4, 0.42, 0.4, 1.2200000000000002, 0.0010000000000000009] after add 1 [0.4, 0.42, 0.4, 1.2200000000000002, 0.0010000000000000009] after add 2 [0.4, 0.42, 0.4, 1.2200000000000002, 0.0010000000000000009] after add 3 [0.4, 0.42, 0.4, 1.2200000000000002, 0.0010000000000000009] after add 4 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 0 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 1 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 2 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 3 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 4 [0.4, 0.42, 0.42, 1.24, 0.01200000000000001] after add 5 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 0 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 1 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 2 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 3 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 4 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 5 [0.4, 0.44, 0.4, 1.2400000000000002, 0.011999999999999983] after add 6 And here is my function: public void createArrayList(ArrayList&lt;Double&gt; list,ArrayList&lt;Double&gt; listLaid,int size,double sum, double absValue){ ArrayList&lt;Double&gt; workArray = new ArrayList&lt;&gt;(); ArrayList&lt;ArrayList&lt;Double&gt;&gt; workMatrix= new ArrayList&lt;&gt;(); double abs=0; for(int a = 0; a &lt; size ;a++){ for(int b =…
tagged with: java
type: Question
tagged with: arrays
has title: java multidimensional arraylist
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/23788593
upvote count: 1
answer count: 1
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion

http://stackoverflow.com/q/23818577
has comment: http://stackoverflow.com/comment/36651974
has body: I'm trying to make communicate my (functionnal) Reslet server + Objectify framework, with a simple thin client. I get a 500 Internal error, because it seems i'm sending a Null object (parse/serialization mistake?), but I don't know how to fix it, and I don't know that much about serialization. It would be awesome if you could help me ! :) Here is my client : its interface: public interface AdminControllerInterface { @Put void create(Epreuve ep); @Get Epreuve getAllEpreuve(); } its Controller : public class AdminController { public final ClientResource cr = new ClientResource( EngineConfiguration.gae_path + "/rest/admin"); public AdminController() { EngineConfiguration.getInstance(); } public void create(Epreuve epreuve) throws Exception { final AdminControllerInterface uci = cr.wrap(AdminControllerInterface.class); try { uci.create(epreuve); System.out.println( "Creation success !"); } catch (Exception e) { System.out.println( "Creation failed !"); throw e; } } public Epreuve getAllEpreuve(final long ordre) { //lets focus on the create method first } } Server side : the interface's the same and the controller : public class AdminController extends ServerResource implements AdminControllerInterface{ @Override public void create(Epreuve ep) { // TODO Auto-generated method stub Epreuve epreuve = new Epreuve(); epreuve.setQuestion(ep.getQuestion()); epreuve.setFirstAnswer(ep.getFirstAnswer()); epreuve.setSecondAnswer(ep.getSecondAnswer()); epreuve.setTrueAnswer(ep.getTrueAnswer()); epreuve.setTimeToAnswer(ep.getTimeToAnswer()); epreuve.setLatitude(ep.getLatitude()); epreuve.setLongitude(ep.getLongitude()); epreuve.setVille(ep.getVille()); epreuve.setOrdre(ep.getOrdre()); ofy().save().entity(epreuve).now(); } @Override public Epreuve getAllEpreuv() { // TODO Auto-generated method stub return null; } } Server returns 500 - internal error while trying to do ep.getQuestion() => it's produce nullPointerException. Any idea about what I did wrong ? :)
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Error thin client and Restlet Server + objectify
tagged with: restlet
downvote count: 0
has comment: http://stackoverflow.com/comment/46626050
favorite count: 0
has comment: http://stackoverflow.com/comment/36644513
tagged with: serialization
tagged with: rest
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/comment/36873080
type: AnswerComment
has text: it's not a homework , but a small project to do this is just a part of my project (and I don't have enough time because of that I asked for help). Thank you for the answer !
type: Comment
comment on: http://stackoverflow.com/a/23939400
score: 0

http://stackoverflow.com/comment/36822824
has text: As @M4ver1k said, give it a try as there is a lot of benefit when using a so heavily tested and wide used framework (although I understand you). Anyway, you can always write your own filters and authentication mechanisms storing needed data at user session (remember: any classes at session must be serializable). Digging around a little in the internet you can find some solutions so you do not have to start from scratch (for example http://sourceforge.net/projects/securityfilter/, change DefaultPersistentLoginManager to store data at session and not with cookies). Thanks to the Java community!!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23878585
type: Comment

http://stackoverflow.com/comment/36764081
comment on: http://stackoverflow.com/q/23881630
has text: base64 encode increases the size ... also I want some generic solution..
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36856147
type: Comment
has text: Why? Why do you think you need hex as opposed to binary? And what on earth are you gong to do with it?
type: AnswerComment
comment on: http://stackoverflow.com/a/23924076
score: 0

http://stackoverflow.com/q/23846754
has answer: http://stackoverflow.com/a/23847099
accepted answer: http://stackoverflow.com/a/23846869
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23846869
type: Question
has answer: http://stackoverflow.com/a/23846856
has comment: http://stackoverflow.com/comment/36697511
tagged with: arrays
downvote count: 0
has title: Special diagonal matrix in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/36697218
answer count: 3
tagged with: matrix
has comment: http://stackoverflow.com/comment/36697135
has body: Does anyone know how to construct following matrix in Java? I can see a transpose pattern but I might be on the wrong track with that. This is what I've got so far... don't laugh :-) import java.io.*; public class Diagonal { public static void main(String[] args)throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(isr); int dim; do { System.out.print("Dimension: "); dim = Integer.parseInt(in.readLine()); }while(dim&lt;=0); int[][] matrix = new int[dim][dim]; for(int i=0;i&lt;matrix.length;i++) { for(int j=0;j&lt;matrix[i].length;j++) { matrix[i][j] = j+1; } } //Transpose int transpose[][] = matrix; for(int i=0;i&lt;dim;i++) { for(int j=0;j&lt;dim;j++) { transpose[j][i] = matrix[i][j]; } } //print transpose for(int i=0;i&lt;transpose.length;i++) { for(int j=0;j&lt;transpose[i].length;j++) { System.out.print(transpose[i][j]); } System.out.println(""); } } } I'm not sure but I think it is called a toeplitz matrix... Grts.
possible better answer: http://stackoverflow.com/a/23846856
upvote count: 2

http://stackoverflow.com/comment/36827017
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23914441
type: Comment
has text: i dont want to use servlet page iwant to redirect to another jsp or html page only so that that page sholud get the values

http://stackoverflow.com/q/23864976
has answer: http://stackoverflow.com/a/24371455
favorite count: 0
tagged with: security
tagged with: jnlp
linked to: http://stackoverflow.com/q/23529521
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19481826
has title: JDK 7u45 application blocked due to securtiy exception of self signed or outdated version
has comment: http://stackoverflow.com/comment/36788586
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36734125
has comment: http://stackoverflow.com/comment/36734692
has comment: http://stackoverflow.com/comment/36733146
tagged with: java-web-start
has body: I have created a java application and deploying it using java web start.Application is working fine till JDK 7u21. But after that I updated my jdk version to 7u45.Application is blocked due after throwing security exception of self signed. After that I explore issue on different website they suggested to lower down the security level in Java Control Panel.But I don't like this solution as I don't want a work around but a complete solution. After more exploration I found following method of adding following attribute to MANIFEST.MF Application-Name: My App Name Permissions: all-permissions Codebase: * Application-Library-Allowable-Codebase: * Caller-Allowable-Codebase: * Trusted-Library: true I have added all this using following command jar uvmf abc.jar patch.txt where patch.txt contains above attribute that I have to add to manifest.MF As my application contains some of eclipse plugins so I deleted ECLIPSEF.SF and ECLIPSEF.RSA files and again signed all plugins using my certificate. But still I didn't get rid of error.I am getting following errors : basic: Your security settings have blocked a self-signed application from running with an out-of-date or expired version of Java. security: Trust for: http://192.15.23.6:8888/myapps/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503.jar has ended: Thu Jan 01 05:30:00 IST 1970 Please suggest how to explore it at next step to remove errors.
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36809207
type: Comment
type: QuestionComment
has text: As I menton in my question server time is ok is diplay the correct Wed May 28 12:14:14 IST 2014 but the timing in outlook is odd Wed 5/28/2014 7:29 PM
comment on: http://stackoverflow.com/q/23905132
score: 0

http://stackoverflow.com/q/23815897
accepted answer: http://stackoverflow.com/a/23840232
favorite count: 0
has comment: http://stackoverflow.com/comment/36790469
has comment: http://stackoverflow.com/comment/36685070
has comment: http://stackoverflow.com/comment/36683135
possible better answer: http://stackoverflow.com/a/23823023
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/36639482
has comment: http://stackoverflow.com/comment/36643316
has answer: http://stackoverflow.com/a/23823023
has body: I have 2 database tables: Persists a class, that has a field who's type is an enum. In the respective column, the enum value's ordinal is stored. Persists the enum values' ordinal and name. How do I use a Hibernate Mapping to map the enum's ordinal in table 1 to the name stored in table 2? Edit: Basically, with a SQL SELECT, I would join the 2 tables using the ordinal, to get the name. I'm not sure how I would do that in hibernate though. This isn't a duplicate; I'm not using Hibernate reverse engineering.
upvote count: 1
has answer: http://stackoverflow.com/a/23840232
type: AnsweredQuestion
tagged with: enums
linked to: http://stackoverflow.com/q/7679044
has title: How to I map an enum ordinal to it's value in hibernate?
score: 1
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/36639372
answer count: 2
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/36881525
score: 0
type: AnswerComment
has text: I'd go with @assylias solution, as missing Locale means that for me this code would most likely fail (as I'll be running with different OS locale). Please check http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ofPattern-java.lang.String- Although it may not be an issue for you
type: Comment
comment on: http://stackoverflow.com/a/23873809

http://stackoverflow.com/q/23923662
tagged with: java
has comment: http://stackoverflow.com/comment/36845393
has comment: http://stackoverflow.com/comment/36844250
score: -1
has comment: http://stackoverflow.com/comment/36844215
has answer: http://stackoverflow.com/a/23923708
has answer: http://stackoverflow.com/a/23923706
type: Question
tagged with: crash
has comment: http://stackoverflow.com/comment/36844190
downvote count: 1
has comment: http://stackoverflow.com/comment/36844804
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36844759
tagged with: android
has comment: http://stackoverflow.com/comment/36844228
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36844294
has body: So i don't know what the rules are here about double posts, anywho i didn't get follow up support on my other question.. anywho my problem is stated, heres my logcat 05-28 19:45:03.464: I/ActivityManager(274): Start proc xela.kasea.flyffresell for activity xela.kasea.flyffresell/.Main: pid=793 uid=10046 gids={50046, 1028} 05-28 19:45:03.474: D/dalvikvm(793): Not late-enabling CheckJNI (already on) 05-28 19:45:04.154: I/ARMAssembler(36): generated scanline__00000077:03010104_00008001_00000000 [ 89 ipp] (110 ins) at [0x41548840:0x415489f8] in 564149 ns 05-28 19:45:04.294: D/dalvikvm(793): GC_FOR_ALLOC freed 81K, 6% free 2642K/2784K, paused 26ms, total 27ms 05-28 19:45:04.294: I/dalvikvm-heap(793): Grow heap (frag case) to 3.318MB for 714016-byte allocation 05-28 19:45:04.334: D/dalvikvm(793): GC_FOR_ALLOC freed 2K, 5% free 3337K/3484K, paused 34ms, total 34ms 05-28 19:45:04.414: I/Tag2(793): This is my error msg 05-28 19:45:04.414: D/AndroidRuntime(793): Shutting down VM 05-28 19:45:04.414: W/dalvikvm(793): threadid=1: thread exiting with uncaught exception (group=0x41465700) 05-28 19:45:04.425: E/AndroidRuntime(793): FATAL EXCEPTION: main 05-28 19:45:04.425: E/AndroidRuntime(793): java.lang.RuntimeException: Unable to start activity ComponentInfo{xela.kasea.flyffresell/xela.kasea.flyffresell.Main}: java.lang.NullPointerException 05-28 19:45:04.425: E/AndroidRuntime(793): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 05-28 19:45:04.425: E/AndroidRuntime(793): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 05-28 19:45:04.425: E/AndroidRuntime(793): at android.app.ActivityThread.access$600(ActivityThread.java:141) 05-28 19:45:04.425: E/AndroidRuntime(793): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 05-28 19:45:04.425: E/AndroidRuntime(793): at android.os.Handler.dispatchMessage(Handler.java:99) 05-28 19:45:04.425: E/AndroidRuntime(793): at android.os.Looper.loop(Looper.java:137) 0…
tagged with: android-emulator
has comment: http://stackoverflow.com/comment/36844369
has title: unfortunately <applicationName> has stopped
has answer: http://stackoverflow.com/a/23923769

http://stackoverflow.com/comment/36639706
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23812794
has text: I tried like you said but it doesn't work again, I put this line of code: JScrollPane scrollPane = new JScrollPane( jProductList ); jTabbedPane1.addTab(menuLista.get(i).getMenuName(), scrollPane); at the end of the first for loop. Maybe somewhere else? Thanks.

http://stackoverflow.com/comment/36578541
has text: you need to use xml parses for extract part
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23784205
score: 0

http://stackoverflow.com/comment/36736392
type: Comment
has text: Could you please also suggest a solution if I do not need to print this value but rather need to store it in DB or return it from an method
comment on: http://stackoverflow.com/a/23866198
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36855390
score: 0
comment on: http://stackoverflow.com/a/23924234
type: Comment
has text: Alright, thank you. The thing though is that if the file contained this: 1st line: "Hi my name" 2nd line: "consists of three" 3rd line: "Letters" The code above would print "Hi my name". Now, this isn't the case for the serialized file, it would print everything since it is in binary. So is there any way I can convert the file into hexadecimal instead of binary, so the file would always look like the above? I do not want to deserialize it, only be able to read each line. For example: "Ah, this line contains aced".
type: AnswerComment

nullpointerexception
tags question: http://stackoverflow.com/q/23901889
tags question: http://stackoverflow.com/q/23826992
tags question: http://stackoverflow.com/q/23821442
tags question: http://stackoverflow.com/q/23937895
tags question: http://stackoverflow.com/q/23909433
tags question: http://stackoverflow.com/q/23787811
tags question: http://stackoverflow.com/q/23795909
tags question: http://stackoverflow.com/q/23934363
tags question: http://stackoverflow.com/q/23905776
tags question: http://stackoverflow.com/q/23932200
type: Tag
tags question: http://stackoverflow.com/q/23825549
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/23794307
tags question: http://stackoverflow.com/q/23830434
tags question: http://stackoverflow.com/q/23813753
tags question: http://stackoverflow.com/q/23899281
tags question: http://stackoverflow.com/q/23832959
tags question: http://stackoverflow.com/q/23877147
tags question: http://stackoverflow.com/q/23937238
tags question: http://stackoverflow.com/q/23907498
tags question: http://stackoverflow.com/q/23852471
tags question: http://stackoverflow.com/q/23916400
tags question: http://stackoverflow.com/q/23831198
tags question: http://stackoverflow.com/q/23862947
tags question: http://stackoverflow.com/q/23869019
tags question: http://stackoverflow.com/q/23921864
tags question: http://stackoverflow.com/q/23821642
tags question: http://stackoverflow.com/q/23835889
tags question: http://stackoverflow.com/q/23880114
tags question: http://stackoverflow.com/q/23779148
tags question: http://stackoverflow.com/q/23814045
tags question: http://stackoverflow.com/q/23813034
tags question: http://stackoverflow.com/q/23921731

http://stackoverflow.com/comment/36600961
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23795747
has text: On fetching records from a select clause we can get individual records and columns as in the database
score: 0

http://stackoverflow.com/q/23872557
tagged with: java
linked to: http://stackoverflow.com/q/15322940
has answer: http://stackoverflow.com/a/23873068
type: Question
has body: Hi I am very new to Android Programming. I was trying to make a login/ Registration app in Android. I created php script to connect and modify my database. Following is the code I wrote for the app by looking at a tutorial, but when I try to run it I get some errors. Can someone please tell me where I am going wrong. public class RegisterActivity extends ActionBarActivity { // Progress Dialog private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText username; EditText password; EditText emailid; EditText phonenumber; // url to create new product private static String url_register_user = "http://www.doc.ic.ac.uk/project/2013/271/g1327139/webapp/php%20script/index.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register_user); // Edit Text username = (EditText) findViewById(R.id.reg_username); password = (EditText) findViewById(R.id.reg_password); emailid = (EditText) findViewById(R.id.reg_emailid); phonenumber = (EditText) findViewById(R.id.reg_mobilenumber); // Create button Button register = (Button) findViewById(R.id.register); // button click event register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // creating new product in background thread new RegisterNewUser().execute(); } }); } /** * Background Async Task to Create new product * */ private class RegisterNewUser extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(RegisterActivity.this); pDialog.setMessage("Registering User.."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } /** * Registering user * */ protected String doInBackground(String... args) { String userName = username.getText().toSt…
has answer: http://stackoverflow.com/a/23874141
answer count: 2
has comment: http://stackoverflow.com/comment/36746169
has title: How can I integrate php with Android app?
downvote count: 3
tagged with: android
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/36746175
upvote count: 0
has comment: http://stackoverflow.com/comment/36746515
type: UnansweredQuestion
tagged with: multithreading
score: -3

http://stackoverflow.com/comment/36585275
has text: i have an asyncTask on the navigation.class making a connection with an api that populates an ArrayList<HashMap<String, String>> and i cant send it to the fragment to set his components on the EditTexts, so it have to be on Navigation.class
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23787811
type: QuestionComment

http://stackoverflow.com/comment/36711387
type: QuestionComment
has text: Show the code of Person Constructor arguments
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23853919

http://stackoverflow.com/comment/36638111
has text: Really need help. I'm here to learn and I can't understand without someone explaining me.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813820
score: 0

http://stackoverflow.com/a/23885429
type: Answer
score: 2
has body: Increase the size of the array by 1 cruce_no = new String[JA.length()+1]; cruce_no[0] = "Select"; Inside the forloop use this cruce_no[i+1] = json.getString("YOUR_KEY");
upvote count: 2
answers question: http://stackoverflow.com/q/23885271
accepted answer of: http://stackoverflow.com/q/23885271
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23888237
type: UnansweredQuestion
tagged with: spring
score: 2
tagged with: java
tagged with: hibernate
tagged with: orm
has title: Spring ORM 4.0.5 and Hibernate 4.3.5 - Cant save to database
type: Question
has comment: http://stackoverflow.com/comment/36776323
has body: I am using Spring ORM 4.0.5 and Hibernate 4.3.5 and I am running into difficulties When I try to call a dao method from tomcat, I get the following error 20140527 12:25:00,031 IST DEBUG hibernate4.HibernateTemplate [Check App Scheduler_Worker-1] Could not retrieve pre-bound Hibernate session org.hibernate.HibernateException: No Session found for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:106) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:325) I am calling my dao methods through a service layer from my actions. When I run test to the dao from junit using the same spring xml file, it works perfectly well. Here are the contents of my spring configuration file -- datasources are configured and loaded separately. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns: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/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"> org.hibernate.dialect.MySQLDialect true config/hibernateMappings/User.hbm.xml <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true"/> <tx:method name="" read-only="false"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="servicesOperation" expression="execution(* com.app.services.user..*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="servicesOperation"/> </aop:config> Any help on this is greatly appreciated
downvote count: 0
has comment: http://stackoverflow.com/comment/36776187
has answer: http://stackoverflow.com/a/23888368
answer count: 1
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/37166970
type: QuestionComment
type: Comment
has text: I found programs like Process Hacker with which you can "Find handles and DLLs" and if you search folder with the songs you will get path of the file being used from which you can see the song currently being played...that's how far i got, still searching for the full solution...
score: 0
comment on: http://stackoverflow.com/q/23932478

http://stackoverflow.com/comment/36575646
type: Comment
has text: is it necessary to add navigability in the Entity1 and Entity2 ?
comment on: http://stackoverflow.com/a/23782417
score: 0
type: AnswerComment

http://stackoverflow.com/q/23902895
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/23902942
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23902935
has answer: http://stackoverflow.com/a/23902935
tagged with: maven
upvote count: 1
has body: I have an HTML file that has a form: Voter Registration Page Please fill out all information below to register as a voter. First name: Last name: Address: City: State: Zip: Phone Number: Affiliation: Democrat Green Party Liberterian Republican Unafiiliated Using Maven and JAVA EE I'm trying to use POST to make a results page when the user clicks Submit on the HTML form: web.xml results controller.Response results /results Current Java Code: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Response extends HttpServlet{ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{ PrintWriter out = response.getWriter(); out.println(" "); out.println(" demolet "); out.println(" "); out.println(" First Name: "); out.println(" Last Name: "); out.println(" Address: "); out.println(" Phone: "); out.println(" Afiiliation: "); out.println(" "); out.close(); } } However, the main problems I'm having are: 1.I'm trying to figure out is how to pass in the values answered in the HTMl file to the Java file so it can properly write a html file with the results. 2.I'm new to Java servlets and xml so I have a feeling my set up is incorrect somwhere. If anyone can offer any help for any of these two problems, that would be great. Thanks. Don't worry about the Maven part for now, I know how to use the command line to set up my project and see results and stuff.
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23902942
answer count: 3
has title: Maven: Deploying an HTML form page with a Response Java EE that prints results with POST
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23903127

http://stackoverflow.com/a/23796648
upvote count: 1
has body: <activity android:name="net.androidbootcamp.concerttickets2.MainActivity" <-- If this guy extends ActionBarCompat --> android:theme="@android:style/Theme.Black.NoTitleBar" android:label="@string/app_name" > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> If you don't need actionBar (NoTitleBar), just change your class to use Activity public class MainActivity extends Activity { // Instead of extends ActionBarCompat } But if you want use ActionBarCompat, so create an custom theme extending Theme.AppCompat eg.: public class MyActivityWithActionBarCompat extends ActionBarActivity { } /res/values/style.xml manifest <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23796197
answers question: http://stackoverflow.com/q/23796197
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37272192
type: Answer
score: 1

http://stackoverflow.com/q/23905949
has body: I'm trying to get sim card details for sim 1 and sim 2 in a Samsung dual phone (Samsung Gt-S6802) , I am able to get details for sim 1 but for sim 2 I get a null value. I'm using Java reflection method to get both Sim Serial numbers. I used this tutorial Android : Check whether the phone is dual SIM Kindly if you know any work around for this let me know. Thanks
has comment: http://stackoverflow.com/comment/36811199
score: 0
answer count: 1
tagged with: telephonymanager
linked to: http://stackoverflow.com/q/14517338
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/48743280
tagged with: android
tagged with: samsung-mobile
tagged with: java
has comment: http://stackoverflow.com/comment/36811322
tagged with: sim-card
type: Question
has comment: http://stackoverflow.com/comment/36810950
has title: Failed to get Sim Card details (Sim Serial Number) for sim2 in Samsung Dual Android phone
has comment: http://stackoverflow.com/comment/36811006

http://stackoverflow.com/comment/36707852
comment on: http://stackoverflow.com/q/23851745
score: 0
type: Comment
type: QuestionComment
has text: 'p1.getErrorStream()' check if there is any error in this InputStream

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/23925424
tags question: http://stackoverflow.com/q/23808541
tags question: http://stackoverflow.com/q/23902764

http://stackoverflow.com/comment/36606005
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23798824
type: QuestionComment
has text: I do not get your question

http://stackoverflow.com/comment/36712517
type: QuestionComment
has text: There is no easy way for listening on keypressed in console for java, you could use KeyBindings like mentioned by Sr. Richenso, but the you have to use Swing. It would be much easier to listen for Key+Enter on the console, if its ok for you
comment on: http://stackoverflow.com/q/23854348
score: 0
type: Comment

http://stackoverflow.com/comment/36608367
comment on: http://stackoverflow.com/a/23799783
score: 0
type: AnswerComment
has text: Moreover, your code where false (A `{`where missing)
type: Comment

http://stackoverflow.com/comment/37011618
score: 0
type: Comment
has text: I have tried generating classes using wsimport. The problem I have faced is, it generates classes for "com.arx.sapiws.spml._1" and "oasis.names.tc.spml" instead of "com.arx.sapiws.dss._1" and "oasis.names.tc.dss" which is used in code.
type: AnswerComment
comment on: http://stackoverflow.com/a/23978154

http://stackoverflow.com/q/23938146
answer count: 3
tagged with: web-applications
tagged with: maven
tagged with: bower
tagged with: java
type: UnansweredQuestion
upvote count: 4
has body: I'm quite new to bower but not web application development. Previously, I've just downloaded the required JavaScript and CSS files from third-party libraries/frameworks and placed them into my web application's src/main/webapp/scripts (or equivalent) folder. This ensures that only the files needed by the web application are deployed. With my default setup, the entire bower_components directory will be committed to source control and if I follow the examples for referencing a bower package, e.g., &lt;script src="/bower_components/jquery/jquery.js"&gt;&lt;/script&gt; I'm going to end up deploying the entire bower_components directory with my web application. This seems like huge overkill (especially were I to use jQuery UI because all the themes are downloaded into bower). Is there a best practices in using bower with a web application such that the application isn't bloated with unnecessary third-party library files? Please remember that this is also Java and Maven web application.
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26329059
has answer: http://stackoverflow.com/a/26741103
score: 4
has answer: http://stackoverflow.com/a/40036449
has title: Are there best practices in using bower in a source-controlled, mavenized, java web application

http://stackoverflow.com/q/23867119
possible better answer: http://stackoverflow.com/a/23867556
has body: I have the below code in my Dao: String query = SELECT COUNT(*) FROM CustomerData ; Query query = session.createQuery(query); List test = query.list(); it returns a list with a size of 2. It contains the following value [1,0] How come it's returning 2 rows when it's not possible, as I have used COUNT(*) in the select clause, which will always return a single value? Is Hibernate doing something here?
has answer: http://stackoverflow.com/a/23867237
tagged with: count
has answer: http://stackoverflow.com/a/23867556
has answer: http://stackoverflow.com/a/74902538
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36737041
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36736277
tagged with: hql
type: Question
has comment: http://stackoverflow.com/comment/36736160
accepted answer: http://stackoverflow.com/a/23867237
downvote count: 0
tagged with: jpql
answer count: 3
has title: Hibernate JPQL is returning multiple results for a count(*) query
favorite count: 0
has comment: http://stackoverflow.com/comment/36736215
upvote count: 2

http://stackoverflow.com/comment/36644223
type: AnswerComment
score: 0
type: Comment
has text: haha. I understand how frustrating this must be for you. I think I'll add a bounty to this later and try to select your answer. Does that work ?
comment on: http://stackoverflow.com/a/23818389

http://stackoverflow.com/comment/36748139
has text: Yes Miachael thank you for the answer, I have to use the classes inside the Eclipse IDE, do you know where I should move those jar's? src or bin folder of the project?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23873537
type: AnswerComment

http://stackoverflow.com/comment/36856411
score: 0
type: AnswerComment
has text: Databases are built to run concurrently, like JDBC drivers and connection pools. You can have multiple threads executing this method, each one running isolated of the others.
type: Comment
comment on: http://stackoverflow.com/a/23928356

http://stackoverflow.com/comment/36721464
score: 0
comment on: http://stackoverflow.com/a/23857751
type: AnswerComment
type: Comment
has text: Thank you! This is exactly i wanted to know!:)

http://stackoverflow.com/a/23869600
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Here is the syntax of substring method: public String substring(int beginIndex) or public String substring(int beginIndex, int endIndex) Update: if you want 5 characters from the 10th you can use, orignalstring.substring(10, 15).toCharArray(); like this. So use this method properly.
answers question: http://stackoverflow.com/q/23869535

http://stackoverflow.com/q/23836393
tagged with: android
has answer: http://stackoverflow.com/a/23837259
accepted answer: http://stackoverflow.com/a/23837259
favorite count: 0
has title: MediaRecorder.setVideoSize() causes RuntimeException (start failed) at MediaRecorder.start()
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: When I attempt to set the video size for my MediaRecorder, I get a RuntimeException at the start method. mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); if (isVideo) mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); if (isVideo) { mRecorder.setVideoSize(480, 360); // Works fine when this is removed mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); } mRecorder.setOutputFile(newFilePath); if (isVideo) mRecorder.setPreviewDisplay(surfaceHolder.getSurface()); mRecorder.prepare(); // Prepare recorder mRecorder.start(); // Start recording
type: Question
answer count: 2
tagged with: mediarecorder
possible better answer: http://stackoverflow.com/a/23836800
has answer: http://stackoverflow.com/a/23836800
has comment: http://stackoverflow.com/comment/36677350
has comment: http://stackoverflow.com/comment/36677442
upvote count: 1

http://stackoverflow.com/comment/36618263
comment on: http://stackoverflow.com/q/23804675
has text: Ok, I only need help .. If you can help ok...
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/36807403
comment on: http://stackoverflow.com/q/23903735
has text: no.only this much of information available in console
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36673770
score: 1
has text: `textTargetUri.setText("good");` not possible in `doInBackGround()`
comment on: http://stackoverflow.com/q/23834521
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23784658
has answer: http://stackoverflow.com/a/23929389
accepted answer: http://stackoverflow.com/a/23929389
downvote count: 0
tagged with: google-app-engine
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
tagged with: datanucleus
tagged with: jpa
answer count: 1
has title: GAE datastore + JPA + Odata in java
tagged with: odata
has body: I am creating an application on GAE in which I have to provide a rest interface of database(datastore) using odata. I am using odata4j library for odata producer implementation. I am new to odata. I have provided a access layer on GAE datastore using jpa. Now what's my problem. @Entity @Table(name = "Submission") //@IdClass(java.lang.Long.class) public class Submission implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic private Long submissionId; private String status; private Long userId; private Date createdDate; public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public Long getSubmissionId() { return submissionId; } public void setSubmissionId(Long submissionId) { this.submissionId = submissionId; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } } I have simple Entity Submission. Through EntityManager I persistent some Submission entities. When I hit the following odata url i get the all submissions http://localhost:8888/odata.svc/Submission I have some other entities and this work for all entities. I use $filter to query on entities and it works too. Now when I want to get a single entity using its id(primary key) I am getting the error that invalid key type. OData URL for getting single submission is http://localhost:8888/odata.svc/Submission(12345567889) After debuging the odata library what I found that in static method typeSafeEntityKey(EntityManager em,EntityType&lt;?&gt; jpaEntityType,OEntityKey entityKey) of JPAProducer class in odata library, there is a line from which we try to find out the type of id of submission entity Class&lt;?&gt; javaType = jpaEntityType.getIdType().getJavaType(); after getting the type we then try to find out what is its type. I am expecting that th…
favorite count: 0

http://stackoverflow.com/a/23800200
type: Answer
has body: Problem #1 You only ever use the fileName value when trying to open the file... FileReader fr = new FileReader(filename); A file is a catenation of the directory and the name, for example... FileReader fr = new FileReader(new File(Directory.getText(), filename)); Problem #2 You're doing some kind of pre-emptive read on the file which is not required... if (filename != null){ String text = txtKeyword.getText(); String line; boolean hasError = true; while ((line = br.readLine()) != null) { You should just start reading the file, otherwise you've lost the first line of text Problem #3 You're not closing the streams in the event of some kind of exception... try { FileReader fr = new FileReader(new File(Directory.getText(), filename)); BufferedReader br = new BufferedReader(fr); //... } catch (IOException e) { JOptionPane.showMessageDialog(null, "File Not Found"); } If, for some reason, an exception occurs while you are opening or reading the streams, they can never be closed...at least not until the JVM closes Instead, you should either be using try-with-resources if you're using Java 7+ or a finally block to ensure the streams are closed, for example... BufferedReader br = null; try { String filename = fileName.getText(); br = new BufferedReader(new FileReader(new File(Directory.getText(), filename))); //... } catch (IOException e) { JOptionPane.showMessageDialog(null, "File Not Found"); } finally { try { br.close(); } catch (Exception e) { } } It would also be of more help to you if you at least dumped the stack trace of the actual exception or logged it some how... } catch (IOException e) { e.printStackTrace(); JOptionPane.showMessageDialog(null, "File Not Found"); } finally { Problem #4 null layout. Pixel perfect layouts are an illusion in modern UI design, you have no control over fonts, DPI, rendering pipelines or other factors that will change the way that you components will be rendered on the screen. Swing was designed to work with layout managers to overcome t…
upvote count: 1
answers question: http://stackoverflow.com/q/23799696
downvote count: 0
score: 1

http://stackoverflow.com/comment/36828573
type: Comment
comment on: http://stackoverflow.com/a/23898474
type: AnswerComment
score: 0
has text: I have solved the problem myself. I have not mentioned access modifier in the receiver class. I have just write it public and my matter solved.

http://stackoverflow.com/a/23911233
type: Answer
has body: You need to pass a properties object when creating the InitialContext. The properties object specifies the factory class and provider info (among other settings) needed for the connection to the specific back end server. For example, for IBM WebSphere, Properties p = new Properties(); String conFact = "com.ibm.websphere.naming.WsnInitialContextFactory"l p.setProperty(Context.INITIAL_CONTEXT_FACTORY, conFact); p.setProperty(Context.PROVIDER_URL, &lt;providerInfo&gt;); ic = new InitialContext(p); For GlassFish, the will be a connection factory in the client jar that should be specified when requesting the IC. Here is a partial example from Oracle at http://docs.oracle.com/cd/E19879-01/821-0029/aeqba/index.html Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:///C:/imq_admin_objects"); Context ctx = new InitialContext(env);
has comment: http://stackoverflow.com/comment/36822761
has comment: http://stackoverflow.com/comment/36821735
answers question: http://stackoverflow.com/q/23906034
score: 0

http://stackoverflow.com/comment/36831987
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23917326
has text: Ok @CyberneticTwerkGuruOrc , but can you tell me how this works ? i mean how this will be chooses at runtime ??

http://stackoverflow.com/a/37961638
score: 0
has comment: http://stackoverflow.com/comment/63382545
answers question: http://stackoverflow.com/q/23936140
type: Answer
has body: Thanks for this help. I have used to this type in my code. private String date; @ApiModelProperty(dataType = "string", allowableValues = "FirstValue, SecondValue", value = "description", notes = "notes") private CarrierType carrierName; public enum CarrierType { FirstValue, SecondValue } It is working fine for me.
upvote count: 3
downvote count: 3

http://stackoverflow.com/comment/36707467
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the response. Any ideas for how I could find the calling class/method where the field dereference might live? The only thing I can think of is grabbing a stacktrace, but that seems primitive.
comment on: http://stackoverflow.com/a/23850028

http://stackoverflow.com/a/23835137
type: Answer
has comment: http://stackoverflow.com/comment/36675187
has comment: http://stackoverflow.com/comment/36675031
has comment: http://stackoverflow.com/comment/36675717
score: 0
has body: public void calcResult() { finishedClients++; if (finishedClients == clients.size()) { Thread t = new Thread(new Runnable() { @Override public void run() { pCalcResult(); } }); t.start(); } } private void pCalcResult() { finishedClients = 0; int minScore = clients.get(0).getScore(); int highestScore = minScore; int clientIndex = 0; // So I'm not sure what you want to do here. //If you only expect 2 clients ever then why the for loop? And if you are //expecting more then 2 clients then you code will never work..So ill //assume you expect more then 2 clients. //You can start at 1 because you already have the values of 0. Which also will //be the default winner if all the scores are equal. for (int i = 1; i &lt; clients.size(); i++) { //So if the score is lower then the current minscore.. if (clients.get(i).getScore() &lt; minScore) { minScore = clients.get(i).getScore(); } else if (clients.get(i).getScore &gt; highestScore) { highestScore = clients.get(i).getScore(); // Remember who the highestScore had so we can mark it as winner. clientIndex = i; } // They are all loosers till we find the actual winner.. clients.get(i).setResult("looser"); } clients.get(clientIndex).setResult("winner"); lock.lock(); try { groupReady.signalAll(); } finally { lock.unlock(); } }
answers question: http://stackoverflow.com/q/23834884
has comment: http://stackoverflow.com/comment/36676542

http://stackoverflow.com/q/23927778
has body: In my application, I am using two hibernate.cfg.xml files to communicate the same mysql database. The hibernate cfg files are hibernate.cfg.xml and dynamic-hibernate.cfg.xml and I am deployed my application in JBoss server. At some time I got the exception as "org.hibernate.exception.JDBCConnectionException: could not fetch initial value for increment generator" while inserting the data by using Dynamic-hibernate session. But i am not facing the problem in another Hibernate-cfg.xml session. I have also extended MYsql waittimeout. Still i'm facing the same problem Please Help me to solve this issue. My Dynamic-hibernate-cfg.xml : com.mysql.jdbc.Driver jdbc:mysql://localhost/mydatabase root root org.hibernate.dialect.MySQLDialect dynamic-map false update <mapping file="./WEB-INF/xml/DynamicMapping.hbm.xml"/> My Another Hibernate-cfg.xml com.mysql.jdbc.Driver root jdbc:mysql://localhost/mydatabase root org.hibernate.dialect.MySQLDialect update 2 <mapping resource="HibernateMapping.hbm.xml" /> My Exception is : org.hibernate.exception.JDBCConnectionException: could not fetch initial value for increment generator at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:72) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:107) at org.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:44) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(Defaul…
tagged with: java
tagged with: hibernate
tagged with: mysql
tagged with: jboss
has answer: http://stackoverflow.com/a/23931008
type: Question
has title: org.hibernate.exception.JDBCConnectionException: could not fetch initial value for increment generator
downvote count: 0
favorite count: 0
answer count: 1
score: 1
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/36626290
comment on: http://stackoverflow.com/q/23809386
has text: I mean writing the minimum program that you can, which can reproduce what you want/asking, so that people can take a look in not so many lines of code as you have posted.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36654044
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23823741
has text: It doesn't work. but when I add some statements to write data in my HBase table, it's work. Please do you know some articles I can refer to?
score: 0

http://stackoverflow.com/comment/36779941
score: 0
has text: added part of the main who prints it....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23890137

http://stackoverflow.com/a/23831350
answers question: http://stackoverflow.com/q/23831198
score: 0
has body: I don't know if this is the problem but you have a line: gui = theGUI; I can't find any place in your code where the variable theGUI is instalised.
type: Answer
has comment: http://stackoverflow.com/comment/36667815

http://stackoverflow.com/q/23855602
has answer: http://stackoverflow.com/a/23871399
favorite count: 0
tagged with: file-io
has body: I know I can read all bytes of a file using Files.readAllBytes. But what if I have already read some of it and I want to read the remaining bytes. I know I could define a byte[] and loop over all bytes using FileReader.read but I'd like to avoid looping if possible and read all the remaining bytes in one go.
tagged with: io
has comment: http://stackoverflow.com/comment/36719146
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36715046
has title: Read all remaining bytes in a file
has answer: http://stackoverflow.com/a/23855889
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/36778341
type: AnswerComment
comment on: http://stackoverflow.com/a/23888981
type: Comment
has text: Yes, but I need more loggers per class, because there can be more instances of class and every instance have its own file.
score: 0

http://stackoverflow.com/a/23804038
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23803353
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I'm not sure to understood the question itself. It seems to me you want to expose internal data of the Team object to another data structure. This is actually not possible. What you can do is not storing players inside the team but using the same teamid with a multimap and storing all players there.
score: 1
answers question: http://stackoverflow.com/q/23803353

http://stackoverflow.com/a/23911855
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36822318
answers question: http://stackoverflow.com/q/23911270
has comment: http://stackoverflow.com/comment/36823310
accepted answer of: http://stackoverflow.com/q/23911270
type: Answer
has comment: http://stackoverflow.com/comment/36822113
has comment: http://stackoverflow.com/comment/36822585
has body: The mistake is you should add your package name into the Themes.hbm.xml like &lt;class name="my.package.Themes" table="themes"&gt; than it works. Another problem is that your mapping is not equivalent to your getter &amp; setter and fields: &lt;property name="text" column="text" type="string"/&gt; &lt;property name="orderInfo" column="order_info" type="int"/&gt; text does not exists change it to theme. And the orderInfo getter/setter should looks like: public int getOrderInfo() { return orderInfo; } public void setOrderInfo(int order_info) { this.orderInfo = order_info; } Than the theme class works for me. €dit: You can use something like that, too. &lt;hibernate-mapping package="my.package"&gt; &lt;class name="Themes" table="themes"&gt; .... &lt;/hibernate-mapping&gt;
upvote count: 3

http://stackoverflow.com/q/23916710
has comment: http://stackoverflow.com/comment/39097266
has title: Exception when appending data to my HDFS on a custom remote webapp
answer count: 0
linked to: http://stackoverflow.com/q/19620642
tagged with: java
type: Question
tagged with: hadoop
tagged with: cloudera
downvote count: 0
upvote count: 4
has body: I've got a method that is suppossed to append lines on each call to an already existing CSV in my HDFS. I use CDH 5.0. My code looks like this: else if (Config.getStorageMethod().equals("hdfs")){ Configuration conf = new Configuration(); conf.set("fs.defaultFS", "hdfs://10.9.0.108:8020"); conf.set("hadoop.job.ugi", "hdfs"); conf.set("dfs.support.append", "true"); conf.set("hadoop.home.dir", "/usr/lib/hadoop"); Path pt= new Path("/user/logger/test.csv"); FileSystem fs = FileSystem.get(conf); FSDataOutputStream fsout = fs.append(pt); writer = new PrintWriter(fsout); writer.append(sl.getIp()); writer.append(','); writer.append(sl.getTerm()); writer.append(','); writer.append(sl.getFrom()); writer.append('\n'); writer.flush(); writer.close(); The client is remote running on a webserver that does not have Hadoop installed on. I am getting the following exception: 2014-05-28/12:53:11.976 WARN: util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 2014-05-28/12:53:11.977 DEBUG: security.JniBasedUnixGroupsMappingWithFallback - Falling back to shell based 2014-05-28/12:53:11.977 DEBUG: security.JniBasedUnixGroupsMappingWithFallback - Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping 2014-05-28/12:53:11.983 DEBUG: util.Shell - Failed to detect a valid hadoop home directory java.io.IOException: HADOOP_HOME or hadoop.home.dir are not set. at org.apache.hadoop.util.Shell.checkHadoopHome(Shell.java:265) at org.apache.hadoop.util.Shell.&lt;clinit&gt;(Shell.java:290) at org.apache.hadoop.util.StringUtils.&lt;clinit&gt;(StringUtils.java:76) at org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:93) at org.apache.hadoop.security.Groups.&lt;init&gt;(Groups.java:77) at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:240) at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:255) at org.apache.hadoop.security.UserGroup…
has comment: http://stackoverflow.com/comment/60280403
has comment: http://stackoverflow.com/comment/47147647
favorite count: 0
has comment: http://stackoverflow.com/comment/60238594
type: UnansweredQuestion
score: 4

http://stackoverflow.com/a/23828757
accepted answer of: http://stackoverflow.com/q/23828711
score: 3
has comment: http://stackoverflow.com/comment/36662560
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36662540
has body: In a for-loop, the condition decides whether to continue or terminate the loop. Therefore, once (i&lt;= 40 &amp;&amp; isPrime(i)) evaluates to false for the first time in your program execution, the loop is no longer run. This happens at the first composite, 4. Thus, only 2 and 3 are written to screen.
downvote count: 1
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23828711

http://stackoverflow.com/q/23840998
type: AnsweredQuestion
score: 1
tagged with: java
has title: Caching in an enterprise web application
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23841231
has comment: http://stackoverflow.com/comment/36686659
tagged with: caching
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23841231
tagged with: spring
has body: I'm relatively new to using caching in larger programs intended to be used by a large number of people. I know what caching is and why its beneficial in general and I've started to integrate EHCache into my application which uses JSP and Spring MVC. In my application the user selects an ID from a drop down list and this uses a java class to grab data from DB according to the ID picked. First the query is executed and it returns a ResultSet object. At this point I am confused at what to do and feel like I'm missing something. I know I want the object to go into cache if it's not already in there and if it's already in cache then just continue with the loop. But doing things this way requires me to iterate over the whole returned result set from the DB query, which is obviously not the way things are supposed to be done? So, would you recommend that I just try to cache the whole result set returned? If I did this I guess I could update the list in the cache if the DB table is updated with a new record? Any suggestions on how to proceed and correctly put into ecache what is returned from the DB? I know I'm throwing out a lot of questions and I certainly appreciate it if someone could offer some help! Here is a snippet of my code so you see what I mean. rs = sta.executeQuery(QUERYBRANCHES + specifier); while (rs.next()) { //for each set of fields retrieved, use those to create a branch object. //String brName = rs.getString("NAME"); String compareID = rs.getString("ID"); String fixedRegID = rs.getString("REGIONID").replace("0", "").trim(); //CHECKING IF BRANCH IS ALREADY IN THE CACHE. IF IT IS NOT CREATE //THE NEW OBJECT AND ADD IT TO CACHE. IF THE BRANCH IS IN CACHE THEN CONTINUE if(!cacheManager.isInMemory(compareID)) { Branch branch = new Branch(fixedRegID, rs.getString("ID"), rs.getString("NAME"), rs.getString("ADDR1"), rs.getString("CITY"), rs.getString("ST"), rs.getString("ZIP")); cacheManager.addBranch(rs.getString("ID"), branch); } else { continue; } } retData =…

http://stackoverflow.com/a/23875107
accepted answer of: http://stackoverflow.com/q/23868231
answers question: http://stackoverflow.com/q/23868231
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: There is no direct way to do that, and it is a probably not a good idea to do it either. Some ciphers may have very short or very long keys, neither of which are very useful. RSA does not even have a maximum key size, and the minimum key size is often insecure. There is the method getMaxAllowedKeyLength but that may simply return Integer.MAX_VALUE instead of the maximum key size in bits. It should only be used to check a known key length against restrictions. You are better off storing the key size as a property/resource somewhere if you want to make it configurable. In my opinion it is not a good idea to abstract this decision away.
score: 2
downvote count: 0

http://stackoverflow.com/q/23781826
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/54812467
tagged with: excel
score: 2
has answer: http://stackoverflow.com/a/23782345
tagged with: java
has answer: http://stackoverflow.com/a/23781949
linked to: http://stackoverflow.com/q/769621
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36573978
has body: I have convert .xls to csv file.my code is woring fine.but one issue,I was facing.like some cell value has (xxx,Md) these cell value should consider one value but take two column.how to rectify the problem here ,I have attached my code. try { FileOutputStream fos = new FileOutputStream(outputFile); HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(inputFile)); workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK); HSSFSheet sheet = workbook.getSheetAt(0); for(int rowIndex = sheet.getFirstRowNum(); rowIndex &lt;= sheet.getLastRowNum(); rowIndex++) { Cell cell=null; Row row = null; int previousCell = -1; int currentCell = 0; row = sheet.getRow(rowIndex); for(int colIndex=row.getFirstCellNum(); colIndex &lt; row.getLastCellNum(); colIndex++) { cell = row.getCell(colIndex); currentCell = cell.getColumnIndex(); /* Cell processing starts here*/ System.out.println("coll"+colIndex); switch (cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: cellDData.append(cell.getBooleanCellValue() + ","); System.out.println("boo"+ cell.getBooleanCellValue()); break; case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); String strCellValue = dateFormat.format(cell.getDateCellValue()); cellDData.append(strCellValue +","); } else { System.out.println(cell.getNumericCellValue()); Double value = cell.getNumericCellValue(); Long longValue = value.longValue(); String strCellValue1 = new String(longValue.toString()); cellDData.append(strCellValue1 +","); } break; case Cell.CELL_TYPE_STRING: String out=cell.getRichStringCellValue().getString(); cellDData.append(cell.getRichStringCellValue().getString() + ","); System.out.println("string"+cell.getStringCellValue()); break; case Cell.CELL_TYPE_BLANK: cellDData.append("" +","); System.out.print("THIS IS BLANK"); break; default: break; } } } }
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
favorite count: 0
has title: Convert .xls to csv file using apache poi
tagged with: apache-poi

http://stackoverflow.com/comment/36633722
has text: @Kayaman, you should make that an answer. I can't believe I didn't think about it in the first place. (I frequently notice that Java's security framework is by far the most overlooked feature out there!)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813398

http://stackoverflow.com/q/23844719
favorite count: 0
has comment: http://stackoverflow.com/comment/36693473
has comment: http://stackoverflow.com/comment/36693041
type: Question
has answer: http://stackoverflow.com/a/23845073
upvote count: 1
answer count: 1
has title: two projects and two pojos and same database in java
tagged with: java
tagged with: hibernate
has body: I have 2 projects 1is webapplication and another is standalone application. both are using the hibernate on the same DB. My Problem is I am unable to keep it properly still i try. I just want to access the method in the project2 from project1.So I made the jar and iam using p2.jar in project1.created the session in the p1 and calling the p2 but the pojos available there is same and still i am getting the cast exception in java. Ex:in P1 iam invoking the m1() of P2. in P1 method the logic is like this creating session; session.beginTransaction(); Query preChkQuery=session.createQuery("from X x "); orcId=((X)orList.get(0)).getId(); //invoking p2 method P2class p2class = new P2class (); p2class.execute(orcId) And in method execute session.beginTransaction(); Query preChkQuery=session.createQuery("from X x "); we=((X)orList.get(0)).getId(); return we; And the problem starts here once the call enters into the p2 method and starts executing it gives class cast exception
accepted answer: http://stackoverflow.com/a/23845073
downvote count: 0
score: 1
type: AnsweredQuestion

http://stackoverflow.com/q/23901519
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/36803204
has answer: http://stackoverflow.com/a/23901553
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/460542
downvote count: 0
possible better answer: http://stackoverflow.com/a/23901553
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23901533
tagged with: operators
has title: The operator ^ is undefined for arguments
has body: (((difference - previousStep)/1000)^2) //difference and previousStep are both doubles Why can't I use the ^ operator with doubles? I just want to know why. Luckily for me I can just multiple difference - previousStep by itself because i'm just squaring it, but if i need to bring it to the Nth power, then this would be a problem. So why can't you ^ doubles and is there a way around this?
accepted answer: http://stackoverflow.com/a/23901533
type: AnsweredQuestion

http://stackoverflow.com/comment/120773623
type: Comment
has text: @AbdennourTOUMI it's 2021 w/ Java 16 fairly well established in the wild and I still *very* much prefer Groovy over Java ¯\_(ツ)_/¯
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23907672

http://stackoverflow.com/q/23788987
has comment: http://stackoverflow.com/comment/36587750
type: Question
answer count: 2
has body: I am not new to Spring MVC, but always wonder how can I use correct URLs (context name aware) inside JavaScript. Something like c:url or spring:url, but for JS: E.g. if I have a webapp that is deployed as context in Tomcat. It has a page: http://localhost:8080/context/some/directory/search and API at http://localhost:8080/context/api. If page calls API, I face problems: // This works wrong: $http.get('/api/users', function(data){}) // will call http://localhost:8080/api/users - the context is lost! $http.get('api/users', function(data){}) // will call http://localhost:8080/context/some/directory/api/users - wrong URL! I wish some way of filtering exists: $http.get('${url:api/users}', function(data){}) // will call http://localhost:8080/context/api/users I saw something similar in C# and Ruby, and Python. Is there any ready-to-use solution for Java / Spring?
tagged with: javascript
score: 4
has answer: http://stackoverflow.com/a/23793059
tagged with: servlets
has comment: http://stackoverflow.com/comment/36587528
has answer: http://stackoverflow.com/a/23865876
favorite count: 0
tagged with: spring
upvote count: 4
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23865876
accepted answer: http://stackoverflow.com/a/23793059
has title: Correct URLs in JavaScript files in Spring MVC

http://stackoverflow.com/comment/36672798
score: 0
has text: Intriguing. I might consider it, but for now I will go with the methods. I have a feeling that implementing them for each type, and making them singleton will increase performance.
type: Comment
comment on: http://stackoverflow.com/a/23826446
type: AnswerComment

http://stackoverflow.com/q/23860804
tagged with: network-programming
has answer: http://stackoverflow.com/a/23860824
has answer: http://stackoverflow.com/a/23860940
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23860940
has body: I am building a Java networking app, and would like to be able to demonstrate the networking capabilities (over localhost) for users that do not have 2 computers to test it on. I am wondering if there is a way, possibly by calling the main method again, to create another instance of a Java app. This can not just be another instance of the JFrame, as the networking capabilities would not function correctly. Example Scenario: User clicks on "Demo Mode", then app creates a second instance, then user can do test the network connection over localhost. Is there any way to accomplish this?
has answer: http://stackoverflow.com/a/23861554
has title: Create 2 Instances of Java App?
type: AnsweredQuestion
tagged with: instance
accepted answer: http://stackoverflow.com/a/23860824
tagged with: java
type: Question

http://stackoverflow.com/comment/36671966
score: 0
has text: I use the below code to report my exception t to eclipse errorlog. But it shows that I don't have stacktrace. final Status status = new Status(severity, Activator.PLUGIN_ID, msg + className, t); logger.log(status);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23833380

http://stackoverflow.com/q/23844057
tagged with: java
has comment: http://stackoverflow.com/comment/36692181
type: Question
has body: I am using the Time class and creating it of 20 tps, but I am getting below error. Exception in thread "pool-1-thread-9" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:597) at java.util.Timer.&lt;init&gt;(Timer.java:137) at java.util.Timer.&lt;init&gt;(Timer.java:106) at mcarbon.ucip.SheduleInMemRemove.&lt;init&gt;(SheduleInMemRemove.java:22) at mcarbon.ucip.XML_RPC_UCIP_DEBIT_CREDIT.run(XML_RPC_UCIP_DEBIT_CREDIT.java:229) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Code:- class SheduleInMemRemove{ Timer timer; Config cfg; String key; public SheduleInMemRemove(String key,int seconds,Config cfg,String MSG,String IP,String PORT,boolean isResponse) { this.key=key; this.cfg=cfg; LoggerWR.logger.info("[IN URL] [inside SheduleInMemRemove constructor][going to sleep to IN memory key["+key+"] [wake up after "+seconds+" seconds] [MSG]["+MSG+"] [isResponse]["+isResponse+"]"); cfg.addInMem(key,IP,PORT,MSG,isResponse); //LoggerWR.logger.info("[IN URL] [Going to shedule]"); timer = new Timer(); timer.schedule(new WakeUpInTask(),seconds*1000); //LoggerWR.logger.info("[IN URL] [Done]"); } class WakeUpInTask extends TimerTask { public void run() { //System.out.format("Time's up!%n"); LoggerWR.logger.info("[IN URL] [Inside the SheduleInMemRemove class going to remove the key]["+key+"] ["+cfg.removeInMem(key)+"]"); //cfg.removeInMem(key); timer.cancel(); //Terminate the timer thread } } } pls help
has comment: http://stackoverflow.com/comment/36693353
has answer: http://stackoverflow.com/a/23845482
answer count: 1
has comment: http://stackoverflow.com/comment/36691971
has comment: http://stackoverflow.com/comment/36691900
has comment: http://stackoverflow.com/comment/36692583
tagged with: timer
tagged with: out-of-memory
type: UnansweredQuestion
has title: Time class generating OutOfMemory Error
score: 0

http://stackoverflow.com/q/23824428
tagged with: oracle-database
tagged with: sql
has title: Converting TIMESTAMP to Char in Oracle Ibatis
tagged with: ibatis
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has body: I am trying to run a query in Oracle ibatis to fetch content of a table. One of the column 'CREATED_ON' is of TIMESTAMP datatype. When I try to convert this to String using TO_CHAR function I get the below exception. The goal is to get a Map of column headers &amp; values from this query. If I remove the TO_CHAR from the query, I get the result in the Map without any exceptions but the CREATED_ON column values are oracle.sql.TIMESTAMP@3524fead. EXCEPTION com.ctg.dms.exceptions.DMSApplicationException: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/ctg/dms/dao/ibatis/oracle/AuditLogAccessControlSQLs.xml. --- The error occurred while applying a result map. --- Check the auditLogAccessControl.findAccessLogEntriesForFileExport-AutoResultMap. --- Check the result mapping for the 'TO_CHAR(A.CREATED_ON)' property. --- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named 'CREATED_ON)' in class 'java.lang.Object'at com.ctg.dms.dao.impl.sql.ibatis.AuditLogAccessControlDAOImpl.findAccessLogEntriesForFileExport(AuditLogAccessControlDAOImpl.java:41) 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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at co…
has answer: http://stackoverflow.com/a/23824519
accepted answer: http://stackoverflow.com/a/23824519
score: 0

http://stackoverflow.com/comment/36812942
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23896517
type: Comment
has text: @MartinR - Understood. Similarly my point is that the *meaning* is the same, member (field or ivar) access and the equivalence holds, just as Carl stated. That the *implementation* differs doesnt change that. Have a nice day.

http://stackoverflow.com/q/23867009
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36735988
score: 0
has answer: http://stackoverflow.com/a/23867033
has body: Map&lt;Integer, List&lt;String&gt;&gt; mapList = new TreeMap&lt;&gt;(); Map&lt;Integer, Set&lt;String&gt;&gt; mapSet = new TreeMap&lt;&gt;(); Set&lt;String&gt; set = new TreeSet&lt;&gt;(); for (Map.Entry&lt;Integer, List&lt;String&gt;&gt; entry : entriesSortedByValues(mapList)) { set.addAll(entry.getValue()); mapSet.put(entry.getKey(), set); } It doesnt work. I want to copy mapList to mapSet.
has answer: http://stackoverflow.com/a/23867066
favorite count: 0
answer count: 3
has title: how to convert Map<Integer, List<String>> to Map<Integer, Set<String>>
has answer: http://stackoverflow.com/a/23867049
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/23856735
downvote count: 0
has body: In short - no, it can't. You can always print to stdout from the main method (using System.out.print or System.out.println), but you can't change the return type of main.
score: 7
answers question: http://stackoverflow.com/q/23856710
upvote count: 7
type: Answer

http://stackoverflow.com/a/23808255
has comment: http://stackoverflow.com/comment/36624049
has body: You can do that with one regex using a series of look-aheads: return text_str.matches("(?s)^(?=.*(string1|String2|String3))(?=.*(String4|String5))(?=.*(String6|String7|String8))(?=.*(String9|String10))(?=.*(String11|String12))(?=.*(String13|String14))(?=.*(String15|String16))(?=.*(String17|String18))(?=.*(String19|String19|String20))");
has comment: http://stackoverflow.com/comment/36623462
has comment: http://stackoverflow.com/comment/36623605
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36624188
has comment: http://stackoverflow.com/comment/36623702
accepted answer of: http://stackoverflow.com/q/23807830
type: Answer
has comment: http://stackoverflow.com/comment/36623527
answers question: http://stackoverflow.com/q/23807830
score: 2
has comment: http://stackoverflow.com/comment/36623958
upvote count: 2
has comment: http://stackoverflow.com/comment/36624196
has comment: http://stackoverflow.com/comment/36624289
has comment: http://stackoverflow.com/comment/36623406
has comment: http://stackoverflow.com/comment/36623766

http://stackoverflow.com/q/23843017
has body: I am trying to understand what's the correspondent of servlets and applets in PHP but I don't have much experience in JAVA. I want to know what is the equivalent of Java Servlets and JSP in PHP ?
score: 6
tagged with: servlets
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
has title: PHP equivalent of Java Servlet
favorite count: 0
has answer: http://stackoverflow.com/a/23843257
type: Question
answer count: 2
tagged with: php
upvote count: 6
tagged with: java
accepted answer: http://stackoverflow.com/a/23843257
possible better answer: http://stackoverflow.com/a/23843123
has answer: http://stackoverflow.com/a/23843123

http://stackoverflow.com/comment/36872879
comment on: http://stackoverflow.com/a/23868577
type: AnswerComment
type: Comment
has text: Thanks for the reply, yes, we finally ended up doing this. I was searching for a more sophisticated parser, as the CAMT XML data structure is massively blown-up an redundant, but apparently, there are no open-source parsers out there. Thanks anyways!
score: 1

http://stackoverflow.com/comment/36856865
type: AnswerComment
comment on: http://stackoverflow.com/a/23916802
type: Comment
score: 1
has text: How you convert a WORequest to an HttpServletRequest? You simply sit down and code the conversion?! Copy headers, method, body as per the API.

http://stackoverflow.com/a/23900626
upvote count: 1
downvote count: 0
has body: You need to parse the integer first use Scanner#nextInt(): integer = inputStream.nextInt(); That will then read a series of characters from the input, and convert them to an integer. If the input is invalid (not an integer, or too large), an exception will be thrown and your program will terminate.
type: Answer
answers question: http://stackoverflow.com/q/23900610
score: 1

http://stackoverflow.com/comment/36829434
type: AnswerComment
has text: This may work, but it'll use lots of CPU repeatedly checking the current time.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23916079

http://stackoverflow.com/a/23822881
downvote count: 0
answers question: http://stackoverflow.com/q/23822805
type: Answer
upvote count: 1
score: 1
has body: You are getting the Exception due to the line : String s=list[list.length]; Always remember : Last-index_of_an_Array = Array-length - 1 // because array index starts from 0 So, try : String s=list[list.length - 1];

http://stackoverflow.com/a/23916289
score: 6
has body: Ok after a lot of research I found a way to deploy my project with Tomcat7 Maven Plugin. It's as simple as running the goal mvn tomcat7:run-war The only downside is that it use it own embedded Tomcat server I leave the documentation here
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23896717
answers question: http://stackoverflow.com/q/23896717
type: Answer
upvote count: 6

http://stackoverflow.com/q/23828617
tagged with: jsp
has comment: http://stackoverflow.com/comment/36663201
has answer: http://stackoverflow.com/a/23828666
accepted answer: http://stackoverflow.com/a/23828666
downvote count: 0
answer count: 1
has body: What's the difference between encapsulating a conditional statement in double brackets over single in jsp? lets say we have a statement like the following: if (!method()) { or: if (!(method())) { Is there any difference? In my eyes they both would equate to: if (method() === false) {
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/36663041
type: AnsweredQuestion
score: 1
tagged with: java
has title: difference between single brackets and double bracket conditionals
type: Question
tagged with: if-statement

http://stackoverflow.com/a/23916016
type: AcceptedAnswer
has body: You can add a method annotated with @JsonValue annotation to your class which would get the field values from the reflection and return them in a form of array map. Here is an example: public class JacksonBeanToArray { public static class Search { public List&lt;Double&gt; minLatLng=new ArrayList&lt;Double&gt;(); public List&lt;Double&gt; maxLatLng=new ArrayList&lt;Double&gt;(); //These are bounding co-ordinates public List&lt;Integer&gt; ids=new ArrayList&lt;Integer&gt;(); public List&lt;Integer&gt; owner=new ArrayList&lt;Integer&gt;(); public float minScore; public float maxScore; public long minLength; public long maxLength; public String flag; public String language; public String keywords; public List&lt;Integer&gt; groupIds=new ArrayList&lt;Integer&gt;(); public List&lt;Integer&gt; characteristic=new ArrayList&lt;Integer&gt;(); public List&lt;Integer&gt; theme=new ArrayList&lt;Integer&gt;(); public boolean acitivity; public List&lt;Integer&gt; activityOwner=new ArrayList&lt;Integer&gt;(); public boolean event; public List&lt;Integer&gt; eventOwner=new ArrayList&lt;Integer&gt;(); public List&lt;Integer&gt; favouriteUser=new ArrayList&lt;Integer&gt;(); @JsonValue public Map&lt;String, Object[]&gt; getAsParamMap() throws IllegalAccessException { Object[] result = new Object[getClass().getFields().length]; for (int i = 0; i &lt; result.length; i++) { result[i] = getClass().getFields()[i].get(this); } return Collections.singletonMap("params", result); } } public static void main(String[] args) throws JsonProcessingException { Search search = new Search(); search.acitivity = true; search.maxLatLng = Arrays.asList(0.44, 5.); search.maxScore = 4; search.language = "EN"; ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(search)); } } Output: { "params" : [ [ ], [ 0.44, 5.0 ], [ ], [ ], 0.0, 4.0, 0, 0, null, "EN", null, [ ], [ ], [ ], true, [ ], false, [ ], [ ] ] }
accepted answer of: http://stackoverflow.com/q/23903575
type: Answer
answers question: http://stackoverflow.com/q/23903575
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/36815969
type: AnswerComment
comment on: http://stackoverflow.com/a/23905408
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54612/discussion-between-upma-and-arijit).
score: 0

asteriskami
tags question: http://stackoverflow.com/q/23865978
tag name: asteriskami
type: Tag

http://stackoverflow.com/comment/36586950
comment on: http://stackoverflow.com/a/23787829
score: 0
type: AnswerComment
type: Comment
has text: you can use dbms_random for the "other columns" to have diferent business values. ids are just keys to connect records so it doen't metter what values they should have. In real database you would use sequence any way, so why not to use them to generate sample data?

http://stackoverflow.com/q/23899281
type: UnansweredQuestion
tagged with: android
tagged with: fatal-error
has title: Handle NPE Gracefully and Display AlertDialog in OnPostExecute / AsyncTask When Internet Connection Is Lost - Android / Java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36804969
answer count: 2
has answer: http://stackoverflow.com/a/23899400
score: 0
tagged with: nullpointerexception
has body: I'm getting a NPE (as expected) in my AsyncTask during a loss of internet connectivity. I've attempted to do a bit of null checking then display an alertDialog if the result is null - however I the program is still crashing and is not stopping gracefully. How might this be avoided / what am I missing in this code? Source: @Override protected void onPostExecute(FunctionResult result) { if (result != null) { listener.callback(result); } else { String errorMsg = "Failed"; AlertDialog.Builder builder = new AlertDialog.Builder(null); builder.setMessage(errorMsg) .setTitle("Error") .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).create().show(); } } LogCat: 05-27 17:13:11.250: E/AndroidRuntime(23343): FATAL EXCEPTION: main 05-27 17:13:11.250: E/AndroidRuntime(23343): java.lang.NullPointerException 05-27 17:13:11.250: E/AndroidRuntime(23343): at com.example.login.wstasks.WebTask.onPostExecute(WebTask.java:65) 05-27 17:13:11.250: E/AndroidRuntime(23343): at com.example.login.wstasks.WebTask.onPostExecute(WebTask.java:1) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.os.AsyncTask.finish(AsyncTask.java:631) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.os.AsyncTask.access$600(AsyncTask.java:177) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.os.Handler.dispatchMessage(Handler.java:99) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.os.Looper.loop(Looper.java:137) 05-27 17:13:11.250: E/AndroidRuntime(23343): at android.app.ActivityThread.main(ActivityThread.java:5041) 05-27 17:13:11.250: E/AndroidRuntime(23343): at java.lang.reflect.Method.invokeNative(Native Method) 05-27 17:13:11.250: E/AndroidRuntime(23343): at java.lang.reflect.Method.invoke(Method.java:511) 05-27 17:13:11.250: E/AndroidRuntime(23343): at com.android.internal.o…
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/23902905

http://stackoverflow.com/comment/36819028
has text: Having 2000 lines of code in a loop may be an indication that you should split a method down into smaller, testable parts. But a break statement is a perfectly decent way of exiting a loop (of any size).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23910665
score: 0

http://stackoverflow.com/a/23938682
has body: Without a logcat stacktrace to look at, I am assuming that your issue has to do with variable scope (here is an example explanation on the topic). What you need to do is declare your button as a class level variable because right now it is a method variable and as such ceases to exist once your onCreate method has finished executing. public class MainActivity extends FragmentActivity { private Button myButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myButton = (Button) findViewById(R.id.button1); myButton.setOnClickListener(...); ... } }
answers question: http://stackoverflow.com/q/23938516
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36872735

http://stackoverflow.com/q/23865509
has title: Why DataSourceTransactionManage does not roll back while HibernateTransactionManager does?
answer count: 2
has answer: http://stackoverflow.com/a/23865591
downvote count: 0
favorite count: 0
has body: &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; While building an app using spring and hibernate , if I use DataSourceTransactionManager, then on exception , it does not roll back. Seems like it uses auto-comit in different session. However , if I change the transaction manager to org.springframework.orm.hibernate3.HibernateTransactionManager, the roll back works as expected. Or is it that if we use hibernate , then we need to use HibernateTransactionManager? N.b: My service annotated with @Transactional(rollbackFor = { Throwable.class} )
tagged with: spring
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36811435
accepted answer: http://stackoverflow.com/a/23865591
upvote count: 2
possible better answer: http://stackoverflow.com/a/23907122
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23907122
type: Question

http://stackoverflow.com/q/23870728
answer count: 2
duplicate of: http://stackoverflow.com/q/270197
has answer: http://stackoverflow.com/a/23870868
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36742921
has answer: http://stackoverflow.com/a/23870805
linked to: http://stackoverflow.com/q/270197
has title: Can't open file under custom folder on my Eclipse project
tagged with: java
tagged with: eclipse
type: Question
has body: I'm developing a custom plugin for Eclipse and I have a powerpoint file named "extract.ppt" that I want to open through my source code. When I place the file on my projects root diercotry and use: File file = new File("/extract.ppt"); the file opens just fine. But since im gonna be using a few more files on my application, I thought it would be a good idea to keep them all organised under a folder. So I created a folder named "files" under my main project folder and tried to use: File file = new File("/files/extract.ppt"); but I get an error saying the file does not exist. I checked my Eclipse project's folder and the folder "files" as long as the "extract.ppt" are there. Any ideas?
score: 0

http://stackoverflow.com/q/23832023
favorite count: 0
has title: JXTreeTable, row striping and proper repainting
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: look-and-feel
tagged with: jxtreetable
tagged with: swing
has body: I'm using a look and feel which does row striping of tables by default. When I put in a JXTreeTable, I noticed that for some reason it didn't get the row striping automatically. So I put in a workaround using Highlighter, but it looks like I get a repainting glitch: It seems like JXTreeTable is specifically repainting only the boundaries of the text instead of the whole cell. I have been trying to catch this in the debugger to figure out why, but every time I switch between programs, the whole window repaints, so it's nearly impossible to catch this kind of thing. JTable and JTree both behave sanely. This look and feel is one which paints the whole row of a JTree (like Quaqua and Synth), so maybe that has something to do with it too. Perhaps JXTreeTable has some kind of assumption that the look and feel won't paint the rows of the tree? If so, is there a way to work around that? It won't just be this look and feel which has the issue. The code: import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.AbstractHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; import org.jdesktop.swingx.decorator.Highlighter; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.TreeTableModel; import org.trypticon.haqua.HaquaLookAndFeel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; import java.awt.BorderLayout; import java.awt.Component; import java.util.Arrays; public class TreeTableDemo2 implements Runnable { public static void main(String[] args) { SwingUtilities.invokeLater(new TreeTableDemo2()); } @Override public void run() { try { UIManager.setLookAndFeel(new HaquaLookAndFeel()); } catch (Exception e) { throw new RuntimeException(e); } JFrame frame = new JFrame("Tree Table Demo"); frame.setLayo…
has answer: http://stackoverflow.com/a/23841340
accepted answer: http://stackoverflow.com/a/23841340
type: Question
answer count: 1
downvote count: 0
tagged with: swingx

http://stackoverflow.com/a/23907625
has comment: http://stackoverflow.com/comment/36814047
downvote count: 1
has comment: http://stackoverflow.com/comment/36814205
has body: You are setting the value to pageContext and trying to accessed via ${}. This by default refer to request scope. Try ${pageScope.sb} Apart from that Your code looks fine, but i'm confused with the &amp;&amp;. Usually the URL parameter are separated by just one &amp; symbol. Why do you need 2?
has comment: http://stackoverflow.com/comment/36813943
type: Answer
answers question: http://stackoverflow.com/q/23907526
upvote count: 0
has comment: http://stackoverflow.com/comment/36813700
has comment: http://stackoverflow.com/comment/36814114
has comment: http://stackoverflow.com/comment/36814871
has comment: http://stackoverflow.com/comment/36814150
score: -1
has comment: http://stackoverflow.com/comment/36814207

http://stackoverflow.com/comment/36871190
score: 0
type: Comment
has text: You can't keep it where if was currently because that will not allow your writer thread to write. You need to think it in steps. 1. Create Runner 2. Do Processing 3. Stop threads. These three operations has to be called from outside Runner.
comment on: http://stackoverflow.com/a/23930729
type: AnswerComment

http://stackoverflow.com/comment/36668049
score: 0
type: AnswerComment
type: Comment
has text: Thanks sbat, your advice led to identifying the root cause of the display error.
comment on: http://stackoverflow.com/a/23830844

http://stackoverflow.com/q/23878676
type: Question
has answer: http://stackoverflow.com/a/23879528
tagged with: jsf-2.2
linked to: http://stackoverflow.com/q/2101755
accepted answer: http://stackoverflow.com/a/24247458
linked to: http://stackoverflow.com/q/8168302
score: 0
possible better answer: http://stackoverflow.com/a/23879528
answer count: 3
tagged with: el
has body: My real use is a bit different, but I've narrowed the problem down to the code you see below. When you click the "go nowhere" button, all is well, no matter how many times you click it. But when you click "go somewhere", you get an IllegalStateException, "Component ID j_idt3:fnord1 has already been found in the view". Why does it work just fine returning null but not when you return a nav string? I've read this answer, which is relevant, but doesn't have quite enough for my understanding. If there's a section in the jsf spec (or some such source) that is relevant, I'd greatly appreciate answers pointing it out. /secure/application/sample.xhtml: &lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;ul&gt; &lt;li&gt;&lt;h:commandLink action="#{sample.goNowhere}" value="go nowhere"/&gt;&lt;/li&gt; &lt;li&gt;&lt;h:commandLink action="#{sample.goSomewhere}" value="go somewhere"/&gt;&lt;/li&gt; &lt;/ul&gt; &lt;h:selectOneMenu id="fnord0" binding="#{components.menuAddForm}"&gt; &lt;f:selectItem id="fnord1" itemLabel="---" noSelectionOption="true"/&gt; &lt;/h:selectOneMenu&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; I don't need the ids, it just makes the error easier to read. "components" is a request scoped hashmap, following the recommendation in this answer about component bindings. Sample.java: package com.example; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class Sample { private static final String somewhere = "/secure/application/sample.xhtml"; public String goNowhere() { System.out.println("goNowhere()"); return null; } public String goSomewhere() { System.out.println("goSomewhere()"); return somewhere; } }
has answer: http://stackoverflow.com/a/24247458
type: AnsweredQuestion
has title: "Component already found in view" when navigating to same page, uicomponent binding
tagged with: java
has answer: http://stackoverflow.com/a/23919645

package-private
tags question: http://stackoverflow.com/q/23888814
tags question: http://stackoverflow.com/q/23811479
type: Tag
tag name: package-private

http://stackoverflow.com/q/23849944
has title: securitypolicy Policy is not a <wsp:Policy> element
type: Question
has body: I have this security error: Exception in thread "main" java.lang.IllegalArgumentException: {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Policy is not a <wsp:Policy> element. at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:176) at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124) at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:100) at org.apache.ws.secpolicy11.builders.WSS10Builder.build(WSS10Builder.java:40) at org.apache.ws.secpolicy11.builders.WSS10Builder.build(WSS10Builder.java:33) at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138) at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117) at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224) at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174) at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124) at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:100) at org.apache.ws.secpolicy11.builders.SecureConversationTokenBuilder.build(SecureConversationTokenBuilder.java:70) at org.apache.ws.secpolicy11.builders.SecureConversationTokenBuilder.build(SecureConversationTokenBuilder.java:31) at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138) at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117) at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224) at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174) at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124) at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:100) at org.apache.ws.secpolicy11.builders.ProtectionTokenBuilder.build(ProtectionTokenBuilder.java:39) at org.apache.ws.secpolicy11.builders.ProtectionTokenBuilder.build(ProtectionTokenBuilder.java:34) at org.apache.neethi.AssertionBuilderF…
answer count: 1
tagged with: ws-security
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36709449
type: UnansweredQuestion
tagged with: maven
upvote count: 1
tagged with: wso2
tagged with: java
has answer: http://stackoverflow.com/a/23853022

http://stackoverflow.com/comment/134070503
has text: i know nobody but the most jnr person works on open source, but this is sososo dumb
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/66910991
type: Comment

http://stackoverflow.com/a/23848742
accepted answer of: http://stackoverflow.com/q/23848668
upvote count: 3
has comment: http://stackoverflow.com/comment/36704974
score: 3
answers question: http://stackoverflow.com/q/23848668
has body: total of 9 classes. Every class extends JFrame and is a separate form for each of the classes. don't to create bunch of JFrames use CardLayout with JFrame.pack() after card is switched remove a) JPanel contains JComponent, b) add another JPanel contains JComponent, c) call JFrame.(re)validate, JFrame.repaint(), then JFrame.pack() as last code lines, after all changes to already visible GUI is done and I want to convert it into an JApplet so that I can make it a web-application after finishing with the conversion. Java Web Start JavaFX container with Swing JComponents (JPanels by using CardLayout) pure JavaFx application
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36819572
type: QuestionComment
comment on: http://stackoverflow.com/q/23908667
has text: If you want to access the local hard drive then you need to sign your jar file. You can use a self-signed cert for testing.
type: Comment
score: 0

http://stackoverflow.com/q/23895478
has answer: http://stackoverflow.com/a/23896125
has comment: http://stackoverflow.com/comment/36790657
type: Question
has answer: http://stackoverflow.com/a/23895703
tagged with: capability
tagged with: class
upvote count: 2
has body: Problem I'm trying to use Java generics to replace classes with similar methods. All of the examples that I've found cover simple examples, but I'm not sure if Java Generics are intended to be used this way. I have 2 parent classes, and 2 child classes that have almost identical methods. Both parent classes derive from different classes as well. Ultimately, I want to be able to use one block of code to create and manipulate one of the parent classes, then its child class without a lot of switch statements or other flow control with duplicate code. This is what I had in mind, even though I haven't beeen able to get it to work this way yet, whether it be syntax, or just not a feature of Generics. Parent Classes public class FooParent { private FooChild fooChild; public FooChild getChild() { return fooChild; } } public class BarParent { private BarChild barChild; public BarChild getChild() { return barChild; } } Child Classes public class FooChild { public void print() { System.out.println("I'm a foo child"); } } public class BarChild { public void print() { System.out.println("I'm a bar child"); } } Generic Classes public class GenericParent&lt;T&gt; { private T self; public GenericParent(T self) { this.self = self; } public GenericChild getChild() { return new GenericChild(self.getChild()); } } public class GenericChild&lt;T&gt; { private T self; public GenericChild(T self) { this.self = self; } public void print() { self.print(); } } How I want to use them public static void main(String args[]) { GenericParent parent; // Only the initialization of the parent variable needs specialized code switch(args[0]) { case "foo": parent = new GenericParent(new FooParent()); break; case "bar": parent = new GenericParent(new BarParent()); break; } // From here on out, it's all generic parent.getChild().print(); } Usage and desired output java genericExample foo &gt; I'm a foo child java genericExample bar &gt; I'm a bar child Final Questions Maybe "child" and "parent" are misnom…
has comment: http://stackoverflow.com/comment/36790822
tagged with: generics
has title: Can Java Generics replace multiple similar classes?
favorite count: 0
has comment: http://stackoverflow.com/comment/36793438
tagged with: generalization
has comment: http://stackoverflow.com/comment/36794233
has answer: http://stackoverflow.com/a/23895915
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36791123
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/36791080
has answer: http://stackoverflow.com/a/23895667
downvote count: 0
has comment: http://stackoverflow.com/comment/36790698
tagged with: java

http://stackoverflow.com/comment/36767199
type: AnswerComment
comment on: http://stackoverflow.com/a/23882874
type: Comment
has text: send me your whole proj..if possible.
score: 0

http://stackoverflow.com/a/25037049
type: Answer
has body: Add the import : For DateTimeFormat import org.springframework.format.annotation.DateTimeFormat; For more kind of validation like : NotNull You can use validation-api jar , after including the jar just import : import javax.validation.constraints.NotNull`; And in the class , while defining variable : @DateTimeFormat(pattern="MM/dd/yyyy") @NotNull private Date date;
score: 0
answers question: http://stackoverflow.com/q/23894640

http://stackoverflow.com/a/23853858
accepted answer of: http://stackoverflow.com/q/23838023
downvote count: 0
answers question: http://stackoverflow.com/q/23838023
score: 12
has body: I have the same answer in a comment on the question, but just to make it easier for future readers to see, here it is. doNothing().when(mock).myFunction(anyString()); in order to be able to handle the void return type.
type: AcceptedAnswer
type: Answer
upvote count: 12

http://stackoverflow.com/a/23870740
has comment: http://stackoverflow.com/comment/49019982
has comment: http://stackoverflow.com/comment/36748279
accepted answer of: http://stackoverflow.com/q/23869930
has comment: http://stackoverflow.com/comment/36743119
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36745812
has body: No. The accumulator should not modify its arguments; it takes two values and produces a new value. If you want to use mutation in the course of accumulation (e.g., accumulating strings into a StringBuffer instead of concatenating), use Stream.collect(), which is designed for this. Here's an example of code that produces the wrong answer if you try this. Let's say you want to do addition with a hypothetical MutableInteger class: // Don't do this MutableInteger result = stream.reduce(new MutableInteger(0), (a,b) -&gt; a.add(b.get())); One reason this gets the wrong answer is that if we break the computation up in parallel, now two computations are sharing the same mutable starting value. Note that: a + b + c + d = 0 + a + b + 0 + c + d // 0 denotes identity = (0 + a + b) + (0 + c + d) // associativity so we are free to split the stream, compute the partial sums 0 + a + b and 0 + c + d, and then add the results. But if they are sharing the same identity value, and that value is mutated as a result of one of the computations, the other may start with the wrong value. (Note further that the implementation would be allowed to do this even for sequential computations, if it thought that was worthwhile.)
type: Answer
upvote count: 13
answers question: http://stackoverflow.com/q/23869930
has comment: http://stackoverflow.com/comment/36748869
score: 13
has comment: http://stackoverflow.com/comment/36766598

http://stackoverflow.com/comment/36701333
has text: You pass just an object, the int can be used to specify the type of the object if there could be more types than just one type `Message`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23848610

http://stackoverflow.com/comment/36722166
score: 1
type: Comment
has text: Contact is an Activity : so you cannot create it with `new Contact();` An activity MUST be created by the Android framework and and initialized in the `onCreate(...)` You must learn about Activity lifecycle in Android : http://developer.android.com/training/basics/activity-lifecycle/index.html
type: QuestionComment
comment on: http://stackoverflow.com/q/23859440

http://stackoverflow.com/comment/36809274
type: QuestionComment
score: 1
has text: Favor [composition over inheritance](http://en.wikipedia.org/wiki/Composition_over_inheritance).
type: Comment
comment on: http://stackoverflow.com/q/23905202

http://stackoverflow.com/comment/36726783
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). If the image is really relevant to the problem (I doubt it is) it must be generated in code or hot-linked from the page mentioned earlier. BTW - **given the 'multiple GUI items' are all representing instances of one type of object, that suggests either a `JList` or a `JTable` would be best to display/edit them.**
comment on: http://stackoverflow.com/q/23861345
score: 0

http://stackoverflow.com/comment/36692315
type: AnswerComment
has text: @Genuigr `synchronized` is per instance, not per instance+method. See [this tutorial from Oracle](http://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html), read the first bullet point of the "making these methods synchronized has two effects:" section.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23844127

google-analytics-api
tags question: http://stackoverflow.com/q/23790589
tag name: google-analytics-api
type: Tag
tags question: http://stackoverflow.com/q/23792743

http://stackoverflow.com/comment/36711347
type: QuestionComment
comment on: http://stackoverflow.com/q/23853705
has text: @YekhezkelYovel: In the second listing, where is the variable `helper` updated?
score: 0
type: Comment

http://stackoverflow.com/q/23836238
type: AnsweredQuestion
tagged with: java
type: Question
has title: Unexpected 40ms ping
has answer: http://stackoverflow.com/a/23836662
score: 0
answer count: 1
has body: I'm experiencing a weird issue, and I can't figure out what is occurring. So basically, when I try to make a simple connection between a server and a client with an exchange of a float number (with DataInputStream and DataOutputStream), it seems that there is a fixed ping limit, exactly 40ms on three different computers with openjdk. Furthermore, I tried to change the way I send the float number with: outs.write(ByteBuffer.allocate(4).putFloat(3.14f).array(), 0, 4); which is supposed to do the same thing as: outs.writeFloat(3.14f); and this odd ping limit surprisingly vanished! Maybe I am doing something wrong with the following code: client side import java.net.InetAddress; import java.net.UnknownHostException; import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; import java.io.IOException; import java.io.DataOutputStream; import java.io.DataInputStream; import java.nio.ByteBuffer; public class client { private Socket sock; private DataOutputStream outs; private DataInputStream ins; public client() throws IOException{ byte c; sock = new Socket(InetAddress.getByName("localhost"),9998); outs = new DataOutputStream(sock.getOutputStream()); ins = new DataInputStream(sock.getInputStream()); do{ long start = System.currentTimeMillis(); /* here is the thing */ //outs.write(ByteBuffer.allocate(4).putFloat(3.14f).array(), 0, 4); // either this outs outs.writeFloat(3.14f); // or this one outs.flush(); c = ins.readByte(); long stop = System.currentTimeMillis(); System.out.println("elapsed time: "+(stop-start)+"ms"); }while(c == (byte) 1); } public static void main(String[] args) { try{ client client = new client(); } catch(SocketException e){ System.out.println("Socket disconnected"); } catch (IOException e) { e.printStackTrace(); } } } server import java.net.InetAddress; import java.net.UnknownHostException; import java.net.InetAddress; import java.net.Socket; import java.net.ServerSocket; import java.io.IOException; import java.io.DataOutput…
tagged with: sockets
tagged with: ping
accepted answer: http://stackoverflow.com/a/23836662

http://stackoverflow.com/comment/45237968
score: 0
comment on: http://stackoverflow.com/q/23938312
type: Comment
type: QuestionComment
has text: Hi, I ended up doing it a simpler way. I just added a random angle (using the Math.random) function with a range of 0- 360. then added about 1800 to that (5 turns for animation). then used a switch statement to decide the outcome based on the random angle produced.

http://stackoverflow.com/a/23881065
answers question: http://stackoverflow.com/q/23880942
has body: try this 1.)File->New->Other 2.)Select Android Project 3.)Select "Create Project from existing source" 4.)Click "Browse..." button and navigate to your project 5.)Finish (Now action bar project in your workspace) 6.)Right-click on your project -> Properties 7.)In Android->Library section click Add 8.)select recently added project -> Ok after done it you have to build your project. Now it'll be ready to use.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23880942
type: Answer

http://stackoverflow.com/comment/36607595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23799498
has text: yes i found that stil i am getting into infinite loop

http://stackoverflow.com/comment/36678160
has text: @khmarbaise Because Maven 2 is provided by default by Ubuntu 12.04 LTS (which is the system I use nowadays). Do you think using Maven 3 could resolve my problem? I will take a look at plugins version. Anyway my objective is not to be up-to-date immediately but to release a version. Finally I think the interest of pinning plugin versions in the parent pom is patent if the submodules are sharing plugins, which is not the case here (except for the maven-compiler-plugin, but I put it in the parent pom). Thanks.
comment on: http://stackoverflow.com/q/23831811
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36972715
score: 0
type: AnswerComment
type: Comment
has text: "standard Spring application context, no bean should be exposed to more than one thread until after its @PostConstruct", but Spring Web context is very "popular" context, and servlets call for example `@Service` from multiple threads. So in my opinion concurrent access to beans is very common in Spring.
comment on: http://stackoverflow.com/a/23992532

http://stackoverflow.com/a/23796517
answers question: http://stackoverflow.com/q/23796368
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36601818
has body: Your Person class will need public setter and getter Dog methods. Your Dog class will need public setter and getter Name methods E.g. public class Person { ... private Dog dog; public Dog getDog () {return dog;} .....

http://stackoverflow.com/comment/36753777
type: QuestionComment
comment on: http://stackoverflow.com/q/23876389
score: 0
type: Comment
has text: I don't really like this workaround. The strange thing is that his code works fine on one computer, but has problem on another.

http://stackoverflow.com/comment/36736658
comment on: http://stackoverflow.com/q/23867391
has text: Related: If a user must not click a button, disable it. If a user must click only that button, disable all the others...
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23892962
has comment: http://stackoverflow.com/comment/36789071
has comment: http://stackoverflow.com/comment/36792199
tagged with: deserialization
has comment: http://stackoverflow.com/comment/36789352
score: 7
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/36786772
type: Question
has body: TL;DR Can I use Java serialization/deserialization using Serializable interface, ObjectOutputStream and ObjectInputStream classes, and probably adding readObject and writeObject in the classes implementing Serializable as a valid implementation for Prototype pattern or not? Note This question is not to discuss if using copy constructor is better than serialization/deserialization or not. I'm aware of the Prototype Pattern concept (from Wikipedia, emphasis mine): The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. This pattern is used to: avoid subclasses of an object creator in the client application, like the abstract factory pattern does. avoid the inherent cost of creating a new object in the standard way (e.g., using the 'new' keyword) when it is prohibitively expensive for a given application. And from this Q/A: Examples of GoF Design Patterns in Java&#39;s core libraries, BalusC explains that prototype pattern in Java is implemented by Object#clone only if the class implements Cloneable interface (marker interface similar to Serializable to serialize/deserialize objects). The problem using this approach is noted in blog posts/related Q/As like these: Copy Constructor versus Cloning Java: recommended solution for deep cloning/copying an instance So, another alternative is using a copy constructor to clone your objects (the DIY way), but this fails to implement the prototype pattern for the text I emphasized above: avoid the inherent cost of creating a new object in the standard way (e.g., using the 'new' keyword) AFAIK the only way to create an object without invoking its constructor is by deserialization, as noted in the example of the accepted answer of this question: How are constructors called during serialization and deserialization? So, I'm just asking if using object deserialization through ObjectOutput…
has comment: http://stackoverflow.com/comment/36789510
has answer: http://stackoverflow.com/a/23941720
tagged with: design-patterns
linked to: http://stackoverflow.com/q/2156120
linked to: http://stackoverflow.com/q/8141440
linked to: http://stackoverflow.com/q/1673841
has comment: http://stackoverflow.com/comment/36786268
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23893433
upvote count: 10
has comment: http://stackoverflow.com/comment/36785809
has comment: http://stackoverflow.com/comment/36789469
answer count: 4
has comment: http://stackoverflow.com/comment/36785881
accepted answer: http://stackoverflow.com/a/23941720
tagged with: prototype-pattern
has title: Is Object deserialization a proper way to implement Prototype pattern in Java?
has comment: http://stackoverflow.com/comment/36786280
has comment: http://stackoverflow.com/comment/36786569
has comment: http://stackoverflow.com/comment/36789159
has comment: http://stackoverflow.com/comment/36786835
possible better answer: http://stackoverflow.com/a/24018910
has comment: http://stackoverflow.com/comment/36789386
has answer: http://stackoverflow.com/a/24018910
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24048557

http://stackoverflow.com/a/23907210
has comment: http://stackoverflow.com/comment/36813015
score: 8
has comment: http://stackoverflow.com/comment/36812941
answers question: http://stackoverflow.com/q/23907118
type: AcceptedAnswer
downvote count: 0
has body: If you call run() directly, the code gets executed in the calling thread. By calling start(), a new Thread is created and executed in parallel.
has comment: http://stackoverflow.com/comment/36813087
accepted answer of: http://stackoverflow.com/q/23907118
upvote count: 8
type: Answer

http://stackoverflow.com/a/23883894
has body: When you submit a form it has an incorrect method In the action mapping you have configured the method post() will be mapped to the login action. But, your action class doesn't have such method. If you change this mapping to <action name="login" class="com.tribro.chandu.Login"> this will map to the execute() method by default. This method you should create in the action class. It has different signature which has not any parameters. If you need to know how to get servlet objects such as HttpServletRequest then you can read this answer. You can get the request from the action context like HttpServletRequest request = ServletActionContext.getRequest(); That way is useful in interceptors, but in action better to implement ServletRequestAware protected HttpServletRequest request; public void setServletRequest(HttpServletRequest request) { this.request = request; }
has comment: http://stackoverflow.com/comment/36768662
has comment: http://stackoverflow.com/comment/36770519
answers question: http://stackoverflow.com/q/23882198
has comment: http://stackoverflow.com/comment/36769032
has comment: http://stackoverflow.com/comment/36771253
score: 0
has comment: http://stackoverflow.com/comment/36770634
type: Answer

http://stackoverflow.com/q/23876399
type: Question
has comment: http://stackoverflow.com/comment/36753732
accepted answer: http://stackoverflow.com/a/23876456
score: 4
has comment: http://stackoverflow.com/comment/36753435
has title: Get value of static field from Class
answer count: 1
tagged with: reflection
has comment: http://stackoverflow.com/comment/36782805
has body: abstract class A { static int i = 5; } class B extends A { static int i = 6; } class C extends A { static int i = 7; } Now I have an ArrayList&lt;Class&lt;? extends A&gt;&gt;. How can I get the value of the static field from an Class&lt;? extends A&gt;?
tagged with: java
has comment: http://stackoverflow.com/comment/36753498
upvote count: 4
has comment: http://stackoverflow.com/comment/36753580
has answer: http://stackoverflow.com/a/23876456
type: AnsweredQuestion
downvote count: 0
favorite count: 0
tagged with: static

http://stackoverflow.com/q/23894260
tagged with: android
has comment: http://stackoverflow.com/comment/36788350
has comment: http://stackoverflow.com/comment/36788696
has comment: http://stackoverflow.com/comment/36789855
has body: I'm new on android, I'm tryng to display an array on a listview this is the xml where I set the listview: &lt;ListView android:id="@+id/lv" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; an here is MainActivity.java: import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity { ListView listView ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView lv = (ListView) findViewById(R.id.lv); String[] values = new String[] { "Elemento 1", "Elemento 2", "Elemento 3", "Elemento 4", "Elemento 5", "Elemento 6", "Elemento 7", "Elemento 8" }; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.id.text1, values); lv.setAdapter(adapter); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } so, the problem is, everything goes great, until I write: lv.setAdapter(adapter); I run the app, and it just crashes, App has stopped. when I comment this section of code, it runs but o…
has title: android listview setadapter crash
has comment: http://stackoverflow.com/comment/36789198
has comment: http://stackoverflow.com/comment/36788699
has answer: http://stackoverflow.com/a/23917169
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36788319
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23894367
tagged with: listview
type: Question
has answer: http://stackoverflow.com/a/23894367
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36788354
has comment: http://stackoverflow.com/comment/36789076
accepted answer: http://stackoverflow.com/a/23917169
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36789526

http://stackoverflow.com/comment/36840387
type: QuestionComment
has text: "*really having trouble getting this right*" can we see your attempts to solve this problem?
comment on: http://stackoverflow.com/q/23921658
score: 0
type: Comment

http://stackoverflow.com/comment/36664144
comment on: http://stackoverflow.com/a/23824753
score: 0
type: AnswerComment
type: Comment
has text: Why are you using `IntStream.mapToLong(…)` for processing **`bytes`**? Why aren’t you using `IntStream.map(…)`?

ldap
tags question: http://stackoverflow.com/q/23843918
tags question: http://stackoverflow.com/q/23887669
tags question: http://stackoverflow.com/q/23898970
tag name: ldap
tags question: http://stackoverflow.com/q/23781305
tags question: http://stackoverflow.com/q/23917844
type: Tag
tags question: http://stackoverflow.com/q/23860077

http://stackoverflow.com/comment/36838042
type: QuestionComment
comment on: http://stackoverflow.com/q/23920425
score: 1
has text: In what way did it not work?
type: Comment

http://stackoverflow.com/comment/36827629
type: QuestionComment
comment on: http://stackoverflow.com/q/23912987
has text: What is your question?
score: 0
type: Comment

http://stackoverflow.com/q/23791838
type: Question
accepted answer: http://stackoverflow.com/a/23792898
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/36595481
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/9108224
has title: Hibernate-JPA deleting in cascade or triggers
has answer: http://stackoverflow.com/a/23792898
upvote count: 1
has comment: http://stackoverflow.com/comment/36595237
has body: I'm using JPA and Hibernate as provider with MySQL DBMS and I remarked that the cascade deleting does not work for my situation : @Entity public class Entity_1{ @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String nomAttribute; @ManyToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE}) private java.util.List&lt;Entity_2&gt; et2; ... } and the second Entity is @Entity public class Entity_2{ @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; private String nomAttribute; ... } the result is a three tables Entity_1 ,Entity_2, Entity_1_Entity_2 I remarked that when I delete a Entity_1 the Entity_2 is too deleted because of the cascade on deleting . what I want is when I delete Entity_1 the relation between Entity_1 and Entity_2 deleted only not the Entity_2 and I tried Many options in but all in vain What the option should I use or there are no options for that and I should use Triggers ??
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql

http://stackoverflow.com/comment/36627388
type: QuestionComment
comment on: http://stackoverflow.com/q/23808946
type: Comment
has text: @ gexicide: i get that warning in "public interface NodeList<Node> extends Iterable<Node>".
score: 0

http://stackoverflow.com/comment/36891666
type: AnswerComment
type: Comment
has text: The DOM is changed by the user with hovering over specific links. The hover will generate more links which I need to get afterwards.
comment on: http://stackoverflow.com/a/23789443
score: 0

http://stackoverflow.com/comment/36728398
type: Comment
type: AnswerComment
has text: @PaulBellora I'd call question about hard/easy to maintain volatile- or `fence()`-based code totally subjective thus makes no sense to argue. Regadring synchronization - that's true, I changed my suggestion to `ReentrantReadWriteLock`.
comment on: http://stackoverflow.com/a/23862446
score: 0

http://stackoverflow.com/a/23882668
accepted answer of: http://stackoverflow.com/q/23869549
upvote count: 2
type: Answer
has body: It's Windows Server, that doesn't support DES right now, not Java 7. Java supports DES. Microsoft has deprecated DES in their Windows Server 2008. Earlier versions support DES, in 2008 (and newer), if organization wants to use DES, administrators must enable it (click checkbox "Use Kerberos DES encryption types for this account" on the Active Directory user, who should be allowed to use one of such week encryption algorithms). See red square on the screenshot: Source: http://blogs.msdn.com/b/openspecification/archive/2011/05/31/windows-configurations-for-kerberos-supported-encryption-type.aspx) Sometimes administrators must also allow using DES on client machines (It's also described in the article linked above). Java supports all those encryption algorithms.
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23869549

http://stackoverflow.com/comment/36763767
type: Comment
type: QuestionComment
score: 0
has text: @immibis what would be it is waiting for? I couldnt find anyother thread owns lock on 0x00002aaacb4d4000. Actually there is no other occurrence for 0x00002aaacb4d4000 in the entire dump except this place
comment on: http://stackoverflow.com/q/23881328

http://stackoverflow.com/comment/50460116
type: QuestionComment
type: Comment
has text: Yes, i but not the way i'm thinking first. I juste draw checkbox with line. I create function that create checkbox. Something like this : drawCheckbox(int top, int left, int size, boolean checked);. good luck. Maybe the new api work better.
comment on: http://stackoverflow.com/q/23827757
score: 0

http://stackoverflow.com/q/23796620
has answer: http://stackoverflow.com/a/24593996
has comment: http://stackoverflow.com/comment/38102945
answer count: 3
favorite count: 0
upvote count: 2
tagged with: multithreading
has title: Java: How can a calculation on the data happen before the data is read in?
accepted answer: http://stackoverflow.com/a/24593996
tagged with: swing
has comment: http://stackoverflow.com/comment/36601992
has answer: http://stackoverflow.com/a/23796809
has answer: http://stackoverflow.com/a/23796646
type: AnsweredQuestion
has body: I have two threads. One is EDT (using the swingUtilities.invokeLater) and the other is for calculation. I get the input from a mouse click handled in the EDT and then perform the calculation in the other. But I get the following output (the black numbers are in EDT, the red are in the other): So it seems that the calculation occurs before I read the data from GUI. Could anyone explain why? Edit: Some code: //in EDT public void mousePressed (MouseEvent e) { //get the position System.out.println(i + " " + j);---&gt; black numbers played = true; } //in thread 2 public boolean valid (Move m) { System.err.println(m.locX +" "+m.locY); ---&gt; red numbers //use the position get in EDT System.out.println("finished");---&gt; black 'finished' }
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/23796809
type: Question
score: -1

http://stackoverflow.com/q/23802046
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23802143
score: 0
has comment: http://stackoverflow.com/comment/36612339
accepted answer: http://stackoverflow.com/a/23802143
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/5980316
type: AnsweredQuestion
tagged with: swt
upvote count: 1
downvote count: 1
type: Question
has title: Eclipse ProgressMonitor accessing UI in different thread
has body: I need to display a progressbar in eclipse rcp app, for long task. The task is also using GUI components. ProgressMonitorDialog progBar = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); progBar.run(true, false, new IRunnableWithProgress(){ public void run(IProgressMonitor monitor) { editor.doTask(monitor); } }); public void doTask(IProgressMonitor monitor) { monitor.beginTask("Progress", IProgressMonitor.UNKNOWN); theomposite.getValues(); // &lt;- fails here *WRONG THREAD* Because it's not the same thread I am getting Caused by: org.eclipse.swt.SWTException: Invalid thread access

http://stackoverflow.com/a/23898705
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: Maybe this clarifies all. for (int i = 0; i &lt; toConvert.length(); ) { int codePoint = Character.codePointAt(toConvert, i); i += Character.charCount(codePoint); System.out.printf("[%d] cp: %x%n", i, codePoint); } for (int i = 0; i &lt; toConvert.length(); ++i) { char ch = toConvert.charAt(i); System.out.printf("[%d] c: %x%n", i, (int)ch); } It yields one single code point of two 16 bit chars. [2] cp: 1f612 [0] c: d83d [1] c: de12 Exactly as the UTF-16 standard says.
upvote count: 1
has comment: http://stackoverflow.com/comment/36797162
accepted answer of: http://stackoverflow.com/q/23898356
answers question: http://stackoverflow.com/q/23898356

http://stackoverflow.com/comment/36852677
has text: We would like to use servlet API in webobjects. Because we need to call third party api method with HttpServletRequest and HttpServletResponse as parameters. Now we are accepting the DirectAction request and we need to call that third party api. So we need to convert the WORequest to HttpServletRequest in DirectAction. But we don't want to deploy this application in other servers. We should have to deploy this only in webobjects. So please let me know, how to convert WORequest to HttpServletRequest or else the other choice.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23916802
type: Comment

http://stackoverflow.com/comment/36846468
type: Comment
has text: @MadProgrammer From what I can tell, `DefaultCellEditor.isCellEditable()` returns false when a JTable cell is single-clicked. Nevertheless, if I start typing in the selected (via single-click) cell, its value changes. I'm still confused as to why that is. It seems to break the notion of a clean separation between editing and rendering modes.
comment on: http://stackoverflow.com/a/23924135
score: 0
type: AnswerComment

http://stackoverflow.com/a/23851112
has comment: http://stackoverflow.com/comment/36706333
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: According to Java Docs: void java.io.PrintStream.println(): Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n'). In other words, System.out.println(s); prints a newline after printing s. What can you do? You could use: System.out.print(s); instead.
answers question: http://stackoverflow.com/q/23851097

http://stackoverflow.com/q/23795686
type: UnansweredQuestion
has body: I have a file where the first thing is the name of an object, and the other to the end of the line - descriptions for this object, how can i read this using Scanner? SUMMARY ; 'Description summary'Description summary2' CAR ; 'Description car' SAVINGS ; 'description' HOME ; 'Description home' I allready have some thing like that. But i need to stop the second while() when the line ends. while(scanner.hasNext()) { System.out.print(scanner.next()); scanner.next(); scanner.useDelimiter("'"); if(scanner.hasNext(" ")) { scanner.next(); while(scanner.hasNext()) { System.out.print(" = " + scanner.next()); } } if(scanner.hasNextLine()) {scanner.nextLine();} scanner.useDelimiter(" "); System.out.print("\t"); }
has answer: http://stackoverflow.com/a/23795780
has title: Stopping Scanner in the end of the line
tagged with: java.util.scanner
type: Question
answer count: 2
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23795869

http://stackoverflow.com/q/23911834
linked to: http://stackoverflow.com/q/3700459
tagged with: if-statement
has answer: http://stackoverflow.com/a/23913167
has answer: http://stackoverflow.com/a/23913898
has comment: http://stackoverflow.com/comment/36821647
linked to: http://stackoverflow.com/q/159590
has comment: http://stackoverflow.com/comment/36821885
accepted answer: http://stackoverflow.com/a/23913167
answer count: 4
has body: I am working on my maze game and I've almost got the generating of the maze. The only problem I have is that when I try to run my init method, it gives me a stack overflow error. I think this has to do with the corStack getting too large, but I can't find the cause of this problem. Here's the code: The maze generating: public void carveMaze(Stack&lt;Integer&gt; corStack, int currentX, int currentY) { ArrayList&lt;Integer&gt; corList = getNeighbours(currentX, currentY); Random randomGen = new Random(); while (checkForUnvisited()) {enter code here if (corList.size() &gt; 0) { boolean goodNumber = false; int newY = 0; int newX = 0; int index = 0; index = randomGen.nextInt(corList.size()); if (index % 2 != 0) { newY = corList.get(index); goodNumber = true; } goodNumber = false; while (!goodNumber) { index = randomGen.nextInt(corList.size()); if (index % 2 == 0) { newX = corList.get(index); goodNumber = true; } } corStack.push(currentY); corStack.push(currentX); if (newX &gt; currentX) { maze[newY][newX - 1].setStatus(Cell.WEG); maze[newY][newX - 1].setVisited(true); maze[newY][newX].setVisited(true); } else if (newX &lt; currentX) { maze[newY][newX + 1].setStatus(Cell.WEG); maze[newY][newX + 1].setVisited(true); maze[newY][newX].setVisited(true); } else if (newY &gt; currentY) { maze[newY - 1][newX].setStatus(Cell.WEG); maze[newY - 1][newX].setVisited(true); maze[newY][newX].setVisited(true); } else if (newY &lt; currentY) { maze[newY + 1][newX].setStatus(Cell.WEG); maze[newY + 1][newX].setVisited(true); maze[newY][newX].setVisited(true); } maze[currentY][currentX].setVisited(true); currentX = newX; currentY = newY; carveMaze(corStack, currentX, currentY); } else { if (!corStack.isEmpty()) { currentX = (int) corStack.pop(); currentY = (int) corStack.pop(); carveMaze(corStack, currentX, currentY); } } } } The cell Class: package javaapplication23; public class Cell { public static final int SPELER = 2; public static final int WEG = 0; public static final int MUUR = 1; pu…
type: AnsweredQuestion
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/36821865
tagged with: maze
type: Question
possible better answer: http://stackoverflow.com/a/23912109
has comment: http://stackoverflow.com/comment/36822021
has answer: http://stackoverflow.com/a/23912109
has comment: http://stackoverflow.com/comment/36821561
has answer: http://stackoverflow.com/a/23912265
has title: Maze generating stackoverflow error
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36821262
has comment: http://stackoverflow.com/comment/36821723
has comment: http://stackoverflow.com/comment/36821487
has comment: http://stackoverflow.com/comment/36821501
has comment: http://stackoverflow.com/comment/36821400

http://stackoverflow.com/a/23822694
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: I've tried to search org.apache.struts.taglib.tiles.UseAttributeTei in a JAR Search and it shows that UseAttributeTei is only in struts-1.2.9.jar or lower versions. If you want this is the link to download struts-1.2.9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23822501
answers question: http://stackoverflow.com/q/23822501

http://stackoverflow.com/comment/36768573
type: AnswerComment
type: Comment
has text: Oh yes ! It does work if i exclude "and Metrics.Segment_ID IS NULL" from the query. now Metrics.Segment_ID contains numbers so is it valid to use NULL or should we use ' ' instead ?
score: 0
comment on: http://stackoverflow.com/a/23883660

http://stackoverflow.com/a/23813651
accepted answer of: http://stackoverflow.com/q/23812122
has body: The "new NewThread()" creates a new object, calling its constructor. The constructor starts a thread. Simple enough. The new Thread object remains "live" (i.e., it will not be garbage collected) as long as it continues to run because there is a reference to the Thread object from the thread's stack. The code contains the seed of a bug though. The NewThread constructor leaks "this". That is to say, it passes its "this" reference to another object (the new Thread object) which means that methods of the new Thread object potentially can see the NewThread before the NewThread has been completely initialized. That's probably a benign error in this case because the NewThread object doesn't appear to have any state, but in a more complicated program, leaking "this" from a constructor can have serious consequences.
answers question: http://stackoverflow.com/q/23812122
type: Answer
has comment: http://stackoverflow.com/comment/36781949
downvote count: 0
has comment: http://stackoverflow.com/comment/36688406
score: 1
has comment: http://stackoverflow.com/comment/36675628
upvote count: 1
has comment: http://stackoverflow.com/comment/36678821
type: AcceptedAnswer

http://stackoverflow.com/comment/36732427
comment on: http://stackoverflow.com/a/23826859
has text: You should add domain class with such fields like in database and after that you can manipulate with this table. For example for table with fields DOC_ID | ATTR_NAME | ATTR_VALUE - you create class like this: public class DomainClass { private Long id; private String name; private String value; getters and setters}. It will be your domain class for work with your table.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23902467
answers question: http://stackoverflow.com/q/23902449
has comment: http://stackoverflow.com/comment/36840142
has comment: http://stackoverflow.com/comment/36918737
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36828962
has comment: http://stackoverflow.com/comment/36883676
has comment: http://stackoverflow.com/comment/36908418
has comment: http://stackoverflow.com/comment/36869415
score: 1
has body: Use the key bindings API instead of KeyListeners, it provides better control over the focus level required to generate key events In order for KeyListener to generate a KeyEvent, the component it is registered to must be focusable AND have focus. There is no "easy" way to guarantee that a component can acquire/grab focus. You should also consider using a CardLayout to move between your screens, it what it was designed for and will make life a lot easier You should also call super.paintComponent to ensure that the component/Graphics context is prepared for painting
downvote count: 0

http://stackoverflow.com/a/26384255
score: 1
upvote count: 1
downvote count: 0
has body: I've solved this issue by adding this dependency on my POM: org.codehaus.groovy groovy-backports-compat23 2.3.5
answers question: http://stackoverflow.com/q/23829844
type: Answer

http://stackoverflow.com/q/23840887
has comment: http://stackoverflow.com/comment/36726153
upvote count: 1
possible better answer: http://stackoverflow.com/a/23840967
tagged with: collections
duplicate of: http://stackoverflow.com/q/2745265
type: AnsweredQuestion
has body: Making a API for internal use, I need some Java abstraction and I don't know how to do it. There is an Interface A with derived interfaces. Let's say one of the extended interfaces of A is called B. And let's say there is an class C implementing B. I have a Factory/Pool class F from which I want to get a list of instances (or set or similar collection). What I want is basically this: List&lt;B&gt; instances = F.getAllSuitableInstances(parameters); Get me all the instances specified by my parameters as a collection of B. First attempt was with this function signature public List&lt;A&gt; getAllSuitableInstances(parameters); but when I try to cast the resulting List to a List for use, I get told "incompatible types" - even though B is derived from A. So I tried what the java libraries do: public &lt;T&gt; List&lt;T&gt; getAllSuitableInstances(parameters, T); and try calling that with B as second parameter. But that doesn't work either, since T has to be supplied as an instance for some reason, and interfaces cannot have instances. I know I could use &lt;?&gt; with casting but I'd like to make this as typesafe as possible. So, what is the (best) way to get this done?
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23840918
type: Question
answer count: 2
tagged with: casting
downvote count: 0
has title: casting a Collection of derived Java interfaces (generics)
tagged with: generics
has answer: http://stackoverflow.com/a/23840967
has answer: http://stackoverflow.com/a/23840918
favorite count: 0
linked to: http://stackoverflow.com/q/2745265
tagged with: interface

http://stackoverflow.com/q/23812105
has comment: http://stackoverflow.com/comment/36635561
has body: In an effort to generate less boilerplate code I'm using lombok annotations. I had hoped to create even less boilerplate code by annotating a list of fields like so @Getter @Setter private String a, b, c, d, e ... z; But the annotation only appears to affect the first field in the list. Is there a way to make it affect the whole list without seperating it out like @Getter @Setter private String a; @Getter @Setter private String b; Note that I can't annotate the class as there are a bunch of fields that need limited access and and some fields that I only want getter access for. Basically, I'm looking for some analog in java to ruby's attr_accessor type list which is pretty awesome. UPDATE This is failing on the ant build with the 1.12.6 lombok. I tested a simple case with the 1.12.6 lombok version and it works. It's hard to tell where in my code this is being tickled as we use lombok extensively throughout the project and the stack trace doesn't mention anything in our code. java versions: jimi@Immaculate:/web/project/XXXXX.com$ javac -version javac 1.6.0-internal jimi@Immaculate:/web/project/XXXXX.com$ java -version java version "1.6.0" Java(TM) SE Runtime Environment (build pxi3260sr13ifix-20130303_02(SR13+IV37419)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr13-20130114_134867 (JIT enabled, AOT enabled) J9VM - 20130114_134867 JIT - r9_20130108_31100 GC - 20121212_AA) JCL - 20130303_02 Stack trace: [javac] Consult the following stack trace for details. [javac] java.lang.NullPointerException [javac] at java.util.IdentityHashMap$IdentityHashMapEntry.setValue(IdentityHashMap.java:135) [javac] at lombok.javac.apt.Processor.process(Processor.java:261) [javac] at lombok.core.AnnotationProcessor$JavacDescriptor.process(AnnotationProcessor.java:117) [javac] at lombok.core.AnnotationProcessor.process(AnnotationProcessor.java:167) [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:639) [ja…
score: 0
has answer: http://stackoverflow.com/a/23812431
answer count: 1
has comment: http://stackoverflow.com/comment/36658353
accepted answer: http://stackoverflow.com/a/23812431
has comment: http://stackoverflow.com/comment/37036970
has comment: http://stackoverflow.com/comment/36653066
has title: Annotating a list of fields instead of a single field with lombok v 0.9.2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36733606
has comment: http://stackoverflow.com/comment/36785432
has comment: http://stackoverflow.com/comment/36632990
type: Question
tagged with: lombok
has comment: http://stackoverflow.com/comment/36631949

http://stackoverflow.com/comment/36773335
type: Comment
type: QuestionComment
has text: 1. no issue in Win8, ent 64b, physical GPU (HP low_profile), stable JDK 17_021, funny JRE 17_051, 2. note ScrollMode is designatred just for Object(s) where parent is JViewPort, not (hasn't something with) JScrollPane
comment on: http://stackoverflow.com/q/23886275
score: 0

http://stackoverflow.com/a/23850767
score: 4
accepted answer of: http://stackoverflow.com/q/23850693
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: A Trolley&lt;?&gt; is a Trolley of a specific type but we don't know which type. It happens that in your code it may well be a Trolley&lt;Integer&gt; or a Trolley&lt;String&gt;. So the compiler can't let you add anything but null to that trolley because its actual type will only be determined at runtime. To make your code compile without too many changes you need to have one branch for Integer and one for String: public static void main(String args) { boolean numeric = false; if (numeric) { Trolley&lt;Integer&gt; trolley = new Trolley&lt;&gt;(); trolley.addItem(42); } else { Trolley&lt;String&gt; trolley = new Trolley&lt;&gt;(); trolley.addItem("42"); } }
has comment: http://stackoverflow.com/comment/36705369
type: Answer
answers question: http://stackoverflow.com/q/23850693
has comment: http://stackoverflow.com/comment/36705385

http://stackoverflow.com/comment/36597958
comment on: http://stackoverflow.com/a/23794378
type: Comment
has text: @Braj If you try to use something like String str = new String(null); then the compiler will complain
score: 0
type: AnswerComment

http://stackoverflow.com/a/23865254
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23864882
has body: You can iterate across JSON keys and with dynamic values and its contents like this: JSONObject json = new JSONObject(jsonStr); //jsonStr is your JSON Iterator&lt;String&gt; iter = json.keys(); while (iter.hasNext()) { String key = iter.next(); //gets the dynamic key Log.v("printlog","Dynamic Gps key: "+key); try { String content=json.getString(key); // gets contents from the dynamic key Log.v("printlog","Content: "+content); }catch (JSONException e) { }

http://stackoverflow.com/comment/75034431
type: AnswerComment
has text: `-keep Unsafe` makes no sense, it is a framework class.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23826357

http://stackoverflow.com/comment/36842284
has text: But when you construct an object, normally you assign it to a variable, like `People p = new People("foo", "bar", "baz");`. You can then use the variable p to reference the object you've created. If you have bunches of them, you usually put them in a `List<People>`, so that you can later loop through all of the `People` you've got.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23922568
type: QuestionComment

http://stackoverflow.com/comment/36674299
score: 0
type: AnswerComment
type: Comment
has text: i have a problem. i don't have a fix value of my array. it depends on what the user input including how many times they want to input. and the other thing is that based on your coding, i'll only need one array/object to hold my student id, name, and course. it'll look like this: Object[] o = { arrayStudent[i] }; i can't create 2nd object anymore because all the user inputted will go into arrayStudent. what if there's 10 input? will i need 10 objects to make it compare? or maybe i'm just thinking it wrong. @Mohammad
comment on: http://stackoverflow.com/a/23834447

http://stackoverflow.com/q/23823618
type: Question
upvote count: 2
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/23826692
has body: In JPA, can I map an Entity to a table where attributes of the entity are persisted across multiple rows? Basically, can I map a class like this: public Document { String id; String title; String author; String size; } To a table like CREATE TABLE DOC_METADATA ( DOC_ID NUMBER, ATTR_NAME VARCHAR, ATTR_VALUE VARCHAR ); With content like DOC_ID | ATTR_NAME | ATTR_VALUE 1 "title" "Alice in wonderland" 1 "author" "Lewis Carroll" 1 "size" "500kb" 2 "title" "Winnie the pooh" 2 "author" "A. A. Milne" 2 "size" "600kb"
tagged with: sql
downvote count: 1
has comment: http://stackoverflow.com/comment/36658757
has comment: http://stackoverflow.com/comment/36653458
favorite count: 0
has answer: http://stackoverflow.com/a/23826859
accepted answer: http://stackoverflow.com/a/23826859
has comment: http://stackoverflow.com/comment/36660903
tagged with: openjpa
possible better answer: http://stackoverflow.com/a/23826692
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36654834
score: 1
tagged with: java
has title: JPA: One entity mapped to multiple rows, is it possible?

http://stackoverflow.com/comment/36831893
score: 28
type: AnswerComment
has text: @AbdennourToumi Apart for the ease of scripting, meta-programming, dynamic types, AST transformations, data parsing, ease of DSL creation, and being able to Grab resources, you may be right ;-)
comment on: http://stackoverflow.com/a/23907672
type: Comment

http://stackoverflow.com/q/23869829
has body: I'm trying do a JOIN using CriteriaQuery to get informations of my database but returns an exception about unable to resolve attribute and doesn't work. I'm looking for solution but still haven't found. My code is below: @Entity @Table(name="cargo") public class Cargo implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer idCargo; @NotNull @NotEmpty @Column(unique=true) private String cargo; } @Entity @Table(name="curriculum") public class Curriculum implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long idCurriculum; @Transient @OneToOne @JoinColumn(name="idCurriculum") private Curriculum curriculum; @Temporal(TemporalType.DATE) private Date dataCad; @Size(min=5, max=50) @NotNull @NotEmpty private String nome; @NotEmpty private String sexo; @Email @NotEmpty @NotNull @Size(max=250) @Column(unique=true) private String email; @NotNull @NotEmpty @Size(min=14, max=14) @Column(unique=true) private String cpf; @NotEmpty @NotNull @Size(min=8, max=8) private String senha; @OneToOne//(cascade = CascadeType.ALL) @NotNull @JoinColumn(name="idCargo") private Cargo cargo; private String ativado = "N"; } @Entity @Table(name="curriculum2") public class Curriculum2 implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long idC2; //NOT NULL AUTO_INCREMENT, @NotNull @OneToOne(cascade=CascadeType.ALL,orphanRemoval=true) @JoinColumn(name="idCurriculum") private Curriculum curriculum; //NOT NULL, @NotNull @Temporal(TemporalType.DATE) private Date dataNasceu; //NOT NULL, @NotNull @NotEmpty @Size(min=5, max=50) private String cidade; //` varchar(50) NOT NULL, @NotNull @NotEmpty @Size(min=5, max=50) private String endereco; //` varchar(50) NOT NULL, @NotNull private int numero; //` int(11) NOT NULL, @NotNull @NotEmpty @Size(min=5, max=50) private String bairro; //` varchar(50) NOT NULL, private String complemento; //14.790-000 private St…
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/36754714
score: 0
has title: JOIN with CriteriaQuery?
answer count: 1
has comment: http://stackoverflow.com/comment/36741653
has comment: http://stackoverflow.com/comment/36744425
has comment: http://stackoverflow.com/comment/36754285
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/36753280
has answer: http://stackoverflow.com/a/23902476
accepted answer: http://stackoverflow.com/a/23902476
type: AnsweredQuestion
tagged with: java
tagged with: criteria-api
linked to: http://stackoverflow.com/q/787698

http://stackoverflow.com/comment/36657391
score: 0
type: Comment
type: QuestionComment
has text: the actual field of which you are trying to get and set the text? a JTextField, a JLabel, something like that, I suppose
comment on: http://stackoverflow.com/q/23825805

http://stackoverflow.com/q/23881319
has title: Hibernate Cache Update Mechanism
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23881671
has body: I want to know about the hibernate cache :- When we update the object in Cache does it automatically get updated in the database. If not then how will it get updated? If the database is updated will it get updated in cache instantaneously, if not then again how will it get updated?
tagged with: java
tagged with: hibernate
tagged with: orm
tagged with: caching
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23881782
tagged with: jpa
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/337072
type: UnansweredQuestion

http://stackoverflow.com/q/23817796
has comment: http://stackoverflow.com/comment/36642455
linked to: http://stackoverflow.com/q/3153337
has answer: http://stackoverflow.com/a/23817898
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/36642492
upvote count: 1
has comment: http://stackoverflow.com/comment/36642166
has comment: http://stackoverflow.com/comment/36642516
downvote count: 1
has body: I am working on a project, and I'm new to applets. I don't know how to find a file using these arguments. I know there is another question out there that is almost the same, but I want this in an easy, simplified way because I'm new to this. Any help would be awesome!!! Here is my code: import java.applet.Applet; import java.applet.AudioClip; import java.awt.Graphics; public class SoundDemo extends Applet { public void init() { AudioClip clip = getAudioClip( getCodeBase(), "sounds/Dragon Roost.wav" ); clip.play(); } public void paint( Graphics g ) { g.drawString( "Now Playing Clip", 10, 10 ); } }
has answer: http://stackoverflow.com/a/39193610
accepted answer: http://stackoverflow.com/a/23817898
has comment: http://stackoverflow.com/comment/36642127
possible better answer: http://stackoverflow.com/a/39193610
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36642150
has comment: http://stackoverflow.com/comment/36642219
tagged with: applet
has title: How do you use getDocumentBase() and getCodeBase() correctly in Java Applets?
has comment: http://stackoverflow.com/comment/36642469
favorite count: 0
has comment: http://stackoverflow.com/comment/36642193
type: Question

http://stackoverflow.com/a/23920622
score: 8
upvote count: 9
accepted answer of: http://stackoverflow.com/q/23920425
has comment: http://stackoverflow.com/comment/36840103
answers question: http://stackoverflow.com/q/23920425
type: Answer
has comment: http://stackoverflow.com/comment/36847163
has comment: http://stackoverflow.com/comment/36838644
has comment: http://stackoverflow.com/comment/36839961
has comment: http://stackoverflow.com/comment/36838818
type: AcceptedAnswer
has body: You do it like remainder from batch size and list size to find count. int batchSize = 10; int start = 0; int end = batchSize; int count = list.size() / batchSize; int remainder = list.size() % batchSize; int counter = 0; for(int i = 0 ; i &lt; count ; i ++) { System.out.println("counter " + counter); for(int counter = start ; counter &lt; end ; counter ++) { //access array as a[counter] } start = start + batchSize; end = end + batchSize; } if(remainder != 0) { end = end - batchSize + remainder; for(int counter = start ; counter &lt; end ; counter ++) { //access array as a[counter] } }
has comment: http://stackoverflow.com/comment/36839487
downvote count: 1

http://stackoverflow.com/q/23912903
has answer: http://stackoverflow.com/a/23913672
answer count: 1
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/36823535
tagged with: android
tagged with: simpleadapter
tagged with: http://stackoverflow.com/tag/xml
has title: System Service Not available Exception SimpleAdapter Android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36828231
has comment: http://stackoverflow.com/comment/36828714
has comment: http://stackoverflow.com/comment/36828161
has comment: http://stackoverflow.com/comment/36828669
tagged with: java
has body: Hello I am currently in the process of an application developed on Android, the principle is simple: Parsing an XML file, and then fill in the information in a listview. I understand how to parse my XML file, but I'm stuck on creating the listview .. I think I look at all the tutorials on filling listview x) Only I can not fit the tutorials on my application because I have a navigation tab so with fragments. I often saw the need to establish a simpleAdapter and used the layout "simple_list_item_2". but I do not understand how this system. Here is my code who parses my info in an ArrayList: public class ListParseAdapter extends ListActivity{ String data; String URL = ""; String ITEM = "item"; String TITRE = "title"; String DESCRIPTION = "description"; String LIEN = "link"; final String[] fromMapKey = {"TITRE", "DESCRIPTION"}; final int[] toLayoutId = {android.R.id.text1, android.R.id.text2}; HashMap&lt;String, String&gt; map; public ListParseAdapter(String pUrl) { URL = pUrl; map = new HashMap&lt;String, String&gt;(); } public void chargement(){ XMLParser file = new XMLParser(); data = file.getXmlFromUrl(URL); Document doc = file.getDomElement(data); NodeList NbItem = doc.getElementsByTagName(ITEM); ArrayList&lt;HashMap&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); for (int i = 1; i &lt; NbItem.getLength(); i++) { // creating new HashMap Element e = (Element) NbItem.item(i); // adding each child node to HashMap key =&gt; value map.put(TITRE, file.getValue(e, TITRE)); map.put(DESCRIPTION, file.getValue(e, DESCRIPTION)); map.put(LIEN, file.getValue(e, LIEN)); // adding HashList to ArrayList menuItems.add(map); } // Adding menuItems to ListView SimpleAdapter adapter = new SimpleAdapter(this, menuItems,R.layout.simple_list_item_2, fromMapKey, toLayoutId); setListAdapter(adapter); } } My Fragment_agenda.xml : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android…
has comment: http://stackoverflow.com/comment/36826553
has comment: http://stackoverflow.com/comment/36828891
type: Question
has comment: http://stackoverflow.com/comment/36828834

http://stackoverflow.com/comment/36825760
comment on: http://stackoverflow.com/q/23913880
score: 0
type: Comment
type: QuestionComment
has text: i want the arrow to be GONE or VISIBLE and the textview be alignParentLeft if the arrow is gone or toRightOf if the arrow is VISIBLE. At first i call the method to make the arrow disapear (that's why in the xml the textview is alignParentLeft)

http://stackoverflow.com/comment/36733018
score: 0
comment on: http://stackoverflow.com/q/23864843
type: Comment
type: QuestionComment
has text: Didn't get what exact problem you are looking for? May be explain a bit more?

http://stackoverflow.com/comment/36588516
type: AnswerComment
score: 0
type: Comment
has text: i fixed it, it was originally rs. The problem is still there.
comment on: http://stackoverflow.com/a/23789569

http://stackoverflow.com/comment/70709075
has text: @JohnNaegle Wow. Yeah, refresh and everything is gone. ( that took an hour and half to diagnose ). Thank god for your comment. I've tried relogging and incognito, same result => No real save seems to happen. Was there something you did in particular?
comment on: http://stackoverflow.com/q/23928758
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23876734
has answer: http://stackoverflow.com/a/23980907
type: AnsweredQuestion
has body: I'm trying to access the PlaneXML wsdl service (provides realtime info on flights). As part of the learning process, I've successfully created a client and connected to an open service for stock price info, and that works great. The PlaneXML service requires authentication - I have my credentials, but I can't figure out how to offer them up. I've searched through the client that Eclipse produced from the WSDL but can't find any sign of where to put them. Can I infer this information from the WSDL file? http://planexml.flightwise.com/ws/PlaneXMLv1.asmx?WSDL Hopefully someone can put me on the right track.
tagged with: java
score: 0
tagged with: web-services
accepted answer: http://stackoverflow.com/a/23980907
type: Question
has title: Passing user/pwd credentials to (PlaneXML) WSDL service
tagged with: wsdl
answer count: 1

http://stackoverflow.com/comment/36601552
comment on: http://stackoverflow.com/q/23796312
type: Comment
type: QuestionComment
score: 1
has text: Do `new OneDataCached().stopThread()` to get the behavior you want. Right now, you are still checking for `OneDataCached.bool` but modifying `One.bool`.

http://stackoverflow.com/a/59501119
downvote count: 0
score: 3
has body: The nonce and the digest of the password should be constructed, as it done in the snippet below. Please, note the order of the elements, and the fact that the non-encoded version of the nonce is used for passwordDigest construction. import javax.xml.datatype.*; import java.security.*; import java.time.Instant; import java.util.Base64; import static java.lang.System.currentTimeMillis; import static java.nio.charset.StandardCharsets.UTF_8; class Snippet { private static final SecureRandom RANDOM; private static final int NONCE_SIZE_IN_BYTES = 16; private static final String MESSAGE_DIGEST_ALGORITHM_NAME_SHA_1 = "SHA-1"; private static final String SECURE_RANDOM_ALGORITHM_SHA_1_PRNG = "SHA1PRNG"; static { try { RANDOM = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM_SHA_1_PRNG); RANDOM.setSeed(currentTimeMillis()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } public static void main(String[] args) throws DatatypeConfigurationException { final var nonceBytes = generateNonce(); final var password = "password"; final var createdDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(Instant.now().toString()); final var passwordDigestBytes = constructPasswordDigest(nonceBytes, createdDate, password); final var base64Encoder = Base64.getEncoder(); final var nonceBase64Encoded = base64Encoder.encodeToString(nonceBytes); final var passwordDigestBase64Encoded = base64Encoder.encodeToString(passwordDigestBytes); System.out.println(String.format("nonce: [%s], password digest: [%s]", nonceBase64Encoded, passwordDigestBase64Encoded)); System.out.flush(); } private static byte[] generateNonce() { var nonceBytes = new byte[NONCE_SIZE_IN_BYTES]; RANDOM.nextBytes(nonceBytes); return nonceBytes; } /** * @noinspection SameParameterValue */ private static byte[] constructPasswordDigest(byte[] nonceBytes, XMLGregorianCalendar createdDate, String password) { try { final var sha1MessageDigest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM_NAME_SHA_1…
upvote count: 3
answers question: http://stackoverflow.com/q/23919680
has comment: http://stackoverflow.com/comment/135250964
type: Answer

http://stackoverflow.com/a/23923484
answers question: http://stackoverflow.com/q/23851737
score: 1
has comment: http://stackoverflow.com/comment/36862789
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23851737
has body: The approach mentioned in the comments, implemented with JGraphT: It simply iterates over all edges, removes each edge temporarily, and checks whether the vertices of the edge are still connected (using a simple Breadth-First-Search). If they are no longer connected, then the edge is added to the result set (before it is re-inserted into the graph). This is rather trivial, so I assume that there is a more sophisticated solution. Particularly the checks for the existence of a path (even with a simple BFS) might become prohibitively expensive for "larger" graphs. EDIT: Extended the code with a first attempt (!) of implementing the topological constraint that was mentioned in the original question. It basically follows the same concept as the simple approach: For each edge, it checks whether the vertices of the edge are still connected if the edge was removed. However, this check whether the vertices are connected is not done with a simple BFS, but with a "constrained" BFS. This BFS skips all vertices whose topological index is greater than the topological index of the end vertex of the edge. Although this delivers the same result as the simple approach, the topological sort and the implied constraint are somewhat brain-twisting and its feasibility should be analyzed in a more formal way. This means: I am NOT sure whether the result is correct in every case. IF the result is correct, it could indeed be more efficient. The program prints the number of vertices that are scanned during the simple BFS and during the constrained BFS. The number of vertices for the constrained BFS is lower, and this advantage should become greater when the graph becomes larger: The simple BFS will basically always have have to scan all edges, resulting in the worst case of O(e), and a complexity of O(e*e) for the whole algorithm. The complexity of the topological sorting depends on the structure of the graph, but should be linear for the graphs in question. However, I did not explicitly anal…
has comment: http://stackoverflow.com/comment/36883587
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36844049

http://stackoverflow.com/a/23801211
accepted answer of: http://stackoverflow.com/q/23798679
downvote count: 0
has comment: http://stackoverflow.com/comment/36611551
has comment: http://stackoverflow.com/comment/36612928
has comment: http://stackoverflow.com/comment/36610809
score: 7
has body: It actually can be done. The generic code between &lt;>'s is fine. It's not different for methods and classes. Just needed to finish doing the dependency injection: public class Activate&lt;D extends CanQuack &amp; CanWalk&gt; { private D d; Activate(D d) { this.d = d; } void doDuckLikeThings() { d.quack(); d.walk(); //d.swim(); //Doesn't work //And shouldn't since that was the whole point of ISP. } } public class MainClass { public static void main(String[] args) { Activate&lt;MyWaterFowl&gt; a = new Activate&lt;&gt;(new MyWaterFowl()); a.doDuckLikeThings(); } } Thought I'd provide an answer that says what to do to fix it.
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36611680
answers question: http://stackoverflow.com/q/23798679
has comment: http://stackoverflow.com/comment/36611414
type: Answer

http://stackoverflow.com/comment/36606895
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23799186
type: Comment
has text: I used the code in suggested way but it causing infinite loop and I am unable to select my item from list. removeAllElements() is again firing an event which is causing an infinite loop.

http://stackoverflow.com/a/23895288
answers question: http://stackoverflow.com/q/23895174
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: You need to close writer instead of output. The BufferedWriter may not be writing all of the lines, and won't since you never close it.

http://stackoverflow.com/q/23825554
tagged with: spring
has title: Suggest web reporting tool for Spring, JSP
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23873074
tagged with: report
upvote count: 1
type: Question
has body: I am currently working on the reporting module of a Spring/JSP/Hibernate based web application and want to know which reporting tool would be best for my application. Please suggest.
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23873074
answer count: 1
downvote count: 0
favorite count: 0
tagged with: reporting

http://stackoverflow.com/a/23927074
answers question: http://stackoverflow.com/q/23849779
downvote count: 0
score: 1
type: Answer
has body: ClientGUI class must have a reference to the Channel to communicate via. Assuming that you also have a reference to the ClientGUI instance somewhere and the Channel is created after GUI is initialized, you could add some setter to ClientGUI: public class ClientGUI { private volatile Channel channel; public void setChannel(Channel channel) { this.channel = channel; } public void sentMessage(String msg) { channel.writeAndFlush(msg); } ... }
upvote count: 1

http://stackoverflow.com/q/23917743
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/12871850
has comment: http://stackoverflow.com/comment/36894069
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36832733
has comment: http://stackoverflow.com/comment/36832682
type: Question
has body: The hack that developers have used in the past to allow a Hardware and Software menu button in the ActionBar, is: try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { e.printStackTrace(); } Results in: java.lang.NoSuchFieldException: sHasPermanentMenuKey So the hack doesn't work anymore, an alternative? Edit: So the hack never worked for &lt; Android 4.2, an alternative (without creating the button yourself)? (I don't want to start another discussion as in How To Control use of OverFlow Menu in ICS about pros and cons of this approach)
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36832821
has comment: http://stackoverflow.com/comment/36833727
has comment: http://stackoverflow.com/comment/36834015
favorite count: 0
has title: java.lang.NoSuchFieldException: sHasPermanentMenuKey

http://stackoverflow.com/a/23894153
downvote count: 0
answers question: http://stackoverflow.com/q/23882032
type: Answer
score: 14
upvote count: 14
has body: There is no protocol as such that is mentioned in the JMS specs. It is purely dependent on the JMS provider and his approach to offer efficiency and security.One thing that er can be sure of is that whatever protocol provider uses to communicate between server and client will be built upon the TCP/IP protocol(Transport layer). You may have HTTP which is an application layer protocol or if the provider provides it you may have SSL which is a Presentation layer protocol. For example ActiveMQ supports following protocols AMQP List item MQTT OpenWire REST RSS and Atom Stomp WSIF WS Notification XMPP More details here.

http://stackoverflow.com/comment/36580405
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23784765
has text: You could parse integers from the string then use those to set the parts of the dates you need one by one utilizing the Calendar.set(x, y) method. But as the one of the comments above me said that should work as you expect.

http://stackoverflow.com/a/23824339
type: Answer
has body: If you want a solution that works with non-RandomAccess lists as well, you can write yourself a simple utility method: public static &lt;T&gt; void forEach(List&lt;T&gt; list, BiConsumer&lt;Integer,? super T&gt; c) { Objects.requireNonNull(c); if(list.isEmpty()) return; if(list instanceof RandomAccess) for(int i=0, num=list.size(); i&lt;num; i++) c.accept(i, list.get(i)); else for(ListIterator&lt;T&gt; it=list.listIterator(); it.hasNext(); ) { c.accept(it.nextIndex(), it.next()); } } Then you can use it like: forEach(list, (i,s)-&gt;System.out.println(i+"\t"+s)); If you swap the order of element and index, you can use an ObjIntConsumer instead of BiConsumer&lt;Integer,? super T&gt; to avoid potential boxing overhead: public static &lt;T&gt; void forEach(List&lt;T&gt; list, ObjIntConsumer&lt;? super T&gt; c) { Objects.requireNonNull(c); if(list.isEmpty()) return; if(list instanceof RandomAccess) for(int i=0, num=list.size(); i&lt;num; i++) c.accept(list.get(i), i); else for(ListIterator&lt;T&gt; it=list.listIterator(); it.hasNext(); ) { c.accept(it.next(), it.previousIndex()); } } Then, to be used like forEach(list, (s,i) -&gt; System.out.println(i+"\t"+s));…
score: 4
answers question: http://stackoverflow.com/q/23817840
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/36847909
has text: Yes, I know. Good that you've fixed that too.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23925630

http://stackoverflow.com/q/23874988
downvote count: 0
answer count: 1
has title: JPQL: error compiling - state field 'e.e2.e3' cannot be resolved to a valid type
favorite count: 0
accepted answer: http://stackoverflow.com/a/23876326
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23876326
type: Question
tagged with: jpa-2.1
tagged with: jpql
has body: I have this error that i can not solve. Exception Description: Problem compiling [SELECT e FROM ResourceGroup e WHERE e.aclUserResourceGroups.userGroup=:userGroup AND e.aclUserResourceGroups.canView=:canView]. [36, 69] The state field path 'e.aclUserResourceGroups.userGroup' cannot be resolved to a valid type. [87, 118] The state field path 'e.aclUserResourceGroups.canView' cannot be resolved to a valid type. NamedQuery: SELECT e FROM ResourceGroup e WHERE e.aclUserResourceGroups.userGroup=:userGroup AND e.aclUserResourceGroups.canView=:canView ERD: Entities: @Entity @Table(name="resource_group") public class ResourceGroup implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; @Column(unique=true) private String name; @OneToMany(mappedBy = "resourceGroup", cascade = CascadeType.ALL, fetch=FetchType.LAZY, orphanRemoval=true) @JoinColumn(name = "resourcegroup_id") private List&lt;UserGroupResourceGroup&gt; aclUserResourceGroups; } Join entity: @Entity @Table(name="user_group_resource_group") public class UserGroupResourceGroup implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; @ManyToOne(targetEntity = UserGroup.class, cascade = CascadeType.PERSIST, fetch=FetchType.LAZY) @JoinColumn(name="usergroup_id") private UserGroup userGroup = new UserGroup(); @ManyToOne(targetEntity = ResourceGroup.class, cascade = CascadeType.PERSIST, fetch=FetchType.LAZY) @JoinColumn(name="resourcegroup_id") private ResourceGroup resourceGroup = new ResourceGroup() } UserGroups: @Entity @Table(name="user_group") public class UserGroup implements Serializable{ @OneToMany(mappedBy="userGroup", fetch=FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "usergroup_id") private List&lt;AccessControlList&gt; acl; @OneToMany(mappedBy="userGroup", fetch=FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "usergroup_id") private List&lt;UserGroupResourceGroup&gt; aclUserResourceGroups; } DAO: @Overri…

http://stackoverflow.com/comment/36858473
comment on: http://stackoverflow.com/a/23931510
has text: In classpath where? JBoss or app? Also I'm using JBoss datasource to connect.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36601065
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23796154
has text: Noted, learning bout that.
score: 0

http://stackoverflow.com/q/23810352
tagged with: angularjs
has body: I am trying to upload a file using angularjs and spring MVC I have a multipartResolver bean in application-context.xml. <mvc:annotation-driven /> <property name="maxUploadSize" value="2097152" /> my form look like this: Quote Identifier : Choose Please upload the file : * Valid File Invalid File Continue $scope.continueFileUpload=function (){ var uploadUrl=serverUrl+"continueFileUpload"; var formData=new FormData(); formData.append("file",file.files[0]); $http({ method: 'POST', url: uploadUrl, headers: {'Content-Type': false}, data: formData, transformRequest: function(data, headersGetterFunction) { return data; } }) .success(function(data, status) { alert("success"); }) }; spring controller: @Controller public class FileUploadController { @RequestMapping(value = "/continueFileUpload", method = RequestMethod.POST) @ResponseBody public String continueFileUpload(HttpServletRequest request, HttpServletResponse response){ MultipartHttpServletRequest mRequest; try { mRequest = (MultipartHttpServletRequest) request; mRequest.getParameterMap(); Iterator<String> itr = mRequest.getFileNames(); while (itr.hasNext()) { MultipartFile mFile = mRequest.getFile(itr.next()); String fileName = mFile.getOriginalFilename(); System.out.println(fileName); } } catch (Exception e) { e.printStackTrace(); } return null; } When I add multipart/form-data for the header I get **the request was rejected because no multipart boundary was found** exceptions If I didnt add I get org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25892226
has title: how to upload a multipart file using angular js spring mvc
tagged with: java
upvote count: 10
type: Question
possible better answer: http://stackoverflow.com/a/44026462
has answer: http://stackoverflow.com/a/44026462
score: 10
accepted answer: http://stackoverflow.com/a/25892226
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36863384
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23930312
has text: @MehulJoisar: I think not. You can have Dec 30th and Jan 1st in the same week (will be 52 or 1), but in different years. So checking for same year won't work.

http://stackoverflow.com/comment/36796123
comment on: http://stackoverflow.com/q/23898218
type: Comment
type: QuestionComment
score: 0
has text: Try using getClass().getResource("/res/enterprise1.png")

http://stackoverflow.com/comment/36838093
has text: Python has the same bitwise operators as the languages you already know. The primary difference is built-in bignums, which will require a few extra masks here and there if you need left shifts to discard bits.
score: 0
comment on: http://stackoverflow.com/q/23920431
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23927296
accepted answer of: http://stackoverflow.com/q/23927054
answers question: http://stackoverflow.com/q/23927054
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36851689
type: Answer
has comment: http://stackoverflow.com/comment/36851591
has comment: http://stackoverflow.com/comment/36851249
score: 2
has body: You're extending ArrayList (which you should never do), and breaking its contract. You override contains() by saying that your list contains a given object if this object is a HashMap and happens to contain the same value for the "part_no" key as another map in the list. But you don't override remove(). And remove() keeps using the ArrayList's method, which removes the element in the list that is equal to the object passed as argument. Don't, ever, extend the collection classes. Instead, wrap them inside your own class. To implement the remove method, you'll probably have to iterate over the list, find the map in the list which has the same value for the "part_no" key as the map passed as argument, and remove that map from the list. I have the suspicion that you're using Maps where you should define your own class ad well, but that doesn't change much. Here's the skeleton of the class that you should have. You should figure out the implementation by yourself based on the above indications: public class PurchaseOrderWrapper { private List&lt;Map&lt;String, String&gt;&gt; list = new ArrayList&lt;&gt;(); public boolean containsElementWithSamePartNoAs(Map&lt;String, String&gt; map) { // iterate over the list and find if an element has the same part_no // as the map passed as argument } public void removeElementWithSamePartNoAs(Map&lt;String, String&gt; map) { // iterate over the list and find the element which has the same part_no // as the map passed as argument. Once found, remove this element from the list } }

http://stackoverflow.com/comment/36701716
comment on: http://stackoverflow.com/a/23833511
score: 0
type: AnswerComment
type: Comment
has text: @Boann is right. There is no need to threw the exceptions to get the stacktrace. I am never threwing my exceptions. Just logging them in the place. It was a bug in code (sending null instead of the throwable object to logger). After fixing it I am getting stack trace without prolem and without throwing them.

http://stackoverflow.com/comment/36746124
score: 0
has text: `use one frame and many panels` - if this is the suggestion you found interesting, I would also suggest you follow the tips given by @AndrewThompson. From my mediocre experience level, he seems to give a really good nudge in the right direction.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23871508

http://stackoverflow.com/a/23815392
upvote count: 3
answers question: http://stackoverflow.com/q/23815344
has body: You are seeing some irregularities on how polymorphism is applied in Java. Polymorphism is seen where invoking a.print() invokes B's print(), while this is not the case for fields. The field is tied to the reference, so in this case b.x and a.x are distinct (although you could leave out x in B's definition and have a single field declared in the superclass. In that case, a form of hiding is seen.
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/comment/36611577
comment on: http://stackoverflow.com/a/23793861
type: Comment
has text: This is exactly what I am doing and actually it helps me, so thanks a lot. I forgot I already had the object in my response, long day yesterday. But generally do you know if it's however possible to unmarshall an InputStream from the request body?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36739112
has text: How is that premature?
comment on: http://stackoverflow.com/a/23868776
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23878658
has comment: http://stackoverflow.com/comment/36758864
has comment: http://stackoverflow.com/comment/36758534
has comment: http://stackoverflow.com/comment/36758681
upvote count: 2
has comment: http://stackoverflow.com/comment/36758886
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36758760
has comment: http://stackoverflow.com/comment/36758816
type: Answer
has body: I need an explanation of what is going on "behind-the-scenes" between hibernate and SpringMVC : There is no hibernate yet. You are simply mapping a plain bean (model) to a JSP using Spring MVC. I know that I need a PropertyEditor or BeanWrapper. : You don't need a PropertyEditor at this stage. PropertyEditor is used for advanced type conversion like when you want an incoming date string "dd-mm-yyyy Zone" to be converted into a java.util.Date object and vice versa. I wonder why doesn't Spring make the necessary conversions since I explicitely create Author in my controller method? Shouldn't its values be automatically resolved and set after the page submission? :Spring will automatically resolve if the JSP fields are mapped to the model attribute correctly using Spring Form tags. In your case, JSP form fields are not mapped to the model correctly and it should be as below <form:form method="POST" modelAttribute="poem" action="${pageContext.request.contextPath}/poem/add.html"> Title: <form:input path="poem.title" title="Your poem's title" type="text" class="input" /> Author: <form:input path="poem.author.name" title="Author's name" type="text" class="input" /> Text: <form:textarea path="poem.body" title="Your poem goes here" rows="15" cols="50" class="input" /> </form:form> You can add many attributes to the model but you can attach only one model attribute to the and not two. Your controller would look like this. @RequestMapping(value = "/poem/add", method = RequestMethod.GET) public ModelAndView addPoemPage() { ModelAndView modelAndView = new ModelAndView("poem-add"); Author author = new Author(); Poem poem = new Poem(); poem.setAuthor(author); modelAndView.addObject("poem", new Poem()); return modelAndView; } @RequestMapping(value = "/poem/add", method = RequestMethod.POST) public ModelAndView addingPoem(@ModelAttribute("poem") Poem poem) { ModelAndView modelAndView = new ModelAndView("home"); authorService.addAuthor(poem.getAuthor); poemService.addPoem(poem); retu…
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36758645
accepted answer of: http://stackoverflow.com/q/23877884
answers question: http://stackoverflow.com/q/23877884

http://stackoverflow.com/comment/36800748
type: Comment
type: QuestionComment
has text: Are those supposed to be `class ElemDrzewa<T>` and `public class Drzewo<T>`? Or should the extra `>` characters be removed? I tried it the first way and I think I'm getting errors in different locations than you're getting.
comment on: http://stackoverflow.com/q/23900561
score: 0

http://stackoverflow.com/comment/36842830
has text: @MadProgrammer perfect works like a dream, thanks! If you'd like to put it in as an answer I can close this thread off, if that matters. If it doesn't then no worries.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23922276

http://stackoverflow.com/q/23932904
answer count: 1
has comment: http://stackoverflow.com/comment/36865894
has body: The SSSCE for the problem i face is posted below import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.DefaultTableModel; public class TableTest extends JFrame{ private static final long serialVersionUID = 1L; private JPanel panel; private JPanel buttonPanel; private JTable table; private JTable headerTable; JButton cancelButton; private DefaultTableModel tableModel; private DefaultTableModel headerTableModel; String fileName = null; public TableTest() { init(); } public void init() { setTitle("Table"); //Panel panel = new JPanel(); panel.setLayout(new GridBagLayout()); this.getContentPane().add(panel); buttonPanel = new JPanel(); //cancel button cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); buttonPanel.add(cancelButton); String[] headerNames = {"", "Col 1", "Col 2", "Col 1", "Col 2"}; String[] mainHeaderNames = {"Header 1", "Header2"}; headerTableModel = new DefaultTableModel(); for (int i = 0; i &lt; mainHeaderNames.length; i++) { headerTableModel.addColumn(mainHeaderNames[i]); } //table model tableModel = new DefaultTableModel() { private static final long serialVersionUID = 1L; public boolean isCellEditable(int row, int column) { if(column == 0){ return true; } else { return false; } } public Class&lt;?&gt; getColumnClass(int columnIndex) { switch (columnIndex) { case 0: return Boolean.class; } return null; } }; //set default model to the table table = new JTable(tableModel); headerTable = new JTable(headerTableModel); // set table …
accepted answer: http://stackoverflow.com/a/23933345
type: AnsweredQuestion
has title: JTable multiple Row header
tagged with: swing
type: Question
tagged with: java
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/23933345

http://stackoverflow.com/a/23897889
score: 1
answers question: http://stackoverflow.com/q/23897829
upvote count: 1
type: Answer
has body: No, they are not necessarily the same value. An int and a float are each 32 bits but in a float some of those bits are used for the floating point part of the number so there are fewer whole numbers which can be represented in a float than in an int. Depending on what your application is doing with these numbers you may not care about these differences or maybe you want to look at using something like BigDecimal.
downvote count: 0

http://stackoverflow.com/q/23927887
possible better answer: http://stackoverflow.com/a/23928228
has answer: http://stackoverflow.com/a/23928228
favorite count: 0
has answer: http://stackoverflow.com/a/23928024
has title: What is the difference between getFirst() and peekFirst() in Java's LinkedList?
has comment: http://stackoverflow.com/comment/36852681
answer count: 4
has answer: http://stackoverflow.com/a/23928325
type: AnsweredQuestion
upvote count: 19
tagged with: linked-list
has comment: http://stackoverflow.com/comment/36851711
tagged with: java
has comment: http://stackoverflow.com/comment/36851833
downvote count: 1
accepted answer: http://stackoverflow.com/a/23928024
type: Question
has answer: http://stackoverflow.com/a/76808724
has comment: http://stackoverflow.com/comment/36851665
score: 18
has body: In Java's LinkedList implementation, I see two methods which seems to me like having identical functions. getFirst() --Returns the first element in this list. peekFirst() --Retrieves, but does not remove, the first element of this list, or returns null if this list is empty. Both of them get the pointer to the First element in the LinkedList without making any changes to it. Then, what's the difference ? The only difference I see is that peekFirst returns null if the list is empty and getFirst throws a NoSuchElementException if the list is empty. What was the use of such a design pattern ?

http://stackoverflow.com/comment/36686838
comment on: http://stackoverflow.com/a/23841004
has text: correct. thanks though. I will give you an upvote after I find the answer to my question :) want to wait tho so others dont think i have it yet
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23835386
score: 0
answer count: 1
has body: I have an Android app that displays a list using a ListView, and there's an action bar button to clear said list. I decided to add a confirmation dialog so people don't accidentally delete all their entries, and I'm running into problems. If I use setListAdapter inside the onclick for the "yes" button within the dialog, it won't compile. If I use it outside that onclick, it'll work but not refresh the list until the user backs out of the activity and goes back into it, which for obvious reasons is not appropriate. Here's my method that gets called when the "clear list" action bar button is pressed, which contains the relevant onclick for the internal buttons. I have a feeling I shouldn't be using "this" in setListAdapter since with the dialog, this no longer corresponds to the listview activity I think? But I'm not sure what to put instead. public void clearTrigger(MenuItem item) { //Set up a dialog with two buttons to verify that the user really wants to delete everything confirm = new Dialog(display.this); confirm.setContentView(R.layout.conf); confirm.setTitle("Confirm deletion"); yes = (Button)confirm.findViewById(R.id.yes); //If the user says yes, then delete everything yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Remove everything from Hours. Hours.clear(); String tempH = " "; String tempW = " "; //Then save it again in it's new, empty state so that it doesn't reappear the next time the app is run. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); SharedPreferences.Editor edit = prefs.edit(); edit.putString("SAVEDATA", TextUtils.join(",", Hours)); edit.remove("totalh"); edit.remove("totalw"); edit.commit(); //And finally... refresh the list view - doesn't work setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.activity_list, R.id.listText, Hours)); confirm.dismiss(); } }); confirm.show(); }
has comment: http://stackoverflow.com/comment/36675395
tagged with: android
has answer: http://stackoverflow.com/a/23835482
accepted answer: http://stackoverflow.com/a/23835482
type: AnsweredQuestion
has title: How to refresh a listadapter from within an onclick
type: Question
tagged with: java

http://stackoverflow.com/comment/36656902
type: Comment
has text: I know but I don't know how just can't figure. Dumb(I guess?)
comment on: http://stackoverflow.com/a/23823631
type: AnswerComment
score: 0

http://stackoverflow.com/q/23889480
tagged with: java
has answer: http://stackoverflow.com/a/23889579
tagged with: concurrency
linked to: http://stackoverflow.com/q/3479043
tagged with: collections
has title: Why doesn't exist not concurrent version of SkipList
has answer: http://stackoverflow.com/a/23890013
linked to: http://stackoverflow.com/q/9133987
type: Question
downvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36778979
favorite count: 0
has body: I began research ConcurrentSkipListSet. From begining I tried to understand what does SkipList is ? I imagine it so(possible variant): I have 2 questions: How does SkipList relates with Concurrency ? Why does not exis not Concurrent variant of this data structure?
upvote count: 2
type: UnansweredQuestion
tagged with: skip-lists
score: 2
has comment: http://stackoverflow.com/comment/36779061

http://stackoverflow.com/q/23789829
has answer: http://stackoverflow.com/a/23790471
has body: Consider the following code fragment String strings[] = {"test"}; final List&lt;String&gt; collect = java.util.Arrays.stream(strings).collect(java.util.stream.Collectors.toList()); final Double[] array = java.util.Arrays.stream(strings).toArray(Double[]::new); Why can Java guarantee the correct type in the collect-case (changing the generic type of collect to e.g. Double leads to a compile time error), but not in the array case (compiles fine, despite apply(int) of Double[]::new gives a Double[], not an Object[], but throws ArrayStoreException if used incorrectly as above)? What would be the best way to generate a compile time error in case I change the type of the stream without changing the given IntFunction in the toArray call?
type: AnsweredQuestion
tagged with: types
downvote count: 0
accepted answer: http://stackoverflow.com/a/23790471
favorite count: 0
type: Question
tagged with: java-8
score: 18
tagged with: java-stream
tagged with: java
upvote count: 18
answer count: 1
has title: Why is `Stream.collect` type-safe and `Stream.toArray(IntFunction<A[]>)` is not?

http://stackoverflow.com/a/23843452
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23843262
has body: Copied from Strip whitespace from jsp output There is a trimWhiteSpaces directive that should accomplish this, In your JSP: <%@ page trimDirectiveWhitespaces="true" %> Or in the jsp-config section your web.xml (Note that this works starting from servlet specification 2.5.): *.jsp <trim-directive-whitespaces>true</trim-directive-whitespaces> Unfortunately if you have a required space it might also need strip that, so you may need a non-breaking space in some locations.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23843262
score: 4

http://stackoverflow.com/comment/68978205
type: Comment
comment on: http://stackoverflow.com/a/23954699
score: 0
type: AnswerComment
has text: i want to ask regarding above. I have implemented same. But now wondering how to implement click listeners on drawer item? As for the drawer we are passing fragment

http://stackoverflow.com/comment/36968139
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23837728
has text: @Konstantin Solomatov: AWT is thread safe if used correctly. But you can’t tell from a single method whether this program uses AWT correctly. If two threads are painting to the same image concurrently, the result will still be unpredictable. As you said in your answer, you simply don’t know which thread invokes `buff()` and hence, whether the update will propagate to the thread invoking `paintCircle(…)`. The same applies to the relationship between the thread invoking `paintCircle(…)` and the possibly existing thread trying to paint that image to the screen. As I said *we simply don’t know*.

classpath
tags question: http://stackoverflow.com/q/23890414
tags question: http://stackoverflow.com/q/23896886
tags question: http://stackoverflow.com/q/23919485
tags question: http://stackoverflow.com/q/23798953
tags question: http://stackoverflow.com/q/23891537
tags question: http://stackoverflow.com/q/23901735
tags question: http://stackoverflow.com/q/23812478
tags question: http://stackoverflow.com/q/23825193
tags question: http://stackoverflow.com/q/23830151
type: Tag
tags question: http://stackoverflow.com/q/23873460
tag name: classpath
tags question: http://stackoverflow.com/q/23780147

http://stackoverflow.com/a/50303331
downvote count: 0
answers question: http://stackoverflow.com/q/23874795
type: Answer
score: 1
upvote count: 1
has body: I have solved the question. You should use absolute paths when referencing FXML files. Just like this : Parent root = FXMLLoader.load(getClass().getResource("/Hos/Hospital.fxml"));

http://stackoverflow.com/comment/36658353
has text: Yeah, the NPE was coming from Lombok. We are still using IBM's jdk6 for this legacy app. I can probably re-install 1.12.6 and get you a stack trace, if you like.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23812105
score: 0

http://stackoverflow.com/comment/36868339
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23936722
type: QuestionComment
has text: Is this actually a `.jar` file? Perhaps Windows displays it as an "executable Java file"?

http://stackoverflow.com/q/23930905
has answer: http://stackoverflow.com/a/23931568
has title: Splitting Huge File into multiple files by date and time
score: -2
has comment: http://stackoverflow.com/comment/36856898
upvote count: 0
has comment: http://stackoverflow.com/comment/36857561
answer count: 1
has comment: http://stackoverflow.com/comment/37554510
favorite count: 0
accepted answer: http://stackoverflow.com/a/23931568
has comment: http://stackoverflow.com/comment/37554712
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37567598
tagged with: java
has body: I am splitting a huge file(2GB) into multiple files by date and time (12hrs for each file). But while splitting into multiple files, it is creating only some files. 20131101053000.txt 20131101173001.txt 20131102053002.txt 20131102173003.txt 20131103053004.txt after that some more files to be created, but not creating. Split File(Updated): splitByDatenTime(timeFrameMillis, fstream); --&gt; exception at line 30 in main method private static void splitByDatenTime(long millis, DataInputStream fstream) { BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); FileWriter fstream1 = null; BufferedWriter out = null; String strLine = null; Date prevDate = null; Date currDate = null; String dateFormat = "yyyy-MM-dd:HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); try { while ((strLine = br.readLine()) != null) { Pattern pattern = Pattern.compile("\\d+;.+"); Matcher matcher = pattern.matcher(strLine); if (matcher.find()) { String dateString = strLine.substring(0, 10); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(Long.valueOf(dateString) * 1000); --&gt; exception at line 54 currDate = cal.getTime(); String currentDate = sdf.format(currDate); currDate = sdf.parse(currentDate); if (((prevDate == null) &amp;&amp; (prevDate = currDate) != null) || (prevDate.getTime() + millis &lt; currDate .getTime())) { currentDate = currentDate.replaceAll("-|:", ""); fstream1 = new FileWriter( "D:/Splited AIS Data3/" + currentDate + ".txt"); close(out); out = new BufferedWriter(fstream1); prevDate = currDate; } out.write(strLine); out.newLine(); } } fstream1.close(); close(out); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } } Getting the NumberFormatException Exception in thread "main" java.lang.NumberFormatException: For input string: "!ABVDM,2,2" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:430) at java.lang.Long.parseLon…
has comment: http://stackoverflow.com/comment/37553955
type: Question

http://stackoverflow.com/q/23919267
score: 1
has comment: http://stackoverflow.com/comment/36853822
tagged with: java
has comment: http://stackoverflow.com/comment/36841094
has comment: http://stackoverflow.com/comment/36841790
has comment: http://stackoverflow.com/comment/36852743
has comment: http://stackoverflow.com/comment/36843011
upvote count: 1
has comment: http://stackoverflow.com/comment/36853772
has comment: http://stackoverflow.com/comment/36848415
has comment: http://stackoverflow.com/comment/36843256
favorite count: 0
has title: Intersection of Three Spheres Gives Wrong Coordinates in ProGAL
answer count: 0
has body: I use ProGAL to find the two intersection points of three spheres. Here is my code: Point p0 = new Point(2,8,1); Point p1 = new Point(5,9,17); Point p2 = new Point(21,19,11); Point p3 = new Point(7,4,1); double r0 = p3.distance(p0); double r1 = p3.distance(p1); double r2 = p3.distance(p2); Sphere s0 = new Sphere(p0, r0); Sphere s1 = new Sphere(p1, r1); Sphere s2 = new Sphere(p2, r2); Point[] intersections = Sphere.getIntersections(s0, s1, s2); for(Point point : intersections) System.out.println(point.x() + " " + point.y() + " " + point.z()); And this is the output: 8.748195083271948 1.1144249830330588 0.8525618604469422 -6.949424320444698 27.02495339639668 2.176457472808587 None of the points are even close to actual point (7,4,1). Is it because i) Rounding errors? ii) Wrong algorithm? or iii) Me doing something wrong?
downvote count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/36650770
score: 0
has text: A regular expression can't do that; it requires a recursive-descent parser.
type: QuestionComment
comment on: http://stackoverflow.com/q/23822375
type: Comment

http://stackoverflow.com/a/23926405
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/23926312
has body: The performance advantages of HashMaps can be "negated" by feeding it carefully chosen keys, so that you get lots of collisions. This reduces the O(1) access/whatever time for a HashMap to O(n), significantly reducing performance. hash32 is the cached value for an alternative hashing algorithm, used for Strings, so that if there were too many collisions with the default algorithm a different algorithm could be used to try to reduce the number of collisions. Source here: Java SE 7u6 introduces an improved, alternative hash function... The alternative hash function improves the performance of these map implementations when a large number of key hash collisions are encountered. The alternative hash function is only applied to keys of type String. HashMap was rewritten in Java 8 to use ad-hoc TreeMaps for Comparable keys if there were too many collisions for any particular bucket, meaning that performance went from O(1) to O(lg n) instead of O(1) to O(n) -- a significant improvement. As Strings implement Comparable, it was decided that the alternative hashing scheme was no longer needed, and it was removed.

http://stackoverflow.com/comment/36799813
comment on: http://stackoverflow.com/q/23860364
score: 0
has text: Have you tried with any different implementation of the JVM? Just to make sure it is not a particular bug of that version of OpenJDK. Emilio's idea of retrieving more data through jconsole is interesting too.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23810718
accepted answer of: http://stackoverflow.com/q/23810509
has comment: http://stackoverflow.com/comment/36629027
upvote count: 2
has body: There are two fields which the identifier str can refer to - a static one inherited from Int1, and an instance one inherited from Pparent. Even though it's invalid to try to use the instance one from a static context, the name can still be resolved. (If Pparent.str were static, you'd still get the error message.) Neither field is hiding the other, because they're inherited from different parents - so the name is ambiguous. The compiler's complaining because it doesn't know which field you mean. If you want the one from Int1, just qualify it: System.out.println(Int1.str); If you want the one from Pparent, you should create an instance and cast it to Pparent to make it clear you're not referring to the interface field: System.out.println(((Pparent) new F()).str); Obviously this is horrible, and you should avoid getting into such situations in the first place. This is partly achieved by making all fields private, except constants. It's very unusual to have two constants with exactly the same name in both a superclass and an interface you want to implement.
has comment: http://stackoverflow.com/comment/36629240
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23810509
score: 2
downvote count: 0

http://stackoverflow.com/a/23832830
has comment: http://stackoverflow.com/comment/36673655
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36672916
has body: This is an example of how to read the text of a text area to a string. public class GetterText extends JFrame { JTextArea ta = new JTextArea(); String taText; GetterText() { JButton getText = new JButton("GetText"); getText.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { taText = ta.getText(); System.out.println(taText); } }); getContentPane().add(getText, BorderLayout.LINE_START); getContentPane().add(new JScrollPane(ta)); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { new GetterText(); } } You can use taText.split(" ") to split around spaces and taText.split("\\n") to split around lines.
score: 1
has comment: http://stackoverflow.com/comment/36673814
has comment: http://stackoverflow.com/comment/36677068
has comment: http://stackoverflow.com/comment/36688736
has comment: http://stackoverflow.com/comment/36675674
has comment: http://stackoverflow.com/comment/36674399
has comment: http://stackoverflow.com/comment/36673680
has comment: http://stackoverflow.com/comment/36673001
has comment: http://stackoverflow.com/comment/36673005
type: Answer
has comment: http://stackoverflow.com/comment/36676581
has comment: http://stackoverflow.com/comment/36673550
has comment: http://stackoverflow.com/comment/36674979
upvote count: 1
has comment: http://stackoverflow.com/comment/36673486
has comment: http://stackoverflow.com/comment/36673777
has comment: http://stackoverflow.com/comment/36673606
has comment: http://stackoverflow.com/comment/36673037
has comment: http://stackoverflow.com/comment/36676718
has comment: http://stackoverflow.com/comment/36674864
accepted answer of: http://stackoverflow.com/q/23830105
answers question: http://stackoverflow.com/q/23830105

http://stackoverflow.com/q/23910387
has comment: http://stackoverflow.com/comment/36824909
has title: In Tomcat 6.0 The requested resource (/Purchase detail) is not availaible- 404 error found
tagged with: servlets
has comment: http://stackoverflow.com/comment/36818658
type: Question
linked to: http://stackoverflow.com/q/11731377
tagged with: jsp
duplicate of: http://stackoverflow.com/q/11731377
has comment: http://stackoverflow.com/comment/36818655
score: 0
has body: Jsp Code Good one Purchased Details Date Total Quantity Total Weight i given like this in the Jsp page. When i run this one index page is running. After if i gave the values in and click the submit button means HTTP Status 404 - /PurchaseDetails type Status report message /PurchaseDetails description The requested resource (/PurchaseDetails) is not available. Apache Tomcat/6.0.14 It will through this error. What can i do? If any one knows means tell me how can i do further My Web.xml code is here: PurchaseDetails PurchaseDetails com.focus.controller.PurchaseDetails PurchaseDetails /PurchaseDetails
has comment: http://stackoverflow.com/comment/36818998
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/36737602
has text: @user3675796 Simply assign a `GridLayout` to the parent of `imageContainer`, then assign a `GridData` to `imageContainer` itself using `SWT.CENTER` for the first two parameters. When you change the image, call `imageContainer.getParent().layout()`. Done.
type: Comment
comment on: http://stackoverflow.com/a/23867448
score: 0
type: AnswerComment

http://stackoverflow.com/a/23932776
has comment: http://stackoverflow.com/comment/36860753
answers question: http://stackoverflow.com/q/23932734
has comment: http://stackoverflow.com/comment/36861302
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36860692
has comment: http://stackoverflow.com/comment/36861321
has body: You're searching for a database mechanism. Android uses SQLite for that purpose, and it fit's your use case perfectly. You can read more about Androids storage mechanisms here, here, and more about SQLite in an Android application here.

http://stackoverflow.com/comment/36718977
type: AnswerComment
score: 0
has text: @SotiriosDelimanolis I tried your site, and there it returns `true`. This means there might be something wrong with the regex or the string to check.
type: Comment
comment on: http://stackoverflow.com/a/23857743

http://stackoverflow.com/comment/36592313
type: QuestionComment
score: 5
has text: You are mixing Spring versions (4.0.2, 3.1.4 and 2.0.8) never mix versions of a framework that is trouble waiting to happen. Note `spring-dap` is now `spring-orm`. Move all versions to `4.0.5.RELEASE`.
comment on: http://stackoverflow.com/q/23789271
type: Comment

http://stackoverflow.com/q/23813820
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/36638111
has comment: http://stackoverflow.com/comment/36638686
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36638260
accepted answer: http://stackoverflow.com/a/23834501
has body: I have an informatic project with JAVA langage for class and it's rated to graduate from high school. Btw my program consists in drawing geometrical forms in the JPanel with clic control but I don't know how to put, in my main program, fonctions which draw figures as I want like drawSquare(x,y,length). For the moment the program show this window (it's a JFrame with my JPanel inside): https://i.sstatic.net/ayZv2.png I have a method readClick() which give to a Point point the coordinates point.x and point.y in the frame but I don't know how, in my main, I can do to call a graphical drawing. "My problem is that I want to put in my main program something like Point clic; clic= Fenetre.readClick() ; // I have this method which wait me to clic on the frame x = clic.x ; //and give to point the coordonates y= clic.y; // point.x &amp;&amp; point.y clic = Fenetre.readClick(); a = clic.x ; b = clic.y ; "Function which draws rectangle for example"(x,y,a,b); //It's this fonction I want to create and // I want it to draw the rectangle in the JPanel But I don't know how to make the function which adds a drawing in the JPanel " My main program : public class Geogebra { @SuppressWarnings("unused") public static void main(String args[]){ Fenetre fen = new Fenetre(); }} My window class : import java.awt.Color; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; import java.util.concurrent.SynchronousQueue; import javax.swing.JFrame; @SuppressWarnings({ "unused", "serial" }) public class Fenetre extends JFrame { static Panneau component = null; private final static SynchronousQueue&lt;MouseEvent&gt; clicks = new SynchronousQueue&lt;MouseEvent&gt;(); public Fenetre(){ JFrame frame = new JFrame(); component = new Panneau(); frame.setTitle("ISNOGEBRA"); frame.setSize(900, 700); // Taille initiale de la fenetre : 900 * 700 frame.setLocationRelativeTo(null)…
upvote count: 0
possible better answer: http://stackoverflow.com/a/23814580
has comment: http://stackoverflow.com/comment/36636392
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/23834501
tagged with: graphics
answer count: 2
linked to: http://stackoverflow.com/q/11942961
tagged with: awt
has title: Draw in my JPanel calling a function in the "main"
has answer: http://stackoverflow.com/a/23814580
has comment: http://stackoverflow.com/comment/36634589
has comment: http://stackoverflow.com/comment/36635987
has comment: http://stackoverflow.com/comment/36634918
favorite count: 0

http://stackoverflow.com/comment/36696010
has text: Ok I solved this issue by adding a default "values" and put styles.xml in it. I have two more values folders to support more languages. I do not know but I think the layout file could not reference properly to one of the "values" folders.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23845806

http://stackoverflow.com/q/23861153
has answer: http://stackoverflow.com/a/23861519
answer count: 1
has title: Java division is not doing what I expected..
linked to: http://stackoverflow.com/q/2475652
has comment: http://stackoverflow.com/comment/36725666
has comment: http://stackoverflow.com/comment/36725719
duplicate of: http://stackoverflow.com/q/2475652
tagged with: division
type: UnansweredQuestion
tagged with: java
has body: I've searched a bit, and still can't find an answer for this. I am computing a formula for distances between tree nodes, and in my test case, my formula takes the number of leaves in node i, and divides it by the number of leaves in node i + the number of leaves in node j. These give me 1 and 2 respectively, since both i and j have one leaf each. My issue is that when I divide 1 by 2, I get zero. All these numbers are doubles, so I don't see what the problem is. . . Here is my code: formula1 = ((newNode.getLeftChild().getNumLeafs()) / (newNode.getLeftChild().getNumLeafs() + newNode.getRightChild().getNumLeafs()));
type: Question
has comment: http://stackoverflow.com/comment/36725667
has comment: http://stackoverflow.com/comment/36725654
has comment: http://stackoverflow.com/comment/36726082
has comment: http://stackoverflow.com/comment/36725685
score: 0

http://stackoverflow.com/comment/36853637
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23928448
type: QuestionComment
has text: and error is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:

http://stackoverflow.com/comment/36633762
type: AnswerComment
comment on: http://stackoverflow.com/a/23813026
score: 0
type: Comment
has text: @rapt I have updated my answer. if you are using Java 8, you really want to get you head around closures.

http://stackoverflow.com/comment/36638799
comment on: http://stackoverflow.com/q/23815932
has text: What do you mean by "dynamic texts"? There is nothing dynamic about your example.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/38806828
downvote count: 0
answers question: http://stackoverflow.com/q/23813727
has comment: http://stackoverflow.com/comment/68993472
upvote count: 57
has body: Using PDFBox 2.0.7, this is how I get the text of a PDF: static String getText(File pdfFile) throws IOException { PDDocument doc = PDDocument.load(pdfFile); return new PDFTextStripper().getText(doc); } Call it like this: try { String text = getText(new File("/home/me/test.pdf")); System.out.println("Text in PDF: " + text); } catch (IOException e) { e.printStackTrace(); } Since user oivemaria asked in the comments: You can use PDFBox in your application by adding it to your dependencies in build.gradle: dependencies { compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.7' } Here's more on dependency management using Gradle. If you want to keep the PDF's format in the parsed text, give PDFLayoutTextStripper a try.
has comment: http://stackoverflow.com/comment/116807118
score: 57
type: Answer

http://stackoverflow.com/a/23786779
score: 0
answers question: http://stackoverflow.com/q/23786246
has body: When you think you need multiple results from a method, you're really trying to represent something conceptually more complicated than two separate values. You're actually trying to represent two results and the relationship between them. Take, for instance, the idea of integer division, when you care about both the result and the remainder. The first option would be to just define two separate methods, divide(), and mod(). The problem is now a) you do the same operation twice, and b) you separate obviously connected logic. You're not actually trying to return two pieces of data, you're trying to return one, more complicated result. public class DivMod { public final int result; public final int remainder; // standard constructor, getters aren't strictly necessary in such a simple class } public static DivMod divMod(int dividend, int divisor) { // compute remainder, result return new DivMod(remainder, result); } This snippet hopefully makes it clear that there's often there's something even better you could do - do the computation in the object: public class DivMod { private final int dividend, divisor, result, remainder; public DivMod(int dividend, int divisor) { this.dividend = dividend; this.divisor = divisor; // calculate and set result and remainder } // standard getters } Now we've really compartmentalized what we're trying to do with proper Object Oriented Programming. There's no need for a static method, and all the logic is clearly in one place. Even better, we avoid the above case where a meaningless DivMod is constructed (one that doesn't actually represent a division result). We guarantee that every DivMod instance is an immutable result of integer division. There are two standard alternatives to the above, both of which are anti-patterns. The first is to return an array or a Collection, and the second is to define some sort of general Tuple class that holds multiple arbitrary data types. While tuples at least offer the benefit of being a fixed size, and…
type: Answer

http://stackoverflow.com/comment/36698985
type: Comment
type: QuestionComment
has text: The _individual operations_ of a `StringBuffer` are thread safe; two operations, one after the other, are not. Note that the same stands true for a `Hashtable`.
score: 2
comment on: http://stackoverflow.com/q/23847570

http://stackoverflow.com/a/23821683
downvote count: 0
has comment: http://stackoverflow.com/comment/36649542
has body: for year - pattern is yyyy not YYYY is that so? I had this code working a few months ago and the case was never a problem. – java 7 onwards supports Y and it represents week year - so this code likely to work without exception (not as expected though) java 6 or prior doesn't support Y so it will fail to parse
score: 3
answers question: http://stackoverflow.com/q/23821647
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23821647
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36649602
type: Answer
has comment: http://stackoverflow.com/comment/36649636
has comment: http://stackoverflow.com/comment/36649664

http://stackoverflow.com/comment/36615000
type: Comment
has text: Check for empty strings. For example `if(!("").equals(Flavor) && Flavor != null) ` apart from null check
comment on: http://stackoverflow.com/q/23803324
score: 0
type: QuestionComment

http://stackoverflow.com/a/23850962
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23850839
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: this.setLayout(new BorderLayout()); add(panel, BorderLayout.CENTER); Instead of a BorderLayout use a GridBagLayout: this.setLayout(new GridBagLayout()); add(panel, new GridBagConstraints());
has comment: http://stackoverflow.com/comment/36705938
accepted answer of: http://stackoverflow.com/q/23850839

http://stackoverflow.com/a/23845120
type: Answer
has body: the outcome will be the memory location not the object itself. No if you have not overridden toString() method in your class default toString() method of Object class is used. i.e public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } which prints the classname along with it's hash value. Also, if the toString method is a pre-defined method, why do I have to re-write it in my code? It's called overriding and you do it so that when you print the object your custom toString() is called and not the default one which prints class name and it's hash.
answers question: http://stackoverflow.com/q/23845067
score: 0

http://stackoverflow.com/q/23812273
has title: JSON Deserialization Joda Money using Jackson ObjectMapper causes exception
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23878172
linked to: http://stackoverflow.com/q/27952472
tagged with: http://stackoverflow.com/tag/json
answer count: 2
has body: Building API using Dropwizard framework and I came across this deserialization issue using Jackson ObjectMapper. I am using both Joda Time and Joda Money. For Joda Time, defining JodaModule was enough to resolve deserialization issue. But for Joda Money, JodaModule wasn't enough to resolve deserialization issue(Correct me if I am wrong). So, keeping JodaModule for Joda Time, I have created Joda Money specific deserializer. public class JodaMoneyDeserializer extends JsonDeserializer&lt;Money&gt; { @Override public Money deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { String text = parser.getText(); return Money.parse(text); } } For product model, I have added deserializer for Money. Let me know if I need to define anything else. public class Product { ... private Money price; ... ... @JsonDeserialize(using=JodaMoneyDeserializer.class) public void setPrice(Money price) { this.price = price; } ... } This will attempt to parse "{" only and will throw error. Any tips are much appreciated. If you need additional info, let me know. Thanks! ** UPDATED ** Here's sample JSON. { "id": 15, "productTypeId": 1, "code": "XYZK", "name": "PRODUCT - XYZK", "status": true, "visible": true, "createdAt": 1400572157000, "updatedAt": 1398995061000, "description": "description of product", "designator": "XYZK", "number": "9.032", "ingredients": "ingredient 1, ingredient 2, ingredient 3", "size": null, "weight": 0, "googleProductCategory": "Health &gt; Personal Care &gt; Color", "metaDescription": null, "metaKeyword": null, "metaTitle": null, "price": { "scale": 2, "amount": 19.95, "positive": true, "positiveOrZero": true, "negativeOrZero": false, "amountMajor": 34, "amountMajorLong": 34, "amountMajorInt": 34, "amountMinor": 3495, "amountMinorLong": 3495, "amountMinorInt": 3495, "minorPart": 95, "currencyUnit": { "code": "USD", "numericCode": 840, "decimalPlaces": 2, "numeric3Code": "840", "countryCodes": [ "AS", "US", "EC", "MP",…
downvote count: 0
tagged with: jackson
possible better answer: http://stackoverflow.com/a/31387803
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/117929772
has answer: http://stackoverflow.com/a/31387803
has answer: http://stackoverflow.com/a/23878172
score: 2

http://stackoverflow.com/q/23828530
tagged with: precision
has title: Show only decimals of float
type: Question
answer count: 1
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36663019
tagged with: floating-point
has comment: http://stackoverflow.com/comment/36662083
has comment: http://stackoverflow.com/comment/36662480
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36662971
has answer: http://stackoverflow.com/a/23828553
linked to: http://stackoverflow.com/q/23818325
has comment: http://stackoverflow.com/comment/36662135
has body: I need to print a float showing only the decimals of that float. For example: 1.23456 --&gt; 23456 12.3456 --&gt; 3456 123.456 --&gt; 456 I've found the following solution: float floatValue = 1.23455f; String stringValue = Float.toString(floatValue); int pointIndex = stringValue.indexOf("."); String decimals = stringValue.substring(pointIndex + 1, stringValue.length() - 1); But I think it's a little dirty and I wonder if there is any other standard way, using String.format or something similar. I did't find anything in the documentation. Thanks in advance!

stream
tags question: http://stackoverflow.com/q/23858418
type: Tag
tag name: stream
tags question: http://stackoverflow.com/q/23848081
tags question: http://stackoverflow.com/q/23847905

http://stackoverflow.com/comment/36650004
type: Comment
comment on: http://stackoverflow.com/q/23821838
score: 1
type: QuestionComment
has text: try this `select * from table where id IN(1,2,3,4,5)`

http://stackoverflow.com/comment/36859141
score: 0
type: AnswerComment
has text: Do you really have `\"NAME\"` in your source? If so, the regex will not match as it allows only whitespaces between `name` and `=` and the quoted string.
comment on: http://stackoverflow.com/a/23931802
type: Comment

http://stackoverflow.com/comment/36622999
type: Comment
type: QuestionComment
has text: You match, OK, but what are you doing with these matches?
score: 0
comment on: http://stackoverflow.com/q/23807830

http://stackoverflow.com/comment/36709626
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23852407
has text: i visited your link and yes it really helped me but as you mentioned in your topic what is the meant of EventQueue.invokeLater(new Runnable() {public void run() { // code }); the code inside your main method..
score: 0

http://stackoverflow.com/a/23940763
answers question: http://stackoverflow.com/q/23940612
type: Answer
has body: This class is in stdlib.jar . you need to include that jar in your class path to remove these errors. Unfortunatly thic class StdOut does not have package declaration So you can not import it. You have to create you class in default package to use this class. I will suggest to use some other output stream.
score: 0

http://stackoverflow.com/comment/36649745
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23821813
score: 2
has text: I can tell you one way it's possible: `while (true);` - but to see how your program is doing it, we'd have to be able to see your program.

http://stackoverflow.com/comment/36860069
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23932519
score: 1
has text: Java passes arguments Call-by-Value.

http://stackoverflow.com/q/23803024
score: 1
tagged with: java
tagged with: apache-storm
type: Question
answer count: 1
has title: Storm Esper Bolt Tuple Anchoring
accepted answer: http://stackoverflow.com/a/23809509
upvote count: 1
has body: I currently have a topology set up that makes use of an Esper Bolt created by tomdz on GitHub. Everything appears to work fine except when it comes to tuple anchoring. In the Esper Bolt itself there is a callback: public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement, EPServiceProvider epServiceProvider) The problem here is that I do not have a reference to the previous tuple in the tuple tree. This means when I go to emit my Esper result to the next Bolt in the sequence, I am unable to provide a tuple for anchoring: collector.emit(new Values(eventName, eventGrouping, eventDescription, correlatedValues)); Wondering if anyone has encountered this issue in their own project? If so how did you get around this? I want to use anchoring to ensure message reliability throughout my topology.
favorite count: 0
has answer: http://stackoverflow.com/a/23809509
tagged with: esper
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/23884486
type: AnsweredQuestion
downvote count: 0
type: Question
tagged with: microbenchmark
tagged with: java
has comment: http://stackoverflow.com/comment/36769337
has comment: http://stackoverflow.com/comment/36770034
has body: I test my program performance with JMH. And fail to configure heap size. I wondering why it doesn't work. Questions: Why JMH doesn't accept heap size configs? Does JMH absorb idea heap size settings without jvmArgs method? Error: # Run progress: 0.00% complete, ETA 00:04:30 # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java # VM options: -Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M # Fork: 1 of 1 Invalid initial heap size: -Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. &lt;forked VM failed with exit code 1&gt; Main Method: public static void main(String... args) throws RunnerException, IOException { Options opt = new OptionsBuilder() .include(".*" + ArraySummatorBenchmarking.class.getSimpleName() + ".*") .warmupIterations(5) .measurementIterations(5) .forks(1) .jvmArgs("-Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M") .build(); new Runner(opt).run(); } idea.vmoptions -server -Xms2056m -Xmx2056m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=256m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Dawt.useSystemAAFontSettings=lcd Main method options: -Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M
upvote count: 2
has title: JMH: invalid initial heap size
tagged with: jmh
answer count: 1
accepted answer: http://stackoverflow.com/a/23884959
has comment: http://stackoverflow.com/comment/36769541
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/23884959
tagged with: jvm-arguments
score: 2

http://stackoverflow.com/a/36946735
answers question: http://stackoverflow.com/q/23821792
has body: Code: Date date = new Date(); System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(date)); Date : Fri Apr 29 04:53:16 GMT 2016 Sample Output : 2016-04-29 Imports required : import java.util.Date; //for new Date() import java.text.SimpleDateFormat; // for the format change
downvote count: 0
type: Answer
upvote count: 1
score: 1

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/23906885
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/23924187
tags question: http://stackoverflow.com/q/23839945

http://stackoverflow.com/q/23841142
has comment: http://stackoverflow.com/comment/36687240
type: Question
tagged with: hashmap
score: 1
tagged with: java
has body: I know it might be a simple question, but I don't wish to miss any small but important point. Please explain what is the difference between the approaches to traverse a HashMap: HashMap&lt;Integer, Integer&gt; asd1 = new HashMap&lt;Integer, Integer&gt;(); asd1.put(1,11); asd1.put(2,22); asd1.put(3,33); // approach 1 for(int i:asd1.keySet()) { System.out.println(i+" : "+asd1.get(i)); } // approach 2 Iterator it = asd1.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); System.out.println(pairs.getKey() + " : " + pairs.getValue()); it.remove(); // avoids a ConcurrentModificationException }
answer count: 3
has answer: http://stackoverflow.com/a/23841192
upvote count: 1
duplicate of: http://stackoverflow.com/q/3328672
possible better answer: http://stackoverflow.com/a/23841321
favorite count: 0
has comment: http://stackoverflow.com/comment/36687026
has comment: http://stackoverflow.com/comment/36687263
linked to: http://stackoverflow.com/q/3328672
has title: What is the difference between two approaches to iterate a HashMap
tagged with: dictionary
has answer: http://stackoverflow.com/a/23841195
accepted answer: http://stackoverflow.com/a/23841195
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23841321

http://stackoverflow.com/q/23933911
has title: include source code while exporting a jar using maven
answer count: 1
tagged with: maven-2
favorite count: 0
has comment: http://stackoverflow.com/comment/86347980
has answer: http://stackoverflow.com/a/23934366
has comment: http://stackoverflow.com/comment/36862915
linked to: http://stackoverflow.com/q/2059431
upvote count: 13
type: AnsweredQuestion
tagged with: java
has body: I want to export a jar file using maven which can have the source included in it. I tried using 'maven-source-plugin', but it creates a separate jar file with source. Is there any way that I can export a jar file using maven like a normal eclipse export with source?
linked to: http://stackoverflow.com/q/4264359
accepted answer: http://stackoverflow.com/a/23934366
downvote count: 1
type: Question
score: 12

http://stackoverflow.com/comment/37112170
type: QuestionComment
has text: I've figured out that I was unwittingly running a 32 bit JRE when double clicking my installer that I'm building to do the install of my software. The answer below from sunbabaphu explains that a match of the beginning of the value will be valid. This explains the false positive I was getting. The false positive was actually on the arch=x86_64 setting since I was running a 32 bit JRE. Rene Krell told me to use arch="amd64" instead of x86_64, and now when I run with a 64 bit JRE, the correct files get installed. So, I'd like to add that the setting of <os arch="x86"/> is a bit misleading.
score: 0
comment on: http://stackoverflow.com/q/23916429
type: Comment

http://stackoverflow.com/comment/36789072
comment on: http://stackoverflow.com/q/23894608
score: 0
has text: and add the full screen image without cutting anything out
type: Comment
type: QuestionComment

classnotfoundexception
tags question: http://stackoverflow.com/q/23862309
tags question: http://stackoverflow.com/q/23890212
type: Tag
tags question: http://stackoverflow.com/q/23784212
tag name: classnotfoundexception
tags question: http://stackoverflow.com/q/23905046
tags question: http://stackoverflow.com/q/23794997
tags question: http://stackoverflow.com/q/23922387

datetime
tags question: http://stackoverflow.com/q/23902492
tags question: http://stackoverflow.com/q/23791237
tags question: http://stackoverflow.com/q/23933996
tags question: http://stackoverflow.com/q/23939576
tags question: http://stackoverflow.com/q/23845302
tags question: http://stackoverflow.com/q/23851064
tag name: datetime
tags question: http://stackoverflow.com/q/23821647
tags question: http://stackoverflow.com/q/23788465
tags question: http://stackoverflow.com/q/23806549
tags question: http://stackoverflow.com/q/23834233
tags question: http://stackoverflow.com/q/23929906
type: Tag
tags question: http://stackoverflow.com/q/23896128
tags question: http://stackoverflow.com/q/23837689
tags question: http://stackoverflow.com/q/23784765

http://stackoverflow.com/comment/36962181
type: Comment
comment on: http://stackoverflow.com/q/23848507
has text: @DaveSyer I tried to access http://localhost:8080/_ah/admin though the error is there and what I get is NOT_FOUND :-(
score: 0
type: QuestionComment

http://stackoverflow.com/q/23868527
type: Question
has title: CAMT.053 Parser for Java
upvote count: 5
downvote count: 0
has body: does anyone happen to know a Java-library capable of parsing CAMT.05x (espacially .053) XML files which are used by European Banks for SEPA transfers? Google won't really help me here...
tagged with: core-banking
answer count: 1
has answer: http://stackoverflow.com/a/23868577
has comment: http://stackoverflow.com/comment/139624684
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/139623848
type: UnansweredQuestion
score: 5
has comment: http://stackoverflow.com/comment/41006258
has comment: http://stackoverflow.com/comment/101104851
tagged with: java

http://stackoverflow.com/a/23939473
has body: Don't perform your work on the EDT. Use the javax.swing.SwingWorker to run time-consuming background tasks.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23929579
accepted answer of: http://stackoverflow.com/q/23929579
type: Answer
has comment: http://stackoverflow.com/comment/36873955
downvote count: 0
score: 1

http://stackoverflow.com/a/23817898
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It might help you to understand. Here I am reading a music file that is stored under music folder in src folder of my project as shown in below snapshot. getDocumentBase() points to the bin folder (class-path) where all the classes are stored. In your case it will fetch the music from bin/sounds/Dragon Roost.wav getDocumentBase() Gets the URL of the document in which this applet is embedded. For example, suppose an applet is contained within the document: http://java.sun.com/products/jdk/1.2/index.html The document base is: http://java.sun.com/products/jdk/1.2/index.html getCodeBase() Gets the base URL. This is the URL of the directory which contains this applet. Sample code: Applet: URL url = getDocumentBase(); AudioClip audioClip = getAudioClip(url, "music/JButton.wav"); Project structure:
accepted answer of: http://stackoverflow.com/q/23817796
answers question: http://stackoverflow.com/q/23817796

http://stackoverflow.com/a/23888457
type: Answer
has body: Java 8 does not change anything by the type parsing. So you still have write your own typeParser like this: public Integer tryParse(String str) { Integer retVal; try { retVal = Integer.parseInt(str); } catch (NumberFormatException nfe) { retVal = 0; // or null if that is your preference } return retVal; }
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23888326

http://stackoverflow.com/comment/36592564
type: QuestionComment
has text: I'd like to add to the open source platform and develop some components for it. In order to do that, I'd like to see how the current ones work
comment on: http://stackoverflow.com/q/23789893
score: 0
type: Comment

http://stackoverflow.com/q/23841203
accepted answer: http://stackoverflow.com/a/23881865
tagged with: servlets
has body: Given something like: e.g. class User{ String name; String someField1; } @Consumes("some/media-type") class ResourceA{ public Response test(@FormParam("u") User u, @FormParam("f) String someField){ } } Couple of questions: Will a single MessageBodyReader used to de-serialize User or will each field in user be de-serialized by a different reader? Is @context required on any/all of these? Is @FormParam required on the fields in the User class? I'm trying to understand if the server will take the list of readers available and for each param in test, check if ANY of the readers can de-serialize that type. Or if the first reader which matches the media type consumed is expected to de-serialize all the params. If the server is iterating through each parameter and for each parameter finding the most appropriate reader, it kind of makes sense that the input stream being passed to readFrom is the same instance, and each reader is advancing through the input stream. Is this the case or am I totally misunderstanding how the MessageBodyReader is meant to be used?
answer count: 2
tagged with: jersey-2.0
has answer: http://stackoverflow.com/a/23881865
score: 0
tagged with: rest
has title: How are MessageBodyReaders used
tagged with: dropwizard
has answer: http://stackoverflow.com/a/23857667
possible better answer: http://stackoverflow.com/a/23857667
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36733310
has text: No in this situation I ship them with the web app.
type: Comment
comment on: http://stackoverflow.com/a/23865343
score: 0
type: AnswerComment

http://stackoverflow.com/q/23920173
has body: I am working on a custom spinner, I already understand how to use an ArrayAdapter in order to customise the layout of the custom popup. The issue I am having however is that I do not want to show the default spinner on my UI instead I want to show an image, then this image will changed based on the item that has been selected, the image would look something like below: Further to this, is there a way that I can use wrap_content, but to wrap it based on this image size rather than the default spinner size?
has title: Android Custom Spinner with Image selection
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/39334859
has answer: http://stackoverflow.com/a/23920883
accepted answer: http://stackoverflow.com/a/23920883
type: Question
score: 0
answer count: 2
tagged with: user-interface
tagged with: spinner
tagged with: android
has answer: http://stackoverflow.com/a/39334859

http://stackoverflow.com/comment/36856061
type: Comment
has text: After reading whole error message I think, you should skip port number - error message: `mismatch for http://my.host.name/myapp/lib/applet.jar`, but in manifest you have `my.host.name:8081`. Tell me later, if this is helpful.
comment on: http://stackoverflow.com/a/23927937
type: AnswerComment
score: 0

http://stackoverflow.com/q/23929904
type: UnansweredQuestion
tagged with: mysql
has title: query for Select distinct rows and maximum of auto generated test id?
has comment: http://stackoverflow.com/comment/36855384
has answer: http://stackoverflow.com/a/23930104
tagged with: java
has comment: http://stackoverflow.com/comment/36855320
has answer: http://stackoverflow.com/a/23930049
type: Question
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/23930026
has comment: http://stackoverflow.com/comment/36855344
has comment: http://stackoverflow.com/comment/36855329
has body: this is my table manufacture_data.I need to get all data of distinct manufacture_name and maximum of test_id for each. that means i need to get row with test id 4 and 6. can anyone help?
has comment: http://stackoverflow.com/comment/36855379
answer count: 5
has answer: http://stackoverflow.com/a/23930069
has answer: http://stackoverflow.com/a/23930129

http://stackoverflow.com/comment/36806014
comment on: http://stackoverflow.com/q/23903403
type: QuestionComment
type: Comment
has text: Please clarify your question. What do you want to achieve?
score: 1

http://stackoverflow.com/q/23865896
type: Question
tagged with: apache
has body: I need CXF server monitoring with JMX and followed CXF Documentation. I use tomcat and following is the content of my cxf.xml file located at /home/kalpa/applications/apache-tomcat-7.0.54/webapps/java_first_jaxws/WEB-INF/classes <property name="bus" ref="cxf" /> <property name="enabled" value="true" /> <property name="JMXServiceURL " value="service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi" /> But I cannot monitor the data with jconsole. There is no local entry for the connection. What could be the issue here?
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has title: JMX Integration with Apache CXF
type: UnansweredQuestion
tagged with: jmx
has answer: http://stackoverflow.com/a/34295894
tagged with: cxf
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23811255
type: Answer
accepted answer of: http://stackoverflow.com/q/23810166
downvote count: 1
answers question: http://stackoverflow.com/q/23810166
upvote count: 0
has body: @Configuration public class DataAccessConfiguration { @Bean(destroyMethod = "close") public javax.sql.DataSource dataSource() { org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); ds.setUrl("jdbc:mysql://localhost/db"); ds.setUsername("javauser"); ds.setPassword(""); ds.setInitialSize(5); ds.setMaxActive(10); ds.setMaxIdle(5); ds.setMinIdle(2); ds.get return ds; } }
type: AcceptedAnswer
score: -1

http://stackoverflow.com/comment/36571512
type: QuestionComment
comment on: http://stackoverflow.com/q/23778201
score: 0
has text: please show us your pom.xml and the command line how you execute mvn
type: Comment

http://stackoverflow.com/comment/36692728
type: Comment
has text: In this no need to define bean in XML file?
comment on: http://stackoverflow.com/a/23844554
score: 0
type: AnswerComment

http://stackoverflow.com/q/23877236
tagged with: database
has comment: http://stackoverflow.com/comment/36755373
score: 0
answer count: 1
has title: javax.ejb.EJBException when delete an entity
has comment: http://stackoverflow.com/comment/36778319
has body: I have an entity called User which was created as an Entity Class from Database: @Entity @Table(name = "User") @XmlRootElement @NamedQueries({ @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"), @NamedQuery(name = "User.findById", query = "SELECT u FROM User u WHERE u.id = :id"), @NamedQuery(name = "User.findByFirstName", query = "SELECT u FROM User u WHERE u.firstName = :firstName"), @NamedQuery(name = "User.findBySecondName", query = "SELECT u FROM User u WHERE u.secondName = :secondName"), @NamedQuery(name = "User.findByLastName", query = "SELECT u FROM User u WHERE u.lastName = :lastName"), @NamedQuery(name = "User.findByLogin", query = "SELECT u FROM User u WHERE u.login = :login"), @NamedQuery(name = "User.findByPassword", query = "SELECT u FROM User u WHERE u.password = :password"), @NamedQuery(name = "User.findByEmail", query = "SELECT u FROM User u WHERE u.email = :email") }) public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "Id") private Integer id; @Size(max = 45) @Column(name = "FirstName") private String firstName; @Size(max = 45) @Column(name = "SecondName") private String secondName; @Size(max = 45) @Column(name = "LastName") private String lastName; @Size(max = 45) @Column(name = "Login") private String login; @Size(max = 45) @Column(name = "Password") private String password; // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation @Size(max = 45) @Column(name = "Email") private String email; @Size(max = 255) @Column(name = "Image") private String image; @JoinColumn(name = "Role_Id", referencedColumnName = "Id") @ManyToOne(optional = false) private Role roleId; @OneToMany(cascade…
type: AnsweredQuestion
tagged with: entity-framework
tagged with: java
has answer: http://stackoverflow.com/a/23881807
accepted answer: http://stackoverflow.com/a/23881807
type: Question
tagged with: jakarta-ee
tagged with: ejb

http://stackoverflow.com/comment/47074763
type: Comment
comment on: http://stackoverflow.com/a/23813335
has text: webAppContextSetup is for integration tests but if you want to unit test your controller then you should always inject mocks as mentioned by ndrone
score: 0
type: AnswerComment

http://stackoverflow.com/a/23851072
type: Answer
answers question: http://stackoverflow.com/q/23849330
score: 0
has body: onRegistered is not called because you don't have com.google.android.c2dm.intent.REGISTRATION in your receiver's intent filter. It should be : <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.test.gcm" /> That's assuing that you are using the old registration method (GCMRegistrar.register). If you are using the new registration method (GoogleCloudMessaging.register), you don't need the onReceive method, since you would get the registration ID synchronously when you call register.

http://stackoverflow.com/q/23789515
tagged with: sql
has comment: http://stackoverflow.com/comment/36588415
tagged with: sqlite
answer count: 1
downvote count: 1
has body: I am basically trying to retrieve to an ArrayList something i stored in my database. I iterate through ResultSet but it I get a NullPointerException. ResultSet rs = null; ArrayList&lt;People&gt; peoList=null; try { rs = stat.executeQuery("SELECT * from people WHERE surname='"+surname+"'"); } catch (SQLException ex) { Logger.getLogger(myClass.class.getName()).log(Level.SEVERE, null, ex); } String name, surname; try { while (rs.next()) { name = rs.getString("name"); surname = rs.getString("surname"); People peo = new People(name,surname); peoList.add(peo); } } catch (SQLException ex) { Logger.getLogger(myClass.class.getName()).log(Level.SEVERE, null, ex); } return peoList; When I call this function, a NullPinterException arises with a ton of other messages. I really don't get this. It seems that the problem is where I put peoList.add(peo);. For example, if remove this and put a counter the number of iterations is ok.
has comment: http://stackoverflow.com/comment/36588569
favorite count: 0
has comment: http://stackoverflow.com/comment/36589039
score: 2
has comment: http://stackoverflow.com/comment/36588538
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36588972
type: Question
has answer: http://stackoverflow.com/a/23789569
accepted answer: http://stackoverflow.com/a/23789569
has title: ResultSet and ArrayList of objects not working
has comment: http://stackoverflow.com/comment/36588722
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36588327
upvote count: 3

http://stackoverflow.com/comment/36979816
comment on: http://stackoverflow.com/a/23900559
type: AnswerComment
type: Comment
score: 0
has text: do you have setter and getter methods for the list in the model? Can you please paste the generated HTML for one field? It should work if everything is done correctly.

http://stackoverflow.com/q/23886275
has comment: http://stackoverflow.com/comment/36774568
downvote count: 0
has comment: http://stackoverflow.com/comment/36773841
has comment: http://stackoverflow.com/comment/36785724
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/36972263
type: Question
has comment: http://stackoverflow.com/comment/36774574
has comment: http://stackoverflow.com/comment/36774121
upvote count: 6
has comment: http://stackoverflow.com/comment/36774540
linked to: http://stackoverflow.com/q/23511824
linked to: http://stackoverflow.com/q/2064427
has comment: http://stackoverflow.com/comment/36797585
tagged with: jscrollpane
linked to: http://stackoverflow.com/q/9930272
answer count: 1
linked to: http://stackoverflow.com/q/12781179
has comment: http://stackoverflow.com/comment/36833221
has answer: http://stackoverflow.com/a/23887495
has comment: http://stackoverflow.com/comment/36778386
has comment: http://stackoverflow.com/comment/36807928
has comment: http://stackoverflow.com/comment/36773692
has comment: http://stackoverflow.com/comment/36773993
has comment: http://stackoverflow.com/comment/36773418
type: UnansweredQuestion
has title: JScrollPane - visual glitch when scrolling
score: 6
tagged with: swing
has comment: http://stackoverflow.com/comment/36778304
has comment: http://stackoverflow.com/comment/36774455
has comment: http://stackoverflow.com/comment/36773950
has comment: http://stackoverflow.com/comment/36773335
has comment: http://stackoverflow.com/comment/36773810
has comment: http://stackoverflow.com/comment/36968038
has body: There were a few topics about similar glitches in JScrollPane while scrolling like: Java Swing JScrollPane line number glitch Moving JScrollPane horizontally results in blured text But they lack SSCCE and some explanation on the case, so i will add what is missing. First of all, here is a small example written on pure Swing with no 3rd-party code used: public class ScrollGlitchExample extends JFrame { public ScrollGlitchExample () throws HeadlessException { super (); final JPanel top = new JPanel (); top.setPreferredSize ( new Dimension ( 300, 50 ) ); top.setBorder ( BorderFactory.createLineBorder ( Color.BLACK ) ); add ( top, BorderLayout.NORTH ); final JPanel panel = new JPanel ( new GridLayout ( 500, 1 ) ); for ( int i = 0; i < 500; i++ ) { panel.add ( new JButton ( "button" + i ) ); } final JScrollPane scroll = new JScrollPane ( panel ); scroll.setPreferredSize ( new Dimension ( 300, 300 ) ); add ( scroll, BorderLayout.CENTER ); final JPanel bottom = new JPanel (); bottom.setPreferredSize ( new Dimension ( 300, 50 ) ); bottom.setBorder ( BorderFactory.createLineBorder ( Color.BLACK ) ); add ( bottom, BorderLayout.SOUTH ); setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE ); pack (); setLocationRelativeTo ( null ); } public static void main ( final String[] args ) { SwingUtilities.invokeLater ( new Runnable () { @Override public void run () { new ScrollGlitchExample ().setVisible ( true ); } } ); } } This is a small example - two panels at top and bottom and scroll with lots of content in the middle of the frame. So, here is how the glitch looks like in this specific example: To reproduce it: You will have to scroll down the JScrollPane using mouse wheel only, scrolling by dragging the scroll bar does not cause this issue, probably due to massive amount of repaints or some other minor difference. While scrolling you will see white lines overlapping the buttons. In BLIT_SCROLL_MODE JScrollPane simply copying parts painted before to maximize the speed of scr…
linked to: http://stackoverflow.com/q/13915081
has comment: http://stackoverflow.com/comment/36975361

http://stackoverflow.com/a/23798776
score: 0
type: Answer
has body: The org.json library is easy to use. Example code is as below: JSONObject obj = new JSONObject(" .... "); int errCode= obj.getJSONObject("error").getInt("code");
answers question: http://stackoverflow.com/q/23798655

http://stackoverflow.com/comment/38733638
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23800251
has text: I have followed the instructions on [this page](http://www.cyberciti.biz/faq/howto-installing-oracle-java7-on-ubuntu-linux/) and when I type in `java -version`, its now showing as 1.7.0_55. But I still can't run SQL Developer
score: 0

http://stackoverflow.com/a/23878067
has body: You could also reduce n. A bit faster. for (int factor = 2; factor &lt;= n; factor++) { if (n % factor == 0) { System.out.print(factor); primes.add(factor); while (n % factor == 0) { n /= factor; System.out.print('*'); primeFactors(n/factor); } } } If Set {2, 3} needs to be a List [2, 2, 2, 3] the add needs to be done in the while.
answers question: http://stackoverflow.com/q/23877903
score: 0
type: Answer

http://stackoverflow.com/a/23906953
has comment: http://stackoverflow.com/comment/36814475
score: 8
answers question: http://stackoverflow.com/q/23901398
has body: You don't want to do that. You need to make your game for any phone. If you have a code like player.x+=10f; Your player will move faster on better devices.. You need to move your player by the delta time value. player.x+=Gdx.graphics.getDeltaTime()*300; // this would be ~5f if your device is running with 60 fps
has comment: http://stackoverflow.com/comment/36819510
downvote count: 0
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/36813656
has comment: http://stackoverflow.com/comment/36817059
has comment: http://stackoverflow.com/comment/36817245
has comment: http://stackoverflow.com/comment/36816983
has comment: http://stackoverflow.com/comment/36816869

http://stackoverflow.com/q/23835908
upvote count: 8
has answer: http://stackoverflow.com/a/23836027
linked to: http://stackoverflow.com/q/23835182
tagged with: variable-assignment
has body: Looking at this example code similar to this question: public class A { public static void main(String args[]){ A a = new A(); System.out.println(a.equals((a = null))); } } This prints false. Why doesn't it fail with a NullPointerException? The assignment has to get processed before the equals method can run, but somehow that doesn't affect the reference that equals is called on until after the whole line is evaluated? I didn't see where in the Java language spec it describes this, did I miss it somewhere?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23836004
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23836027
has title: updating references in an expression with a nested assignment
tagged with: expression-evaluation
answer count: 2
downvote count: 0
score: 8
favorite count: 0
has comment: http://stackoverflow.com/comment/36676459
accepted answer: http://stackoverflow.com/a/23836004

http://stackoverflow.com/q/23856703
score: 6
has comment: http://stackoverflow.com/comment/36716652
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36716710
has body: The output for following two code blocks in Java is different. I am trying to understand why. private String sortChars(String s){ char[] arr = s.toCharArray(); //creating new char[] Arrays.sort(arr); //sorting that array return new String(arr); } This one returns a string with sorted characters as expected. private String sortChars(String s){ char[] arr = s.toCharArray(); //creating new char[] Arrays.sort(arr); //sorting that array return arr.toString(); } Sorry. My bad! Using to compare two strings. The output to second string looks like this as suggested by many - [C@2e0ece65 Thanks!
type: Question
has comment: http://stackoverflow.com/comment/36716628
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36716520
tagged with: string
has answer: http://stackoverflow.com/a/23856836
has comment: http://stackoverflow.com/comment/36716691
has comment: http://stackoverflow.com/comment/36716881
tagged with: char
has comment: http://stackoverflow.com/comment/36716808
accepted answer: http://stackoverflow.com/a/23856836
answer count: 1
has title: Difference between new String(char[]) and char[].toString
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/36716727

http://stackoverflow.com/comment/36685611
comment on: http://stackoverflow.com/q/23840331
has text: Quite simply - any code which performs network operations must run on a separate thread. Try using an `AsyncTask` and put the network code in the `doInBackground` method.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23853339
has comment: http://stackoverflow.com/comment/36710474
type: Answer
answers question: http://stackoverflow.com/q/23853320
accepted answer of: http://stackoverflow.com/q/23853320
score: 3
upvote count: 3
has body: I can't see where you've declared sinsertMoney but it looks like you've forgotten to assign the result of your call to JOptionPane.showInputDialog to something, hence why that value is still null when you try to parse it. Try this: sinsertMoney = JOptionPane.showInputDialog( "=============================" + "\nPlease enter some money (in pence)" + "\n============================="); // Inserting money insertMoney = Integer.parseInt(sinsertMoney);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36882515
comment on: http://stackoverflow.com/q/23917774
score: 0
type: Comment
type: QuestionComment
has text: @RetoKoradi: How was I completely wrong? In what world are three lines a triangle? This *may* produce 3 stippled lines, but it will not produce a stippled triangle ***ever***. If it produced a stippled triangle for you, then your driver has some serious issues.

http://stackoverflow.com/comment/36730974
has text: Have a look at this as well https://community.oracle.com/thread/933075?tstart=0
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23863909

http://stackoverflow.com/a/23939400
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36873336
type: Answer
accepted answer of: http://stackoverflow.com/q/23938667
has body: Using the save method you linked to you can create the text to save with a StringBuilder: public String makeArrayListFlatfileString(List&lt;List&lt;String&gt;&gt; listOfLists) { StringBuilder sb = new StringBuilder(); if (!listOfLists.isEmpty()) { // this assumes all lists are the same length int listLengths = listOfLists.get(0).size(); for (int i=0; i&lt;listLengths; i++) { for (List&lt;String&gt; list : listOfLists) { sb.append(list.get(i)).append("\n"); } sb.append("\n"); // blank line after column grouping } } return sb.toString(); } To parse the contents from that same file (again assuming equal length lists and a String input): public List&lt;List&lt;String&gt;&gt; getListOfListsFromFlatfile(String data) { // split into lines String[] lines = data.split("\\n"); // first find out how many Lists we'll need int numberOfLists = 0; for (String line : lines){ if (line.trim().equals("")) { // blank line means new column grouping so stop counting break; } else { numberOfLists++; } } // make enough empty lists to hold the info: List&lt;List&lt;String&gt;&gt; listOfLists = new ArrayList&lt;List&lt;String&gt;&gt;(); for (int i=0; i&lt;numberOfLists; i++) { listOfLists.add(new ArrayList&lt;String&gt;()); } // keep track of which list we should be adding to, and populate the lists int listTracker = 0; for (String line : lines) { if (line.trim().equals("")) { // new block so add next item to the first list again listTracker = 0; continue; } else { listOfLists.get(listTracker).add(line); listTracker++; } } return listOfLists; }
has comment: http://stackoverflow.com/comment/36873601
answers question: http://stackoverflow.com/q/23938667
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36873080
upvote count: 1

http://stackoverflow.com/comment/74989753
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23824847
has text: @Chiffa could you write how did you manage to solve it?

http://stackoverflow.com/q/23872423
tagged with: http://stackoverflow.com/tag/csv
has body: I need to sort a csv file based on multiple columns. Say my csv consists of 15 fields,I have to sort them on the basis of 4 columns combination.I need to sort my file by 2nd column, then by 3rd ,then 4th and then by 1st column. How can I achieve this using Java? Can I use any open source library for it?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23872528
has comment: http://stackoverflow.com/comment/36745940
has comment: http://stackoverflow.com/comment/36751030
downvote count: 1
has comment: http://stackoverflow.com/comment/36787316
tagged with: java
score: -1
type: Question
has title: sorting csv file based on multiple columns
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23937858
answers question: http://stackoverflow.com/q/23922005
score: 0
type: Answer
has body: The problem was not OpenCV itself, but rather the fresh Eclipse distribution that I downloaded. Code completion (Ctrl + Space) was not working for anything, not just OpenCV. The solution can be found here: Eclipse/Java code completion not working.
accepted answer of: http://stackoverflow.com/q/23922005
type: AcceptedAnswer

http://stackoverflow.com/q/23933195
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23940310
tagged with: ontology
tagged with: eclipse
has body: I already have downloaded wordnet2.0 full, but i am not getting how to use it as a graph because it consists of multiple RDF files. I want to use wordnet2.0 ontology as a graph in Eclipse. The following is the snippet of code that i am using for loading a ontology as a graph. I also want to know, Am i going in a right direction??? URIFactory factory = URIFactoryMemory.getSingleton(); URI graph_uri = factory.createURI("http://graph/"); G graph = new GraphMemory(graph_uri); String fpath ="D:/Workspace/SSM/src/wordnet-wordsensesandwords.rdf"; GDataConf graphconf = new GDataConf(GFormat.RDF_XML, fpath); GAction actionRerootConf = new GAction(GActionType.REROOTING); GraphConf gConf = new GraphConf(); gConf.addGDataConf(graphconf); gConf.addGAction(actionRerootConf); // GraphLoaderGeneric.populate(graphconf, graph); GraphLoaderGeneric.load(gConf, graph); // General information about the graph System.out.println(graph.toString());
has answer: http://stackoverflow.com/a/23934279
answer count: 2
downvote count: 0
has title: can any body provide a link for downloading wordnet ontology 2.0??
favorite count: 0

http://stackoverflow.com/comment/36863222
has text: @JonSkeet my question is simple that if `System.out.println("Default of call by value");` is the last line in output then `super(50);` should be the secondlast line of output because they are in same block.How come `super(50)` is giving output before non-static block of call by value?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23934079

http://stackoverflow.com/comment/117546294
has text: If you upgrade to latest 6.16.0 version of jasper report also it work as suggested. This is better solution compare to above one as we don't need to downgrade our jar which is vulnerable too.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/36910523

http://stackoverflow.com/a/23935912
upvote count: 1
score: 1
downvote count: 0
has body: the only difference is that the first form is compatible with earlier java versions than java 7.
answers question: http://stackoverflow.com/q/23935796
type: Answer

http://stackoverflow.com/a/23937290
has body: Maybe you can show a message at the end of the Thread. Which would be helpful to let the user know that the process has finished. Showing Message System.out.print("Thread has finished!"); This would be at the last line, so it would only execute if all the above codes have been executed and the code has reached the last line for execution. Thread newThread = new Thread() { @Override public void run() { //My Thread code System.out.print("Done!"); } }; This will print Done! in the Console (I assume application is being run using a Console). Denoting that the code has been executed. using a variable boolean done = false; Thread newThread = new Thread() { @Override public void run() { //My Thread code done = true; } }; Using EventListeners Or else you can use Event Listener to detect the Thread completion. The above method was kind of simple. http://docs.oracle.com/javase/tutorial/uiswing/events/
has comment: http://stackoverflow.com/comment/36869283
score: 0
has comment: http://stackoverflow.com/comment/36869324
upvote count: 1
answers question: http://stackoverflow.com/q/23937225
has comment: http://stackoverflow.com/comment/36869054
type: Answer
downvote count: 1

http://stackoverflow.com/q/23889486
linked to: http://stackoverflow.com/q/1194656
favorite count: 0
linked to: http://stackoverflow.com/q/16145682
has answer: http://stackoverflow.com/a/23898401
accepted answer: http://stackoverflow.com/a/23898401
has title: java.io.StreamCorruptedException: Wrong format when reading more than 1 object
duplicate of: http://stackoverflow.com/q/2393179
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: fileoutputstream
type: Question
tagged with: objectinputstream
linked to: http://stackoverflow.com/q/2393179
tagged with: fileinputstream
has body: I am trying to add an object( of OneChatMessage class) into a file on every button click. And then i try to read all the objects from the file and load it into a ArrayList. But i get a StreamCorruptedException at the second iteration of ObjectInputStream.readObject() in the deserialization function. I have verified that the first iteration works fine. I have read many other posts on the same issue : One suggestion(Deserialize multiple Java Objects) is to write the entire array list to the file instead of individual objects. But that seems wasteful, as i need to write to file on every button click and there would be hundreds of objects over time. Another suggestion(StreamCorruptedException: invalid type code: AC) is to do with different headers created by ObjectOutputStream. I have no idea who to use this knowledge to resolve the issue. Any idea on how i can resolve this? OneChatMessage.java : package com.slapp.chat; import java.io.Serializable; import java.util.Date; import com.slapp.localDB.Contact; //This class defines the class for a chat message public class OneChatMessage implements Serializable{ private String text; private Date timeSent; private Boolean sentByMe; public OneChatMessage(String text, Date timeSent, Boolean sentByMe){ this.text = text; this.timeSent = timeSent; this.sentByMe = sentByMe; } public String getText(){ return this.text; } public Date getTimeSent(){ return this.timeSent; } @Override public String toString(){ return new StringBuffer(" Text : ") .append(this.text) .append(" TimeSent : ") .append(this.timeSent.toString()) // Need to use SimpleDatFormat to get the correct time zone and formatting. Leaving it for now. .append(" SentByMe : ") .append(this.sentByMe.toString()).toString(); } } Serializing function : public void addMessage(OneChatMessage msg) { FileOutputStream fos; ObjectOutputStream oos; File file = new File(context.getFilesDir(), "abc"); if (!file.exists()) { Log.d("faizal", "The file does not exist : "); } else { Log.d("faiz…
upvote count: 3
tagged with: android
answer count: 1

http://stackoverflow.com/a/23845169
answers question: http://stackoverflow.com/q/23845096
score: 0
has body: Your variable df is local only to your main method. Methods inchToCentimeter and centimeterToInch are unaware of this variable. Either make it a global variable or pass it as arguements to these methods.
type: Answer

http://stackoverflow.com/comment/36760037
type: Comment
type: QuestionComment
score: 0
has text: Re: Edit. 1) You forgot to pass an argument to your program. 2) If you had failed to decipher the error message (unlikely, since it is very clear), then a new question is the correct way to go. 3) You don't need to ask a new question, you should be able to figure out the answer from the error message and/or google.
comment on: http://stackoverflow.com/q/23879414

http://stackoverflow.com/a/69181827
answers question: http://stackoverflow.com/q/23883110
score: 0
type: Answer
has body: This works on Elasticsearch 7.x: public boolean indexExists(String indexName) throws IOException { return client.indices().exists(new org.elasticsearch.client.indices.GetIndexRequest(indexName), RequestOptions.DEFAULT); }

http://stackoverflow.com/q/23874435
score: 0
accepted answer: http://stackoverflow.com/a/23913645
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/36769158
has answer: http://stackoverflow.com/a/23913645
has comment: http://stackoverflow.com/comment/36824646
has body: I am trying to add an image to a pdf document via java applet. I am able to it successfully when i run the applet via applet viewer in eclipse IDE. But when i embedded this applet to a webpage, the pdf which is getting created is somehow corrupted. What am i doing wrong? I am using iText to do this. Here is the code i use: Document document=new Document(); PdfWriter.getInstance(document, new FileOutputStream("C://Folder/abc.pdf")); document.open(); Image img=Image.getInstance("C://New/abcd.png"); img.scaleToFit(400,400); document.add(img); document.close(); Any help will be greatly appreciated. Thank you.
type: AnsweredQuestion
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/36763943
type: Question
has title: Adding an image to Pdf via Applet

http://stackoverflow.com/q/23782247
linked to: http://stackoverflow.com/q/1718465
has body: I noticed that some web frameworks such as Play Framework allows you to configure multiple thread-pools with different sizes (num of threads within it). Let's say we run this play within a single machine with single core. Wouldn't there be a huge overhead by having multiple thread-pools? For example, smaller thread pool is assuming asynchronous operations vs large thread-pool indicate a lot of blocking calls so threads can context-switch. Both cases is assuming that parallelism factor based on number of cores are in machine. My concern is that processor is further shared. How does this work? Thanks!
tagged with: playframework
tagged with: akka
answer count: 1
has answer: http://stackoverflow.com/a/23786528
has title: How does a single machine share thread-pool?
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: multithreading
type: Question
accepted answer: http://stackoverflow.com/a/23786528
tagged with: threadpool

http://stackoverflow.com/comment/36799052
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23899464
has text: The AndroidHive tutorial I posted actually uses this method... plus, aren't AsyncTask useful just for this kind of situation? Anyway, I updated my question.

http://stackoverflow.com/a/23937350
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23936945
answers question: http://stackoverflow.com/q/23936945
type: AcceptedAnswer
downvote count: 0
has body: I think you get it wrong in certain edge cases: public int yourMaxBlock(String str) { int maxCounter = 1; int counter = 1; if (str.length() == 0) { return 0; } for (int i = 0; i &lt; str.length() - 1; i++) { if (str.substring(i, i + 1).equals(str.substring(i + 1, i + 2))) { counter++; } if (counter &gt; maxCounter) { maxCounter = counter; counter = 0; } } return maxCounter; } public int myMaxBlock(String str) { int maxCounter = 1; int counter = 1; if (str.isEmpty()) { return 0; } for (int i = 1; i &lt; str.length(); i++) { if (str.charAt(i - 1) == str.charAt(i)) { if (++counter &gt; maxCounter) { maxCounter = counter; } } else { counter = 1; } } return maxCounter; } public void test() { String[] tests = new String[]{ "", "+", "++", "+++,++,++,+", "+,++,+++,++,", "+,++,+++,++++", "+++++,++,+++,++++" }; for (String s : tests) { int myMax = myMaxBlock(s); int yourMax = yourMaxBlock(s); System.out.println("myMaxBlock(" + s + ") = " + myMax + (myMax != yourMax ? " WRONG! you have " + yourMax : "")); } } prints myMaxBlock() = 0 myMaxBlock(+) = 1 myMaxBlock(++) = 2 myMaxBlock(+++,++,++,+) = 3 myMaxBlock(+,++,+++,++,) = 3 myMaxBlock(+,++,+++,++++) = 4 WRONG! you have 3 myMaxBlock(+++++,++,+++,++++) = 5 WRONG! you have 4
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36869547

http://stackoverflow.com/comment/38877147
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24912974
score: 1
has text: But that doesn't really help. When you use `SimpMessageTemplate.convertAndSendToUser`, if you look at the code, it literally just prefixes '/user/{username}' and then uses the `SimpMessageTemplate.convertAndSend` method. It does not actually address the security concern.

http://stackoverflow.com/q/23834744
upvote count: 3
has body: I am getting an array size of zero for the "tweets" array when trying to access the arraylist that it should be stored in. I am using Jackon databinding to a class, which at this point has "worked" as in not gave any errors or exceptions. But, the problem is still that the array is returning empty. Here is the method where I am accessing the class that the JSON is being binded to: WeatherDatabaseCreator.java //Read in files to be parsed. for (int i = 0; i &lt; twitterFiles.size(); i++) { File twitterFile = twitterFiles.get(i); WeatherTweetParser wtp = new WeatherTweetParser(twitterFile); wtp.mapJavaObject(); tws = new Tweets(); tweets = tws.getTweets(); System.out.print(tweets.size()); tweetIndex = 0; System.out.println("Parsing and inserting twitter file '" + twitterFile.getAbsolutePath() + "'..."); //Step through all the tweets in each file, using the TweetParser class. while (true) { tweet = tweets.get(tweetIndex); user = tweet.new User(); entity = tweet.new Entities(); userMentions = entity.getUserMentions(); hashtags = entity.getHashtags(); if (tweet.getText() == null) { break; } numParsed++; Boolean success = wdbm.insertTweet(tweet, user); if (success == true) { numInserted++; } if (entity.getNumHashtags() &gt; 0){ for (int j = 0; j &lt; entity.getNumHashtags(); j++) { wdbm.insertHashtag(tweet, hashtags.get(j)); } } if (entity.getNumUserMentions() &gt; 0) { for (int k = 0; k &lt; entity.getNumUserMentions(); k++) { wdbm.insertReference(tweet, userMentions.get(k)); } } if (numParsed % UPDATE_INTERVAL == 0) { System.out.println(numParsed + " tweets parsed. " + numInserted + " tweets inserted into database..."); } tweetIndex++; } Here is part of the JSON File. The file is made up of an array of tweets, with some nested classes. Here I included two elements of the array: 2014-01-03-11-03.terms.json { "tweets": [ { "filter_level": "medium", "contributors": null, "text": "U know your ice fishing at home when ur snacks are sandwiches,chips,dips,beef jerky and all the…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/23837253
type: Question
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36674504
tagged with: jackson
has answer: http://stackoverflow.com/a/23835003
has comment: http://stackoverflow.com/comment/36674294
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36674420
has comment: http://stackoverflow.com/comment/36674328
has title: JSON Null Pointer Exception in Array with Jackson ObjectMapper
accepted answer: http://stackoverflow.com/a/23835003
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/36740315
comment on: http://stackoverflow.com/q/23869267
score: 0
type: Comment
type: QuestionComment
has text: How are entering the text in text area? are you using enter key to write in new line?

http://stackoverflow.com/q/23806625
has title: Can not unmarshall the SOAP response
tagged with: soap
has comment: http://stackoverflow.com/comment/37473415
linked to: http://stackoverflow.com/q/24131822
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36659496
tagged with: java
accepted answer: http://stackoverflow.com/a/23808863
tagged with: jaxb
type: Question
score: 5
tagged with: stringreader
has comment: http://stackoverflow.com/comment/37471219
upvote count: 5
tagged with: unmarshalling
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36620870
has body: I could send a request and receive the response but I can not parse the response. It returns the following error: Local Name:Body error is here java.lang.NullPointerException at com.ticketmaster.ticketmaster.TicketMaster.Search(TicketMaster.java:119) at com.ticketmaster.ticketmaster.App.main(App.java:12) Code SOAPMessage response = connection.call(message, endpoint); connection.close(); SOAPMessage sm = response; SOAPBody sb = response.getSOAPBody(); System.err.println("Node Name:" + sb.getNodeName()); //return nothing System.err.println("Local Name:" + sb.getLocalName()); //return Local Name:Body DOMSource source = new DOMSource(sb); results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class); System.err.println("Results size: " + this.results.returnTag.results.item.get(0).getName()); } catch (Exception ex) { System.err.println("error is here"); ex.printStackTrace(); } Response: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ticketmaster.productserve.com/v2/soap.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;SOAP-ENV:Body&gt; &lt;ns1:findEventsResponse&gt; &lt;return xsi:type="ns1:Response"&gt; &lt;details xsi:type="ns1:Details"&gt; &lt;totalResults xsi:type="xsd:int"&gt;20662&lt;/totalResults&gt; &lt;totalPages xsi:type="xsd:int"&gt;414&lt;/totalPages&gt; &lt;currentPage xsi:type="xsd:int"&gt;1&lt;/currentPage&gt; &lt;resultsPerPage xsi:type="xsd:int"&gt;50&lt;/resultsPerPage&gt; &lt;/details&gt; &lt;results SOAP-ENC:arrayType="ns1:Event[50]" xsi:type="ns1:ArrayOfEvent"&gt; &lt;item xsi:type="ns1:Event"&gt; &lt;eventId xsi:type="xsd:int"&gt;1516682&lt;/eventId&gt; &lt;ticketmasterEventId xsi:type="xsd:string"&gt;18004C6E8D7218A8&lt;/ticketmasterEventId&gt; &lt;s…
has answer: http://stackoverflow.com/a/23808863
favorite count: 0
has comment: http://stackoverflow.com/comment/37451497

http://stackoverflow.com/a/23899722
score: 3
answers question: http://stackoverflow.com/q/23885579
downvote count: 0
has body: I asked how to do it without an xml file and the solution proposed by @Octopus fixed the problem I had. However, after fixing that arised other errors with transactions... so I decided to do it in a different way that doesn't interfere with the application. To do so I created a simplified version of the xml file in /src/test/resources removing many configurations like c3p0's one and hardcoding the values so that the tests won't fail if the application's properties files are changed. This is the content of the xml file: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.dialect.MySQL5InnoDBDialect false false update false <context:annotation-config /> <tx:annotation-driven /> ... In the test class I have used JUnit because I haven't managed to do it with TestNG although I tried extending AbstractTestNGSpringContextTests. I would recommend using JUnit 4.4 version instead of newer versions because it has classes like AssumptionViolatedException that are used by spring-test 2.5. This is the code: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/test/resources/application-config-tests.xml" }) public class SimpleUserDAOTest { @Autowired private UserDAO dao; @Autowired private SessionFactory sessionFactory; @Before public void setUp() throws Exception { TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(sessionFactory.openSession())); } @After public void tearDown() throws Exception { SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.unbindResource(sessionFactory); SessionFactoryUtils.closeSession(sessionHolder.getSession()); } @Test public void shouldReturnActiveUsers() { List<User> userList = dao.getActiveUsers(); ... } } I hope this helps you in your future developments
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36804695

http://stackoverflow.com/comment/36764765
comment on: http://stackoverflow.com/q/23881074
score: 0
type: Comment
type: QuestionComment
has text: Also, what is the `dependency:copy-dependencies` goal in the `install` phase for? It doesn't make much sense.

http://stackoverflow.com/q/23928030
tagged with: java
tagged with: mysql
type: Question
score: 0
answer count: 1
has body: I have two webservices. One webservice calls another webservice. These web services are hosted on two different instances of AWS. If webservice which is called is idle for some time, I am getting this exception - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 49,381,933 milliseconds ago. The last packet sent successfully to the server was 49,381,933 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. If I restart the AWS instance, I don't get this exception. Tomcat is the server used, and Mysql as an database, webservices developed using spring-mvc. I searched on internet, but found 'autoReconnect=true' is not recommended. and not sure how much I can increase 'wait_timeout', as I am not sure how much time instance will be idle. Please suggest what can be done.
has title: CommunicationsException in webservice on Idle AWS instance
tagged with: web-services
tagged with: spring
has answer: http://stackoverflow.com/a/23948872
accepted answer: http://stackoverflow.com/a/23948872
type: AnsweredQuestion

http://stackoverflow.com/q/23893080
has comment: http://stackoverflow.com/comment/36809084
tagged with: spring-websocket
tagged with: java
has comment: http://stackoverflow.com/comment/36811295
score: 0
has title: Junit and spring websockets - after each test I get a weird exception
tagged with: junit
answer count: 1
tagged with: websocket
has answer: http://stackoverflow.com/a/23910232
has comment: http://stackoverflow.com/comment/36790606
tagged with: spring
type: UnansweredQuestion
has body: I am getting the following exception when my jUnit test is ending: 7 May 2014 18:06:29 INFO GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@7b0133c2: startup date [Tue May 27 18:06:09 IDT 2014]; root of context hierarchy 27 May 2014 18:06:29 INFO DefaultLifecycleProcessor - Stopping beans in phase 2147483647 27 May 2014 18:06:29 INFO NettyTcpClient - CLOSED: [id: 0x09b0bb52, /127.0.0.1:56869 :&gt; /127.0.0.1:61613] 27 May 2014 18:06:31 ERROR StompBrokerRelayMessageHandler - Error while shutting down TCP client java.util.concurrent.TimeoutException at org.springframework.messaging.tcp.reactor.AbstractPromiseToListenableFutureAdapter.get(AbstractPromiseToListenableFutureAdapter.java:84) at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.stopInternal(StompBrokerRelayMessageHandler.java:377) at org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler.stop(AbstractBrokerMessageHandler.java:150) at org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler.stop(AbstractBrokerMessageHandler.java:164) at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:229) at org.springframework.context.support.DefaultLifecycleProcessor.access$300(DefaultLifecycleProcessor.java:51) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:363) at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:202) at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:118) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:888) at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:809) 27 May 2014 18:06:31 INFO ThreadPoolTaskExecutor - Shutting down ExecutorService 'brokerChannelExecutor' 27 May…
type: Question
has comment: http://stackoverflow.com/comment/36811021

http://stackoverflow.com/comment/36760188
score: 1
comment on: http://stackoverflow.com/q/23879656
has text: Think!! If you need to split at spaces, find a space, then substring the part up to (but not including) the space, discard the space, then repeat.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34737358
type: Answer
has body: Well it worked fine for me, and as I've received no critique, might as well throw in the getBestSize functionality as well: private Size getBestSize(List&lt;Size&gt; supportedPreviewSizes, float aspectRatio) { int surfaceHeight = videoView.getHeight(); Size bestSize = null; Size backupSize = null; for (Size size : supportedPreviewSizes) { float previewAspectRatio = size.width / (float)size.height; previewAspectRatio = Math.round(previewAspectRatio * 10) / 10f; if (previewAspectRatio == aspectRatio) { // Best size must match preferred aspect ratio if (bestSize == null || Math.abs(surfaceHeight - size.height) &lt; Math.abs(surfaceHeight - bestSize.height)) bestSize = size; } else if (bestSize == null) { // If none of supported sizes match preferred aspect ratio, backupSize will be used if (backupSize == null || Math.abs(surfaceHeight - size.height) &lt; Math.abs(surfaceHeight - backupSize.height)) backupSize = size; } } return bestSize != null ? bestSize : backupSize; }
accepted answer of: http://stackoverflow.com/q/23892229
score: 0
answers question: http://stackoverflow.com/q/23892229
type: AcceptedAnswer

http://stackoverflow.com/q/23808665
score: 0
answer count: 1
tagged with: javabeans
type: UnansweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/23809724
has body: So I have a session bean which is used as a flag, whether to show a list of items or a grid of items... This value can change in several ways in my page (to click on certain command button, to click on an item from a menu, to click on other command button, etc) Now I use a hidden input on my page to get the value from the bean (which has a certain type by default) &lt;h:inputHidden id="viewType" value="#{myBean.viewType}" /&gt; On my javascript function I assgin the value to this input and then show the correct view type with others js function... function setProdViewGrid(){ document.getElementById('catPage:viewType').value = "grid"; showProdGrid(); }; function setProdViewList(){ document.getElementById('catPage:viewType').value = "list"; showProdList(); }; This works, but the problem is that on the bean, the attribute viewType isn't updated, just the input value (which makes total sense). Since my bean is session type I want to change &amp; keep this value, is there a way to do it through js? Here are my bean side functions public void setProdViewList(){ viewType = "list"; } public void setProdViewGrid(){ viewType = "grid"; }
tagged with: java
type: Question
has title: Change value of session bean with javascript
tagged with: session
tagged with: javascript

http://stackoverflow.com/comment/36653271
type: Comment
type: QuestionComment
score: 1
has text: possible duplicate of [Read all files in a folder](http://stackoverflow.com/questions/1844688/read-all-files-in-a-folder)
comment on: http://stackoverflow.com/q/23823547

http://stackoverflow.com/comment/36828676
type: AnswerComment
type: Comment
has text: But thanks for this hint, so this is kind of the right answer ;)
comment on: http://stackoverflow.com/a/23789443
score: 0

http://stackoverflow.com/comment/36608749
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23799986
score: 1
has text: Hi Shantanu, one of the reason for the exception might be the firefox process might not be closed before you execute the script for the second time. For the 2nd problem remove the . in the xpath. Hope this solves the issue. Happy coding.

object
tags question: http://stackoverflow.com/q/23813787
tag name: object
tags question: http://stackoverflow.com/q/23845067
tags question: http://stackoverflow.com/q/23784175
tags question: http://stackoverflow.com/q/23888289
tags question: http://stackoverflow.com/q/23902575
tags question: http://stackoverflow.com/q/23794262
tags question: http://stackoverflow.com/q/23818646
tags question: http://stackoverflow.com/q/23888243
tags question: http://stackoverflow.com/q/23857686
tags question: http://stackoverflow.com/q/23822422
tags question: http://stackoverflow.com/q/23817359
tags question: http://stackoverflow.com/q/23876405
tags question: http://stackoverflow.com/q/23896114
tags question: http://stackoverflow.com/q/23860170
tags question: http://stackoverflow.com/q/23806690
tags question: http://stackoverflow.com/q/23866647
tags question: http://stackoverflow.com/q/23851609
tags question: http://stackoverflow.com/q/23820253
type: Tag
tags question: http://stackoverflow.com/q/23794576
tags question: http://stackoverflow.com/q/23919803
tags question: http://stackoverflow.com/q/23791883
tags question: http://stackoverflow.com/q/23825213
tags question: http://stackoverflow.com/q/23886986
tags question: http://stackoverflow.com/q/23831085
tags question: http://stackoverflow.com/q/23834551
tags question: http://stackoverflow.com/q/23852516
tags question: http://stackoverflow.com/q/23885552
tags question: http://stackoverflow.com/q/23847201

http://stackoverflow.com/a/23789062
score: 0
has comment: http://stackoverflow.com/comment/36590707
answers question: http://stackoverflow.com/q/23788369
type: Answer
has comment: http://stackoverflow.com/comment/36590672
has body: You need to use the OnItemClickListener. It helps you perform actions for specific item clicks.

http://stackoverflow.com/comment/36821107
comment on: http://stackoverflow.com/q/23910331
type: Comment
has text: Poke around the OpenOffice site, I guess.
type: QuestionComment
score: 0

http://stackoverflow.com/a/23930746
upvote count: 10
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23930580
type: Answer
accepted answer of: http://stackoverflow.com/q/23930580
has body: First this is no longer a Plain Old Java Object, Because it has annotations. But staying on your premise, The Serializable is required in POJOs if those are intended to be used in Distributed Systems and Systems which use caching and flushing into files and reading back. Mostly JPA implementations do run in Distributed manner and Use caching, thus this POJO is required to implement Serializable. For more information read this discussion
score: 10

http://stackoverflow.com/comment/36929635
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23895793
has text: @James, but I dont want to join the main thread. I want to notify the main thread that Event X has completed and you can now update the UI.( Consider it like onPostExecute() of android which runs after doInBackground() completes.).

http://stackoverflow.com/a/23886647
type: Answer
has comment: http://stackoverflow.com/comment/36773579
has body: If you want to compute all inner products i reccomend this: in matrix A store your vectors in rows, and in B, store them in cols. Then in A*B you will havat position (i,j) inner product of v_i and v_j. The trick is that normal matrix multiplication takes n^3 time, but some clever algorithm have more efficient methods, but only for ~ 30 and more vectors.
score: 0
answers question: http://stackoverflow.com/q/23886006

http://stackoverflow.com/comment/36755926
comment on: http://stackoverflow.com/a/23874069
has text: so does that mean if return type of methodA of ClassA is Integer as well as it's variable, variableA and ClassC has a public method methodC of return type Integer, i can invoke methodC as something like: ClassA obj1 = new ClassA(); obj1.methodA.methodC() or obj1.variableA.methodC(); Thanku sooo much for taking out time to answer.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23805991
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23805903
has comment: http://stackoverflow.com/comment/36622703
upvote count: 3
has comment: http://stackoverflow.com/comment/36623432
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36622801
has comment: http://stackoverflow.com/comment/36627842
score: 3
has body: for me both snippets looks like same. They're clearly not the same. In your second snippet, you've got two variable declarations for the same name in the same class. That's a violation of this part of section 8.3 of the JLS: It is a compile-time error for the body of a class declaration to declare two fields with the same name. In the first snippet, you're declaring one (implicitly static field in the interface and one field in the class. That doesn't violate any rules. Instead, it just follows this rule, also in section 8.3: If the class declares a field with a certain name, then the declaration of that field is said to hide any and all accessible declarations of fields with the same name in superclasses, and superinterfaces of the class.
accepted answer of: http://stackoverflow.com/q/23805903

http://stackoverflow.com/comment/36590937
score: 0
type: Comment
type: QuestionComment
has text: Not sure but your code implies the button is hidden, if so then it would not have a width because it is not drawn. Try calling measure() then getMeasuredWidth().
comment on: http://stackoverflow.com/q/23790805

http://stackoverflow.com/q/23811568
tagged with: google-openid
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24378045
has title: OpenID Connect Examples using Multiple Providers?
favorite count: 0
tagged with: openid
accepted answer: http://stackoverflow.com/a/23811569
has body: I'm trying to figure out how to use the Google OAuth Client Library for Java to authenticate against multiple OpenID connect providers. The example they have here works with Daily Motion. I'd like to see how it works with other providers so I can abstract the differences. Are there any other examples around that authenticate against say Google perhaps?
type: AnsweredQuestion
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24378045
tagged with: java
tagged with: oauth-2.0
has answer: http://stackoverflow.com/a/23811569
type: Question

android-layout
tags question: http://stackoverflow.com/q/23781307
tag name: android-layout
tags question: http://stackoverflow.com/q/23846950
tags question: http://stackoverflow.com/q/23895693
tags question: http://stackoverflow.com/q/23853237
tags question: http://stackoverflow.com/q/23917407
tags question: http://stackoverflow.com/q/23893095
tags question: http://stackoverflow.com/q/23876798
tags question: http://stackoverflow.com/q/23891814
tags question: http://stackoverflow.com/q/23852151
tags question: http://stackoverflow.com/q/23852107
type: Tag
tags question: http://stackoverflow.com/q/23939800
tags question: http://stackoverflow.com/q/23857169
tags question: http://stackoverflow.com/q/23850680
tags question: http://stackoverflow.com/q/23913880
tags question: http://stackoverflow.com/q/23856043
tags question: http://stackoverflow.com/q/23881298
tags question: http://stackoverflow.com/q/23891952

http://stackoverflow.com/q/23883219
type: Question
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/36766692
has comment: http://stackoverflow.com/comment/36766679
answer count: 3
has comment: http://stackoverflow.com/comment/36766757
favorite count: 0
has title: how can I fixed Oracle Client Setup problems?
has answer: http://stackoverflow.com/a/23883492
has comment: http://stackoverflow.com/comment/36766729
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36767229
tagged with: client
has answer: http://stackoverflow.com/a/45708411
has answer: http://stackoverflow.com/a/35363854
has body: I want to setup oracle client in my server . But I see this error. How can I fixed? The Java RunTİme Enviroment was not found at bin\javaw.exe. Hence, the Oracle Universal Installer cannot be run. Please visit this link and install JRE version 1.3.1 or higher and try again.
has comment: http://stackoverflow.com/comment/36767085
has comment: http://stackoverflow.com/comment/36767009
has comment: http://stackoverflow.com/comment/36767046
tagged with: java
has comment: http://stackoverflow.com/comment/36767498
downvote count: 1

http://stackoverflow.com/comment/36581457
comment on: http://stackoverflow.com/a/23784628
type: Comment
score: 0
type: AnswerComment
has text: I remove it programmatically. Pb solved see above. Tks a lot for help

http://stackoverflow.com/a/23876456
type: Answer
has comment: http://stackoverflow.com/comment/36753838
upvote count: 7
has comment: http://stackoverflow.com/comment/36753773
score: 7
accepted answer of: http://stackoverflow.com/q/23876399
has body: Try with reflection Steps to follow: First retrieve the declared field of the class using its variable name Check the type of the returned field Then call corresponding method on Field to get the field value Sample code: ArrayList&lt;Class&lt;? extends A&gt;&gt; list = new ArrayList&lt;Class&lt;? extends A&gt;&gt;(); list.add(B.class); list.add(A.class); // get the value of first class stored in array Field f = list.get(0).getDeclaredField("i"); Class&lt;?&gt; t = f.getType(); if (t == int.class) { System.out.println(f.getInt(null)); } EDIT As per @Sotirios Delimanolis comments you can get the value directly without checking field type and mathodField#getX() as shown below but it will return Object instead of primitive int. Field f = list.get(0).getDeclaredField("i"); System.out.println(f.get(null));
answers question: http://stackoverflow.com/q/23876399
has comment: http://stackoverflow.com/comment/36753824
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36753753
downvote count: 0
has comment: http://stackoverflow.com/comment/36753716

http://stackoverflow.com/comment/36865613
has text: It won't execute any non-static block, until the constructor of the Object class is called. Then from top most parent class execution will shift to the non-static block/s found in Object class. Then what ever code is found in the constructor of class Object is executed. Then execution moves down the hierarchy and so non-static block/s found in next most child class are executed. Then what ever code is found in the constructor of that class is executed.
type: Comment
comment on: http://stackoverflow.com/a/23934242
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36834378
has text: Interfaces shoul not carry attributes afaik.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23918577
type: QuestionComment

http://stackoverflow.com/q/23938043
favorite count: 0
has body: In an android project, I want to use a shared model library with the REST Server(JPA) Project structure: ├── android │ └ ... │ ├── model │ ├── build.gradle │ └── src │ └── com │ └── model // error at runtime │ └── Customer.java ├── server │ ├── build.gradle │ └── src │ └── com │ └── server │ ├── Application.java │ ├── CustomerController.java │ ├── CustomerRepository.java │ └── model // works fine │ └── Customer.java ├── build.gradle I am using gradle sub-projects to manage the dependency which works fine at compile time. But when I run the Application, Spring can't resolve the JPA annotations. When I move the model class to the server project, it works fine. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [...] Instantiation of bean failed; [...] Not an managed type: class com.model.Customer root build.gradle buildscript { ... } allprojects { repositories { mavenCentral() } } project(":android") { ... } project(":model") { apply plugin: "java" } project(":server") { apply plugin: "java" dependencies { compile project(":model") } } Is there a solution to include JPA models from a gradle sub-project ? The reason is mostly to prevent duplicate code between the android and server appication
has answer: http://stackoverflow.com/a/23979327
tagged with: spring
score: 2
upvote count: 2
tagged with: java
tagged with: gradle
type: Question
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/23979327
has title: import JPA Model from gradle sub-project in Spring
answer count: 1
tagged with: jpa
downvote count: 0

http://stackoverflow.com/a/61663275
score: 0
type: Answer
has body: I have the same problem, then i used sudo sh studio.sh then it`s worked.
answers question: http://stackoverflow.com/q/23846295

http://stackoverflow.com/comment/36828456
score: 0
type: QuestionComment
type: Comment
has text: The persistence.xml picked up isn't the one you thought. Are there any others around in a meta-inf directory somewhere, perhaps in a jar file? How are you getting the exception, as you must be accessing the persistence unit somehow - you can add properties through code to that location to turn on logging.
comment on: http://stackoverflow.com/q/23911652

http://stackoverflow.com/q/23847230
has answer: http://stackoverflow.com/a/23856098
has answer: http://stackoverflow.com/a/23847714
has title: Constructor vs method vs factory
has body: Imagine you want to export certain Document into File (in some format... let's say XML). For this purpose I have class XmlExporter and the question is... what is the best approach to passing both Document and File to this class? Option 1: Exporter is stateless, so if I want to export different document or into different file I just change the parameter. Disadvantage is that I have to pass the file (or rather OutputStream) in every single method (which in case of complex document can be quite a lot) class XmlExporter { public function export(Document document, File file) { this.writeHeader(document.header, file); this.writeSomeOtherStuff(document.somethingElse, file); // and more ... } private function writeHeader(DocumentHeader header, File file) { writeName(header.name, file); // passing file over and over again } } Option 2: Both source and target is stored within the instance. If I wanted to change the file I would have to create a new object, but now I don't need to worry about passing all necessary data. class XmlExporter { private final Document document; private final File file; public XmlExporter(Document document, File file) { this.document = document; this.file = file; } public function export() { this.writeHeader(this.document.header); } private function writeHeader(DocumentHeader header) { this.writeName(header.name); } private function writeName(String name) { // ... } } Option 3: Combination of both class DocumentExporter { public static function exportToXml(Document document, File file) { XmlExporter exporter = new XmlExporter(document, file); exporter.export(); } // the rest same as Option 2, probably with private constructor } Basically the second choice makes most sense for me from the perspective of writing the class, since I don't need to pass the target file/stream around; however from the point of actually using it I feel that the first choice would make more sense. What if I wanted to export it into standard output instead of file, or export m…
tagged with: coding-style
type: AnsweredQuestion
tagged with: design-patterns
type: Question
possible better answer: http://stackoverflow.com/a/23856098
has comment: http://stackoverflow.com/comment/36698265
tagged with: oop
tagged with: java
accepted answer: http://stackoverflow.com/a/23847714
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36698117

javascript
tags question: http://stackoverflow.com/q/23876008
tags question: http://stackoverflow.com/q/23920740
tags question: http://stackoverflow.com/q/23778808
tags question: http://stackoverflow.com/q/23930541
tags question: http://stackoverflow.com/q/23845758
tags question: http://stackoverflow.com/q/23827773
tags question: http://stackoverflow.com/q/23888930
tags question: http://stackoverflow.com/q/23883071
tags question: http://stackoverflow.com/q/23826520
tags question: http://stackoverflow.com/q/23925988
tags question: http://stackoverflow.com/q/23878586
tags question: http://stackoverflow.com/q/23807903
tag name: javascript
tags question: http://stackoverflow.com/q/23894182
tags question: http://stackoverflow.com/q/23931862
tags question: http://stackoverflow.com/q/23939566
tags question: http://stackoverflow.com/q/23912510
tags question: http://stackoverflow.com/q/23783653
tags question: http://stackoverflow.com/q/23890010
tags question: http://stackoverflow.com/q/23933069
tags question: http://stackoverflow.com/q/23808665
type: Tag
tags question: http://stackoverflow.com/q/23820356
tags question: http://stackoverflow.com/q/23890503
tags question: http://stackoverflow.com/q/23788803
tags question: http://stackoverflow.com/q/23902986
tags question: http://stackoverflow.com/q/23778633
tags question: http://stackoverflow.com/q/23872897
tags question: http://stackoverflow.com/q/23780651
tags question: http://stackoverflow.com/q/23918580
tags question: http://stackoverflow.com/q/23802295
tags question: http://stackoverflow.com/q/23929229
tags question: http://stackoverflow.com/q/23856769
tags question: http://stackoverflow.com/q/23858601
tags question: http://stackoverflow.com/q/23920198
tags question: http://stackoverflow.com/q/23782736
tags question: http://stackoverflow.com/q/23919303
tags question: http://stackoverflow.com/q/23872672
tags question: http://stackoverflow.com/q/23780515
tags question: http://stackoverflow.com/q/23908051
tags question: http://stackoverflow.com/q/23831166
tags question: http://stackoverflow.com/q/23783708
tags question: http://stackoverflow.com/q/23788987
tags question: http://stackoverflow.com/q/23903873
tags question: http://stackoverflow.com/q/23815692
tags question: http://stackoverflow.com/q/23928297
tags question: http://stackoverflow.com/q/23866411
tags question: http://stackoverflow.com/q/23872046
tags question: http://stackoverflow.com/q/23827571
tags question: http://stackoverflow.com/q/23934110
tags question: http://stackoverflow.com/q/23865768
tags question: http://stackoverflow.com/q/23897323
tags question: http://stackoverflow.com/q/23851722
tags question: http://stackoverflow.com/q/23806727
tags question: http://stackoverflow.com/q/23818842
tags question: http://stackoverflow.com/q/23788751
tags question: http://stackoverflow.com/q/23936152
tags question: http://stackoverflow.com/q/23868662
tags question: http://stackoverflow.com/q/23785962

http://stackoverflow.com/a/23831774
downvote count: 0
score: 3
has body: Specify the type for key and value: Map&lt;String, String&gt; aMethod(aType type);
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/23831713

http://stackoverflow.com/a/50473681
answers question: http://stackoverflow.com/q/23784617
type: Answer
score: 0
has body: This happened to me once when something went wrong with the repository, and then even if I ran maven again, it still failed. Solution: delete maven repo ~/.m2/repository and then re-build It works for me.

http://stackoverflow.com/q/23856477
has answer: http://stackoverflow.com/a/23878221
upvote count: 2
type: UnansweredQuestion
has body: My code: static final boolean WINDOWS = System.getProperty("os.name").toLowerCase().startsWith("windows"); public static final String LIB_NAME = "libtesseract302"; public static final String LIB_NAME_NON_WIN = "/home/xxx/libtesseract.so"; public static final TessAPI INSTANCE = (TessAPI) Native.loadLibrary(WINDOWS ? LIB_NAME : LIB_NAME_NON_WIN, TessAPI.class) It works on tomcat 6 when I use tomcat 7,it does not work. java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract.so': Native library (linux-x86/libtesseract.so) not found in resource path..... I am not authorized to change the jvm Dpath.I also try to use NativeLibrary.addSearchPath("libtesseract","/home/xxx/") But it dosen't work too.So what's the solution on this situation?
tagged with: tesseract
score: 2
tagged with: java
type: Question
has title: tomcat 7 can't use jna to load my shared library with absolute path
has comment: http://stackoverflow.com/comment/98063319
answer count: 1
downvote count: 0
tagged with: tomcat
tagged with: jna
has comment: http://stackoverflow.com/comment/36885899
tagged with: loadlibrary
favorite count: 0

http://stackoverflow.com/comment/36782919
comment on: http://stackoverflow.com/q/23891707
score: 0
has text: Java *or* Javascript? Choose one.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23935276
favorite count: 0
has body: A simple question asked many many many many times... Model 1 and Model 2 Architecture... I simple cannot uderstand why Model one is called MVC1... Cause in the Model 1 we don't have that strong decoupling from Model view and controllor, in Model 1, a request is made to a JSP or servlet and then that JSP or servlet handles all responsibilities for the request... So if the sepration from the controller and the view is not an evidence, why call the Model 1, simply a subcategry of the MVC pattern? It's just the start of the historical process that brings us to the MVC achitecture.. Is my reasoning right? This article: http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/developing_mvc_applications/adf_aboutmvc2.html Seems to agree with me...but i would like to know what you think about...
upvote count: 1
possible better answer: http://stackoverflow.com/a/23935801
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23935801
has answer: http://stackoverflow.com/a/23936827
has title: Is Model 1 a subcategory of the MVC architecture?
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/23936827
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/36868952
score: 1

http://stackoverflow.com/comment/36875515
type: QuestionComment
has text: Strangely enough, my implementation I did a while ago for this looks pretty similar yet finishes in < 1 sec... Wonder what's going on
score: 0
comment on: http://stackoverflow.com/q/23940233
type: Comment

http://stackoverflow.com/comment/36774332
type: Comment
has text: It was the solution I used at the beginning, but looking up on Google I saw an example using only "E". It neither worked!
comment on: http://stackoverflow.com/a/23887133
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36771511
has text: you need to call `setHunger()` on the same Object like in the first GUI, otherwise it will not affect stats. For the timer, you can stop the first one and start a new one
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23885552

swt
tags question: http://stackoverflow.com/q/23800068
tags question: http://stackoverflow.com/q/23801057
tags question: http://stackoverflow.com/q/23851496
tags question: http://stackoverflow.com/q/23843053
tags question: http://stackoverflow.com/q/23867333
tags question: http://stackoverflow.com/q/23778686
tags question: http://stackoverflow.com/q/23845766
tags question: http://stackoverflow.com/q/23802046
tags question: http://stackoverflow.com/q/23925997
tags question: http://stackoverflow.com/q/23914372
tags question: http://stackoverflow.com/q/23842095
tags question: http://stackoverflow.com/q/23922110
tags question: http://stackoverflow.com/q/23923778
type: Tag
tags question: http://stackoverflow.com/q/23921731
tags question: http://stackoverflow.com/q/23929937
tags question: http://stackoverflow.com/q/23927587
tags question: http://stackoverflow.com/q/23779548
tags question: http://stackoverflow.com/q/23779010
tags question: http://stackoverflow.com/q/23822688
tags question: http://stackoverflow.com/q/23789257
tags question: http://stackoverflow.com/q/23881144
tags question: http://stackoverflow.com/q/23871547
tags question: http://stackoverflow.com/q/23864754
tags question: http://stackoverflow.com/q/23843259
tags question: http://stackoverflow.com/q/23876389
tags question: http://stackoverflow.com/q/23825805
tag name: swt
tags question: http://stackoverflow.com/q/23894512

http://stackoverflow.com/comment/36623199
has text: "run time error" is ambiguous. What exact error happens? What is the Ant code that causes the error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23808096
score: 0

http://stackoverflow.com/q/23788776
has answer: http://stackoverflow.com/a/23789026
tagged with: java
has comment: http://stackoverflow.com/comment/36587153
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/23789026
type: Question
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23789307
has comment: http://stackoverflow.com/comment/36587277
has answer: http://stackoverflow.com/a/23789485
has body: I'm having troubles calling a JPanel I made into a JFrame. The JPanel is called "SubnetPanel" ==> SubnetPanel panel = new SubnetPanel(String a, String b, String c); In my JFrame, I made a button. private void jButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String a = JOptionPane.showInputDialog(null, "Geef de naam in : ", "Naam", 1); String b = JOptionPane.showInputDialog(null, "Geef het netwerkadres in : ", "Netwerkadres", 1); String c = JOptionPane.showInputDialog(null, "Geef het subnetmask in : ", "Subnetmask", 1); this.add(new SubnetPanel(a,b,c) { @Override public void paintComponent( Graphics g ) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; Line2D line = new Line2D.Double(10, 10, 40, 40); g2.setColor(Color.blue); g2.setStroke(new BasicStroke(10)); g2.draw(line); } }); this.setVisible( true ); } But when I execute my JFrame and click the button, the JFrame does not appear. Can anyone help me with this? Thanks!
has answer: http://stackoverflow.com/a/23789307
has title: Calling a JPanel onto a JFrame
tagged with: jframe
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/23858817
has answer: http://stackoverflow.com/a/36136449
answer count: 2
has title: Jboss Issue when Running server in Eclipse
has comment: http://stackoverflow.com/comment/36751346
downvote count: 0
has body: I am trying to configure a local JBoss instance in Eclipse on Mac Every time i try to run the server I get the following error Exception in thread "main" java.lang.ExceptionInInitializerError at org.jboss.as.server.Main.main(Main.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.modules.Module.run(Module.java:272) at org.jboss.modules.Main.main(Main.java:313) Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager") at org.jboss.logmanager.Logger.getLogger(Logger.java:60) at org.jboss.logmanager.log4j.BridgeRepositorySelector.&lt;clinit&gt;(BridgeRepositorySelector.java:42) ... 7 more I am not entirely sure how to solve this so was hoping someone could help. Thanks
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/23912661
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jboss
possible better answer: http://stackoverflow.com/a/36136449
has answer: http://stackoverflow.com/a/23912661
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/36812522
type: Comment
type: AnswerComment
has text: If you are planning to extend only StringUtils, then this would work because it is highly unlikely that it will change. If you are planning to use this approach on custom classes, then(inspite of the downvotes :P) I still think its not the right approach.
score: 0
comment on: http://stackoverflow.com/a/23906848

http://stackoverflow.com/a/23859589
has comment: http://stackoverflow.com/comment/36732665
answers question: http://stackoverflow.com/q/23859540
has body: The easiest way would be to use SQL. Oracle offers nice examples in combination Oracle. In additional you need some knowledge about SQL a good starting point is W3Schools. Alterantive approach is to use a OR approach over Hibernate or EclipseLink and more. Hibernate. Useing the links above. I would highly recommand you to read at least the Oracle link. The SQL part is quite easy: 1) You need to create a Table with the Highscore information you need. Create Table - W3Schools 2) You need to create entries Insert entries - W3Schhols 3) Read entries / Highscores SELECT - W3Schhols
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/23822522
accepted answer of: http://stackoverflow.com/q/23822375
has comment: http://stackoverflow.com/comment/36651906
answers question: http://stackoverflow.com/q/23822375
type: AcceptedAnswer
has body: If you have a list a Java keywords, then you can turn it into a regex that matches those keywords like this (in principle - the following isn't meant to be used as actual code, just to illustrate how it works): "\\b(?:" + "if" + "|" + "for" + "|" + ... + "|" + "new" + "|" + "static" + ")\\b" That regex uses word boundary anchors to make sure it doesn't match if in the word knife, for example. It has no concept of semantics, though, so unless you have already done some parsing to separate comments or strings etc. from the "command parts" of the source code, then you will find matches in places where they are not necessarily being used as keywords.
upvote count: 3
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/23808291
has comment: http://stackoverflow.com/comment/36625444
score: 0
has comment: http://stackoverflow.com/comment/36623589
answers question: http://stackoverflow.com/q/23808116
has body: You may want to look into JMS Message Selectors. As per Docs The createConsumer and createDurableSubscriber methods allow you to specify a message selector as an argument when you create a message consumer. The message consumer then receives only messages whose headers and properties match the selector.
type: Answer

http://stackoverflow.com/q/23834689
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23834872
tagged with: arrays
tagged with: string
has answer: http://stackoverflow.com/a/23834841
favorite count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/36674078
has body: it is a program for removing duplicate characters from a string ... i just don't understand what flag[str[cur]] it refers to... class Cc1_3 { static String removeDup(String target) { if (target == null) return null; if (target.length() &lt;= 1) return target; char[] str = target.toCharArray(); boolean[] flag = new boolean[256]; int tail = 0; int cur = 0; while (cur &lt; str.length) { if (flag[str[cur]] == false) { flag[str[cur]] = true; str[tail] = str[cur]; tail++; cur++; } else cur++; } return new String(str, 0, tail); } public static void main(String[] args) { String test = "aabcdeaefgf"; System.out.println(removeDup(test)); } }
has title: can any one explain me how this program works
tagged with: java
linked to: http://stackoverflow.com/q/8549692
has answer: http://stackoverflow.com/a/23834874
type: Question
downvote count: 4

http://stackoverflow.com/a/23879204
has comment: http://stackoverflow.com/comment/36759394
has body: The answer is: Yes. It is possible of course. But one crucial thing is missing in your code. That "loop" you were mentioning. Swing is singlethreaded and it should be updated on EDT (Event dispatch thread). In your case, you should use swing Timer component to update your GUI and in same time to keep it responsive. Here is a simple demo: import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class JPanelDemo { JFrame frame = new JFrame(); Panel panel = new Panel(); JButton button1 = new JButton("Button 1"); JButton button2 = new JButton("Button 2"); public JPanelDemo() { panel.add(button1); panel.add(button2); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.pack(); frame.setSize(640, 480); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(JPanelDemo::new); } class Panel extends JPanel { Timer timer; //Example images String[] images = {"C:/Users/yourname/Pictures/Koala.jpg", "C:/Users/yourname/Pictures/Flower.jpg"}; BufferedImage image; int counter; public Panel() { // Use proper component to update your swing gui. // This is actually "The paint loop" timer = new Timer(0, ae -&gt; { try { image = ImageIO.read(new File(images[counter])); repaint(); revalidate(); counter++; if (counter == images.length) { counter = 0; } } catch (IOException e) { e.printStackTrace(); } }); timer.setRepeats(true); timer.setDelay(5000); timer.start(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, null); } } } I used swing Timer to repeatedly update background of JPanel for every 5 seconds while in same time my GUI remains responsive. Beside of that, I found one more problematic thing in your code. You have set null layout for your JPanel. Avoid that for any cost if you don't want to get into troubles. Use proper layout manager instead.
downvote count: 0
answers question: http://stackoverflow.com/q/23878889
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/36841075
type: QuestionComment
comment on: http://stackoverflow.com/q/23918610
has text: t3 date Wed May 28 19:38:25 CEST 2014 and tR3 date 2014-05-28 19:38:26.0
score: 0
type: Comment

http://stackoverflow.com/q/23825193
type: Question
score: 0
tagged with: eclipse-classpath
has title: Eclipse modify classpath on its own
tagged with: buildpath
has comment: http://stackoverflow.com/comment/36657731
has body: I have a quite annoying issue with Eclipse and the .classpath file. I usually used variable in my build path in order to be able to change of version easily. The issue with Eclipse its that the software break the variables set and put the build path in lib mode instead of var. for example from a var like that : &lt;classpathentry kind="var" path="NIAGARA_HOME/modules/platform.jar"/&gt; it destroy the kind and put it like that : &lt;classpathentry kind="lib" path="C:/Niagara/Niagara-3.7.106/modules/platform.jar"/&gt; and same thing for the JRE set : &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/&gt; to : &lt;classpathentry kind="lib" ----- etc. i didn't put the whole code of the JRE since it call directly each .jar file used in my project. How is it possible to fix it ? First I think it come from the issue when Eclipse is starting and doesn't find the variables set and automatically destroy all relation of var into lib.
has comment: http://stackoverflow.com/comment/36656063
has comment: http://stackoverflow.com/comment/42936593
answer count: 0
type: UnansweredQuestion
tagged with: classpath
has comment: http://stackoverflow.com/comment/36668571
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36746674
has text: I don't think you need a web.xml, since you are doing embeded Jetty. I know with Spring Boot you don't need it. I think You configure your servlets manually. As for your App Context, is it in the classpath? Shouldn't the DispatchServlet be reading that in?
score: 0
comment on: http://stackoverflow.com/q/23872785
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36723410
has text: Basically Scanner is more appropriate to use with input from user... and its api is not the best.. for reading files it is more appropriate to use BufferReader.. Look at this link for example http://stackoverflow.com/questions/20838244/difference-between-buffered-reader-and-file-reader-and-scanner-class
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23860064
type: Comment

http://stackoverflow.com/comment/36871857
comment on: http://stackoverflow.com/a/23914582
type: Comment
has text: You are posting a `png` but only allowing `jpg`. Try `@Consumes("image/png")`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36655181
type: Comment
comment on: http://stackoverflow.com/a/23824640
type: AnswerComment
has text: Your sample work ! Can you explain me the difference with SwingUtilities.invokeLater ? Why it doens't work without invoke later ?
score: 0

http://stackoverflow.com/a/23991389
type: Answer
has body: When you read the theory then usually the first classloader is called a bootstrap class loader. The instance will differ based on implementation (HotSpot, JRockit, IBM and based on version). There is more information on this at the Java API Specification.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23815485
downvote count: 0

http://stackoverflow.com/comment/36754898
comment on: http://stackoverflow.com/q/23876964
score: 0
type: Comment
type: QuestionComment
has text: I'm sorry. I'll try to explain again: for example in row 1, in each column starting at the third there is "DT". That means, do not mark a cross in column 2. That's the way i want to compare the table.

http://stackoverflow.com/a/23904849
score: 2
downvote count: 0
upvote count: 2
has body: The package structure must be reflected in the directory structure. If the class loader loads from C:\Users\user\\Desktop\jk the class must actually be stored here: C:\Users\user\Desktop\jk\com\load\data\JJJ.class
answers question: http://stackoverflow.com/q/23904748
type: Answer

http://stackoverflow.com/a/23789110
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23788838
has comment: http://stackoverflow.com/comment/36587667
has comment: http://stackoverflow.com/comment/36588377
has comment: http://stackoverflow.com/comment/36588521
score: 5
has body: Here, you have two instances of TestThread1 t1: One is stored into your t1 local variable (in your main method). One is stored into your thread instance variable (of t1). t1 is never started, t1.thread is. t1.stopThread() sets t1.thread to null, but it doesn't affect t1.thread.thread. Since you're starting t1.thread, its run method is using t1.thread.thread: This is never set to anything (so it's using null). Calling t1.stopThread() like you do would only set t1.thread to null, which wouldn't affect t1.thread.thread. More generally, you can't just "kill" a thread as such, but you can implement tests within the method to tell it to return under certain circumstances. What you've done with your second test is closer to this (using while (!finished) { ... } with a volatile variable). I wouldn't limit the test to finished. It's also useful to test whether the thread was interrupted, in particular because if you run your runnables within an ExecutorService shutdownNow() will try to interrupt them (see this question). I'd use while (!finished &amp;&amp; !Thread.currentThread().isInterrupted()) { ... }. (Note the difference between Thread.currentThread().isInterrupted() and Thread.interrupted(): they may seem similar, but the latter will also reset the status, which you might not want.) Depending on what's within your loop (or whether there is a loop at all), you may want to use something like if (finished || Thread.currentThread().isInterrupted()) { return; } at various strategic points, where it makes sense.
has comment: http://stackoverflow.com/comment/36588080
has comment: http://stackoverflow.com/comment/37103638
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36587532
has comment: http://stackoverflow.com/comment/36587554
has comment: http://stackoverflow.com/comment/36587783
has comment: http://stackoverflow.com/comment/36587637
type: Answer
has comment: http://stackoverflow.com/comment/36588277
has comment: http://stackoverflow.com/comment/36588169
has comment: http://stackoverflow.com/comment/36587589
has comment: http://stackoverflow.com/comment/36587593
has comment: http://stackoverflow.com/comment/36589708
answers question: http://stackoverflow.com/q/23788838

jsf
tags question: http://stackoverflow.com/q/23902621
tags question: http://stackoverflow.com/q/23859158
type: Tag
tags question: http://stackoverflow.com/q/23891230
tags question: http://stackoverflow.com/q/23780474
tags question: http://stackoverflow.com/q/23932568
tags question: http://stackoverflow.com/q/23907061
tags question: http://stackoverflow.com/q/23786556
tags question: http://stackoverflow.com/q/23924344
tags question: http://stackoverflow.com/q/23796665
tags question: http://stackoverflow.com/q/23916420
tags question: http://stackoverflow.com/q/23824730
tags question: http://stackoverflow.com/q/23779109
tags question: http://stackoverflow.com/q/23870008
tags question: http://stackoverflow.com/q/23861474
tags question: http://stackoverflow.com/q/23935471
tags question: http://stackoverflow.com/q/23937864
tags question: http://stackoverflow.com/q/23895163
tags question: http://stackoverflow.com/q/23937885
tags question: http://stackoverflow.com/q/23833109
tags question: http://stackoverflow.com/q/23885323
tags question: http://stackoverflow.com/q/23936733
tags question: http://stackoverflow.com/q/23911110
tags question: http://stackoverflow.com/q/23933875
tags question: http://stackoverflow.com/q/23803511
tags question: http://stackoverflow.com/q/23920090
tags question: http://stackoverflow.com/q/23868911
tags question: http://stackoverflow.com/q/23907202
tags question: http://stackoverflow.com/q/23785946
tags question: http://stackoverflow.com/q/23831706
tags question: http://stackoverflow.com/q/23800647
tags question: http://stackoverflow.com/q/23934605
tags question: http://stackoverflow.com/q/23872672
tags question: http://stackoverflow.com/q/23780544
tags question: http://stackoverflow.com/q/23851416
tags question: http://stackoverflow.com/q/23815933
tags question: http://stackoverflow.com/q/23808665
tags question: http://stackoverflow.com/q/23864958
tags question: http://stackoverflow.com/q/23930978
tags question: http://stackoverflow.com/q/23931009
tags question: http://stackoverflow.com/q/23838873
tags question: http://stackoverflow.com/q/23909599
tag name: jsf
tags question: http://stackoverflow.com/q/23920239
tags question: http://stackoverflow.com/q/23804822
tags question: http://stackoverflow.com/q/23909465
tags question: http://stackoverflow.com/q/23792831
tags question: http://stackoverflow.com/q/23800018
tags question: http://stackoverflow.com/q/23920198
tags question: http://stackoverflow.com/q/23823353
tags question: http://stackoverflow.com/q/23865126
tags question: http://stackoverflow.com/q/23874154
tags question: http://stackoverflow.com/q/23817254
tags question: http://stackoverflow.com/q/23910910
tags question: http://stackoverflow.com/q/23815552
tags question: http://stackoverflow.com/q/23834581
tags question: http://stackoverflow.com/q/23837008
tags question: http://stackoverflow.com/q/23890800
tags question: http://stackoverflow.com/q/23780193
tags question: http://stackoverflow.com/q/23890612
tags question: http://stackoverflow.com/q/23878113
tags question: http://stackoverflow.com/q/23789943

http://stackoverflow.com/q/23781142
has answer: http://stackoverflow.com/a/23781197
has title: Split() function for two consecutive regex in end of String
tagged with: java
linked to: http://stackoverflow.com/q/14602062
type: Question
duplicate of: http://stackoverflow.com/q/14602062
has body: every one I want to use for the strings like "Ravi;Dutt;;" but when I use split for this string . It gives result like mentioned above. I got an array of size 2. But in my requirement it should be of 3 as one for last two delimiters. Please help me thanks in advance.
score: 0
has comment: http://stackoverflow.com/comment/36573109
has comment: http://stackoverflow.com/comment/36572716
answer count: 1
type: UnansweredQuestion
tagged with: regex

http://stackoverflow.com/q/23820488
has answer: http://stackoverflow.com/a/23820554
type: Question
has comment: http://stackoverflow.com/comment/36647432
answer count: 1
has body: I am trying to make my JButton flicker red for this game I am creating. All the solutions on this website suggest using a thread and putting it to sleep or using a timer, however, the pause allays seems to come after the color change Here is my code: Color cb = board[Y1][X1].getBackground(); board[Y1][X1].setBackground(Color.RED); //Pause board[Y1][X1].setBackground(cb); If I put a thread and put it to sleep on line 3 and comment out line 4 the pause will come before the JButton is turned red. (Note board is just a 2D array of JButtons)
has comment: http://stackoverflow.com/comment/36647396
score: 0
tagged with: colors
tagged with: thread-sleep
type: UnansweredQuestion
has title: Java Swing JButton Time Delays (Flicker)
tagged with: swing
tagged with: jbutton
tagged with: java

http://stackoverflow.com/comment/36669512
score: 0
has text: Use `setOpaque(isSelected)` instead of the `if - else`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23830074

http://stackoverflow.com/q/23787622
type: Question
tagged with: java
has body: I have a gradle build script that looks like this: dependencies { compile project(':common:avro') .... fatJar { manifest { attributes 'Main-Class': 'package.subpackage.MainClass' } } I would like to be able to choose which MainClass to use from the command line and possibly also the resulting fat.jar name. Is this possible?
score: 0
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/23791073
type: AnsweredQuestion
has title: Gradle for multiple fatJars
tagged with: gradle
accepted answer: http://stackoverflow.com/a/23791073

http://stackoverflow.com/q/23869402
upvote count: 1
has comment: http://stackoverflow.com/comment/36740840
downvote count: 1
has answer: http://stackoverflow.com/a/23870297
tagged with: java
has comment: http://stackoverflow.com/comment/36741889
has body: i have to write a little parsing application, which is rewriting a postscriptfile with some additional infos. To reach that goal, i am just using a BufferedReader with a FileReader and a FileWriter. But i am reaching into a problem with an escape character (the % sign). Java is ignoring this character, the line "%!PS-Adobe-3.0" from the input file will be "!PS-Adobe-3.0" in the String and further the same in the output file. Do you fellaz have any ideas, how i can do that ... except from reading bytewise :D Best regards edit: Here is the code fragment ... the base file is in encoded in UTF8 : BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8")); String line = br.readLine(); Before i testet it with the following: BufferedReader br = new BufferedReader(new FileReader(args[0])); It fails at the same problem -> "%!PS-Adobe-3.0" from the input file became "!PS-Adobe-3.0" in the variable "line"
type: Question
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36741092
has comment: http://stackoverflow.com/comment/36740775
tagged with: character
has title: How to read % Character in Java
has comment: http://stackoverflow.com/comment/36740357
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/23931890
type: Question
has answer: http://stackoverflow.com/a/23932211
has answer: http://stackoverflow.com/a/23932385
tagged with: java
has body: For insert record in database with JDBC, there are two approaches : Nested try.. finally : In this approach, nested try with finally use for close prepare statement and connection public void performInsert(String insertSQL) { try { Connection connection = dataSource.getConnection(); try { PreparedStatement insertStmt = connection .prepareStatement(insertSQL); try { // bind value to prepare statements insertStmt.executeUpdate(); } finally { insertStmt.close(); } } finally { connection.close(); } } catch (SQLException e) { // TODO: handle exception } } single try with if condition in finally block : In this approach single try use and in finally block use if condition for close statement and connection: public void performInsertIF(String insertSQL) { Connection connection = null; PreparedStatement insertStmt = null; try { connection = dataSource.getConnection(); insertStmt = connection.prepareStatement(insertSQL); // bind value to prepare statements insertStmt.executeUpdate(); }catch (SQLException e) { // TODO: handle exception } finally { if( insertStmt != null) { try { insertStmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if( connection != null) { try { connection.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } Both above approach is working fine, but which approach is better to use and why ?
has answer: http://stackoverflow.com/a/23932034
has comment: http://stackoverflow.com/comment/36858893
has title: Which is the better approach nested try finally or one try with if condition
has answer: http://stackoverflow.com/a/23932454
downvote count: 0
favorite count: 0
tagged with: jdbc
answer count: 4
score: 2
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8066501

http://stackoverflow.com/a/23894871
answers question: http://stackoverflow.com/q/23894792
type: Answer
score: 6
downvote count: 0
has body: You absolutely can reinitialize a string variable - but at the moment you're redeclaring it. Instead of: String[] locationProjection = { ... }; you want: locationProjection = new String[] { ... }; It's not entirely clear whether that's a good idea or not, mind you - you may want to use a List&lt;T&gt; and create an unmodifiable list with each set of values. It seems an odd pattern to me... what are you trying to use this for? There may be a better approach.
upvote count: 6

http://stackoverflow.com/comment/36733460
type: QuestionComment
comment on: http://stackoverflow.com/q/23863188
score: 0
type: Comment
has text: @nizammoidu ok.. I've tried it with Oracle jdk 7.. it didnt work. Let me try it with java 6.

http://stackoverflow.com/comment/36817245
type: Comment
comment on: http://stackoverflow.com/a/23906953
has text: @noone Thanks for trying to solve this problem with me :). I actually copied parameters for world step from some tutorials on the web. TIME_STEP = 1/60f; VELOCITY_ITERATIONS = 6; POSITION_ITERATIONS = 2; This should be correct, right? Or do you think something else is wrong?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37183380
type: QuestionComment
comment on: http://stackoverflow.com/q/23931546
has text: How is it possible that the second code has less instrumentation code than the first one? The methods also access the fields. So if the profiler puts timing fences around field accesses, it will affect both codes.
score: 0
type: Comment

http://stackoverflow.com/q/23885846
downvote count: 0
answer count: 3
score: 2
has title: Lombok Setter, set input variable to be final
has answer: http://stackoverflow.com/a/23886283
favorite count: 0
accepted answer: http://stackoverflow.com/a/23885994
upvote count: 2
possible better answer: http://stackoverflow.com/a/23886064
has body: Is is possible using lombok to set the input variable of a @Setter method to be final. For example public void setCarName(final String carName){ this.carName = carName; } I don't know if this is even possible could not see it in the documentation.
has answer: http://stackoverflow.com/a/23886064
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: lombok
has answer: http://stackoverflow.com/a/23885994

http://stackoverflow.com/q/23790887
accepted answer: http://stackoverflow.com/a/23791742
type: Question
has answer: http://stackoverflow.com/a/23791235
has body: I'm not sure if this is possible using Regex but I'd like to be able to limit the number of underscores allowed based on a different character. This is to limit crazy wildcard queries to a search engine written in Java. The starting characters would be alphanumeric. But I basically want a match if there are more underscores than preceding characters. So BA_ would be fine but BA___ would match the regex and would get kicked out of the query parser. Is that possible using Regex?
tagged with: java
has answer: http://stackoverflow.com/a/23791656
has answer: http://stackoverflow.com/a/23791742
has comment: http://stackoverflow.com/comment/36591163
score: 5
answer count: 3
linked to: http://stackoverflow.com/q/23001137
favorite count: 0
has title: Regex to match and limit character classes
upvote count: 5
possible better answer: http://stackoverflow.com/a/23791235
has comment: http://stackoverflow.com/comment/36591392
tagged with: regex
linked to: http://stackoverflow.com/q/17003799
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/23914470
favorite count: 0
has title: How should I store this set of data into a Mongo Collection
type: AnsweredQuestion
has body: I have the following Data Structure { "routers": [ { "name": "", "ip address": "", } ], "devices": [ { "name": "", "mac address": [ &lt;address&gt;, &lt;address&gt;, &lt;address&gt; ], } ], "connection": [ { "source":"&lt;name&gt;", "destination":"&lt;name&gt;", } ] } I want to store this in a Mongo Database (in a Java web application). I just need some opinions on how to structure this. Do I put all of this JSON into one Mongo Collection, named "Environment"? I want to map the data to Java Objects, do I have three separate Objects "Router","Device" and "Connection" OR do I make one Java object "Environment" and have the three Java objects listed above in that particular object? I'm feeling like this second option is the best. I'm pretty much looking for some advice on the best way to design this, instead of trying to change it later on. Not that it matters, but I am going to also be using Jongo EDIT to show potential class: private class Environment { private List&lt;Router&gt;; private List&lt;Device&gt;; private List&lt;Connection&gt; ... } There would be multiple "Environment", essentially what we are building is a configuration management system so there are different "Configurations" of Environments.
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23914652
tagged with: java
accepted answer: http://stackoverflow.com/a/23914652
linked to: http://stackoverflow.com/q/15314769
type: Question
tagged with: mongodb
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23951401
has answer: http://stackoverflow.com/a/23951401

http://stackoverflow.com/comment/36750735
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23875078
has text: Please, could you post the code inside `loadDrawingFromFile`? Maybe there is something useful there

http://stackoverflow.com/comment/36649291
type: QuestionComment
has text: that's exactly what I'm thinking @gerrytan if there is a different code I can use to refer for each OS as in using the full timezone name to reference the tz name. But then those are not standard too. I also thought I could use an offset to then find a compatible timezone.
comment on: http://stackoverflow.com/q/23820896
score: 0
type: Comment

http://stackoverflow.com/comment/36760110
has text: Analytics V4 is part of Google Play Services. Did you follow the [setup instructions](https://developer.android.com/google/play-services/setup.html)?
type: Comment
comment on: http://stackoverflow.com/q/23879500
score: 0
type: QuestionComment

http://stackoverflow.com/a/23909634
score: 2
answers question: http://stackoverflow.com/q/23907391
downvote count: 0
upvote count: 2
has body: Most likely you have configured perf4j with Spring AOP and since Spring AOP proxies are not invoked when a method is called from inside the same class (as in your case with the test method), no performance statistics will be recorded. Check out this blog post which explains Spring AOP pitfalls One solution to your problem would be to use AspectJ with perf4j, since AspectJ can handle this type of situation
type: Answer

http://stackoverflow.com/a/24113293
score: 0
has body: I don't think your code isn't using OpenMP or TBB as it stands. To use OpenMP, you would typically add something like '#pragma omp...' before your loops. Something like: //#pragma omp parallel for private(j) for(j = 0; j &lt; _eyesVec.size(); j++ ) { cv::rectangle(faceROIColor, Rect(_eyesVec[j].x,_eyesVec[j].y,_eyesVec[j].width,_eyesVec[j].height), cv::Scalar(0,255,0),2,8,0); } You must also make sure you are using the opencv binaries that have OpenMP enabled (compiled with the WITH_OPENMP option)
type: Answer
answers question: http://stackoverflow.com/q/23875462

http://stackoverflow.com/a/23931127
accepted answer of: http://stackoverflow.com/q/23931002
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23931002
has body: Escapse \ character twice (one for java and one for regex) String reg2 = "^[a-zA-Z0-9@\\\\#$%&amp;*()_+\\]\\[';:?.,!^-]{8,}$";
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/comment/36865771
comment on: http://stackoverflow.com/q/23935486
type: Comment
type: QuestionComment
score: 1
has text: IllegalStateException or null and where you use createInitialConnection check if != null

http://stackoverflow.com/a/23904294
answers question: http://stackoverflow.com/q/23901494
upvote count: 1
downvote count: 0
type: Answer
has body: In the 1.1 docs you can find this example: The following would use the findByNameStartsWith query method defined on the PersonRepository for all Person entities with names starting with the letter "K" and add sort data that orders the results on the name property in descending order: curl -v http://localhost:8080/people/search/nameStartsWith?name=K&amp;sort=name&amp;name.dir=desc So in your case it would be: curl -v http://localhost:8080/person/search/ageBetween?min=xxx&amp;max=yyy
score: 1

http://stackoverflow.com/comment/36764558
score: 1
has text: @GiruBhai "success" is there in the last with value equal to 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23881999

http://stackoverflow.com/comment/36859235
comment on: http://stackoverflow.com/a/23931884
score: 0
type: AnswerComment
type: Comment
has text: this will leave index[0] as unused.

http://stackoverflow.com/a/23899005
score: 2
answers question: http://stackoverflow.com/q/23898790
has body: The while loop will reevaluate the expression every time the program cycles through the loop. If the same expression involves a method call that could change value depending on the state of something else, then the while loop could make sense; there's nothing special about the syntax. We're apparently dealing with a function that will return 0 or a negative number until something else happens. In Android, for instance, there's a getWidth() that will return 0 until a layout is rendered on the screen, by some other thread, and the width won't be computed until that happens. But using a busy loop to wait for things to happen is definitely the wrong approach on Android, and it's probably wrong in other contexts as well. And using a busy loop that doesn't pause for breath between checks is just terrible and could freeze an app. But the other point is that although a loop like this is legal and sometimes useful, this is an awful way to write it. Much better would be while (getImage().getWidth(frame) &lt;= 0) ; or while (getImage().getWidth(frame) &lt;= 0) /* nothing */ ; or while (getImage().getWidth(frame) &lt;= 0) { } all of which make it clear to the reader that this isn't a typo (although the last makes it look like they were planning to add a body later but forgot to). But, going past the readability issue, what you really want is probably more like while (getImage().getWidth(frame) &lt;= 0) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } or if possible, use wait and notify, or various other synchronization methods.
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/23843788
has answer: http://stackoverflow.com/a/23846227
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
type: AnsweredQuestion
has body: I am trying to build a simple XML DOM in Java for Android. This works fine but the Android namespace prefix is always set to "ns0" but it should be "android" DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); doc = factory.newDocumentBuilder().newDocument(); doc.setXmlStandalone(true); Element manifest = doc.createElement("manifest"); manifest.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:android",NS_ANDROID); manifest.setAttributeNS(NS_ANDROID, "versionName", "bla"); doc.appendChild(manifest); The output I get is the following: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ns0="http://schemas.android.com/apk/res/android" ns0:versionName="bla"/&gt; What do I need to change to get the following result: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="bla"/&gt;
downvote count: 0
score: 1
tagged with: java
has title: Java DOM: How to add a namespace with a specific prefix?
type: Question
accepted answer: http://stackoverflow.com/a/23846227
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36709635
type: Comment
has text: @VeilEclipse yep, it will return `Collection` consisting of two `Integer`s: `mark1` and `mark2`
comment on: http://stackoverflow.com/a/23853008
type: AnswerComment
score: 0

http://stackoverflow.com/q/23813006
tagged with: android
answer count: 0
upvote count: 3
type: Question
score: 3
tagged with: java
has body: I've been Googling all over the place for this but I can't find an answer. Do I have to own a legal business to set up a merchant wallet? Is it okay if I use my home address? And should I put my developer name down for "credit card statement name"? And is it okay if I use my own developer email for "customer support email"? I know this isn't a programming question per se, but I just really need an answer from someone who knows this stuff.
downvote count: 0
has comment: http://stackoverflow.com/comment/67689777
favorite count: 0
has title: Setting up Google Merchant Wallet for IAP?
type: UnansweredQuestion

http://stackoverflow.com/comment/36872635
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54739/discussion-between-simego-and-luiggi-mendoza).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23937864

http://stackoverflow.com/a/31128168
downvote count: 0
answers question: http://stackoverflow.com/q/23904359
type: Answer
has body: it's been awhile since you've posted this. I looked at this post a few minutes ago because I was having the same problem with replace! not doing what I expected. Rather than continuing with replace!, I instead used something like (do (config! my-container :items (build-new-items)) (repaint! my-container)). You might want to try this if you still want to declutter your code.
score: 1
upvote count: 1

http://stackoverflow.com/comment/36769260
type: QuestionComment
has text: Please explain, or suggest somewhere where I could research stacktrace?
score: 0
comment on: http://stackoverflow.com/q/23884454
type: Comment

http://stackoverflow.com/q/23836145
answer count: 2
has comment: http://stackoverflow.com/comment/36680424
has answer: http://stackoverflow.com/a/23840133
downvote count: 0
tagged with: adapter
has comment: http://stackoverflow.com/comment/36684718
has comment: http://stackoverflow.com/comment/36680449
favorite count: 0
has comment: http://stackoverflow.com/comment/36679874
has answer: http://stackoverflow.com/a/23840172
accepted answer: http://stackoverflow.com/a/23840172
tagged with: custom-adapter
tagged with: android
has title: ListView all elements show "false" text next to correct text? Custom Adapter malfunction maybe?
has body: I can't figure out why it says "false" on this listview. I am Guessing it is most likely because of the custom adapter, but can't find the problem. ScreenShot: I tried to change background color to black as a lazy escape but then "false" switched to white. I used this tutorial, but they obviously didn't have the same problem. Here is my code: public class ContactsList extends Activity{ String eventCode,message; MyCustomAdapter dataAdapter = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contacts_list); setTitle("Invite Some People"); Intent intent = getIntent(); eventCode=intent.getStringExtra("eventcode"); ArrayList&lt;Contact&gt; ctcs=getContacts(); //create an ArrayAdaptar from the String Array dataAdapter = new MyCustomAdapter(this, R.layout.rowbuttonlayout, ctcs); ListView listView = (ListView) findViewById(R.id.listView1); // Assign adapter to ListView listView.setAdapter(dataAdapter); } public void checkButtonClick(View v) { //SmsManager smsManager = SmsManager.getDefault(); //smsManager.sendTextMessage(phoneNo, null, message, null, null); Button myButton = (Button) findViewById(R.id.findSelected); myButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { StringBuffer responseText = new StringBuffer(); responseText.append("The following were selected...\n"); ArrayList&lt;Contact&gt; contactList = dataAdapter.contactList; for(int i=0;i&lt;contactList.size();i++){ Contact contact = contactList.get(i); if(contact.isChecked()){ responseText.append("\n" + contact.getName()); } } Toast.makeText(getApplicationContext(), responseText, Toast.LENGTH_LONG).show(); } }); } private ArrayList&lt;Contact&gt; getContacts() { ArrayList&lt;Contact&gt; contacts = new ArrayList&lt;Contact&gt;(); Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null); while (phones.moveToNext()) {try{ String cont…
has comment: http://stackoverflow.com/comment/36677017
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23840133
tagged with: listview
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36687790

user-input
tags question: http://stackoverflow.com/q/23865490
type: Tag
tags question: http://stackoverflow.com/q/23922885
tag name: user-input

http://stackoverflow.com/q/23828337
tagged with: junit
answer count: 1
linked to: http://stackoverflow.com/q/2172152
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23828338
tagged with: unit-testing
type: Question
tagged with: java
tagged with: eclipse
has title: Android - JUnit testing Models/Controllers (which only use java imports) without the Android Emulator deploy
accepted answer: http://stackoverflow.com/a/23828338
score: 0
has body: I've got two different UnitTest Projects for my Android App Project. One for the Model Classes (which only uses java imports), and one for the Activities (which obviously uses both java &amp; android imports). In Eclipse, when I use the option Run As -> Android JUnit Test on either of those two UnitTest Projects, I'm getting the following in my Console: [2014-05-23 11:02:23 - MyProject.test] Android Launch! [2014-05-23 11:02:23 - MyProject.test] adb is running normally. [2014-05-23 11:02:23 - MyProject.test] Performing android.test.InstrumentationTestRunner JUnit launch [2014-05-23 11:02:23 - MyProject.test] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'MyEmulator' [2014-05-23 11:02:27 - MyProject.test] Application already deployed. No need to reinstall. [2014-05-23 11:02:27 - MyProject.test] Project dependency found, installing: MyProject [2014-05-23 11:02:30 - MyProject] Application already deployed. No need to reinstall. [2014-05-23 11:02:30 - MyProject.test] Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554 [2014-05-23 11:03:03 - MyProject.test] Sending test information to Eclipse [2014-05-23 11:03:40 - MyProject.test] Test run finished Both UnitTest Projects work and give test-results, but since it's using the Emulator to test, it takes a bit of time before the results show up. Now my question: Is it possible to run an Android UnitTest Project, which only uses java imports, as a JUnit, without having to use the Emulator? Which would result in much faster test-results. When I try the option Run As -> JUnit Test I'm getting the following error: # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (classFileParser.cpp:3494), pid=388, tid=1680 # Error: ShouldNotReachHere() # # JRE version: 6.0_31-b05 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.6-b01 mixed mode windows-amd64 compressed oops) # An error report file with more information is saved as: # C:\U…

javafx-2
tags question: http://stackoverflow.com/q/23824466
tags question: http://stackoverflow.com/q/23790106
type: Tag
tags question: http://stackoverflow.com/q/23794940
tags question: http://stackoverflow.com/q/23837139
tags question: http://stackoverflow.com/q/23884190
tags question: http://stackoverflow.com/q/23920801
tag name: javafx-2

textview
tags question: http://stackoverflow.com/q/23937238
tags question: http://stackoverflow.com/q/23916134
tags question: http://stackoverflow.com/q/23891736
tag name: textview
type: Tag
tags question: http://stackoverflow.com/q/23844226
tags question: http://stackoverflow.com/q/23880353

http://stackoverflow.com/comment/36765445
type: QuestionComment
has text: I just need to verify that the IReporter's generateReport() is called after test execution.
score: 0
comment on: http://stackoverflow.com/q/23882277
type: Comment

http://stackoverflow.com/comment/36721457
comment on: http://stackoverflow.com/a/23853610
type: Comment
type: AnswerComment
has text: Yes, SunPKCS11 provider doesn't support OAEP padding. If OAEP is crucial for you, then there is a need to make OAEP padding removal additionally after decryption.
score: 0

http://stackoverflow.com/q/23916796
answer count: 1
has comment: http://stackoverflow.com/comment/36831518
tagged with: aviary
has body: So a library I want to use depends on OkHttp 1.2.1, and I am currently using the newest version of OkHttp 2.0. This naturally results in a compilation error as multiple dex files are generated for the same classes. I don't quite want to manually update the library, and I do require the newest version of OkHttp. Is there a way to somehow prioritize the latest version of OkHttp for any of my classes, and have the library continue to use the old version?
has title: Android dependencies with libraries
tagged with: android
tagged with: okhttp
tagged with: dependencies
has comment: http://stackoverflow.com/comment/36860955
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23918525
accepted answer: http://stackoverflow.com/a/23918525
type: Question
has comment: http://stackoverflow.com/comment/36833771
has comment: http://stackoverflow.com/comment/36883195
tagged with: java
score: 0

http://stackoverflow.com/comment/36669442
comment on: http://stackoverflow.com/a/23831902
has text: @Duncan This is a good time for me to [post a link to this question I posted last year](http://stackoverflow.com/questions/18770943/mockito-junit-hamcrest-versioning?rq=1)
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23848248
answer count: 3
has answer: http://stackoverflow.com/a/23848432
upvote count: 0
favorite count: 0
has title: setOnclickListener for a button help please
tagged with: android
has comment: http://stackoverflow.com/comment/36700251
has comment: http://stackoverflow.com/comment/36700316
has answer: http://stackoverflow.com/a/23848369
has comment: http://stackoverflow.com/comment/36700246
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23848380
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23848380
tagged with: java
score: -1
has body: just getting started with Android development and I can't figure out why this won't work. Here is the error that I am getting (last line before bold block-quote): package com.ample.ballv2; import java.util.Random; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } Button answer = (Button) findViewById(R.id.answerbutton); answer.setOnClickListener(answerL); } private OnClickListener answerL = new OnclickListener(){ public void onClick(view v) { Random token = random(); int tokenno = token.nextInt(10); CharSequence ans = ""; switch(tokenno) {case 0:ans=getString(R.string.msg0);break; case 1: ans=getString(R.string.msg1);break; case 2: ans=getString(R.string.msg2);break; case 3: ans=getString(R.string.msg3);break; case 4: ans=getString(R.string.msg4);break; case 5: ans=getString(R.string.msg5);break; case 6: ans=getString(R.string.msg6);break; case 7: ans=getString(R.string.msg7);break; case 8: ans=getString(R.string.msg8);break; case 9: ans=getString(R.string.msg9);break; case 10:ans=getString(R.string.msg10);break; } Context context = getApplicationContext(); Toast msg = Toast.makeText(context,ans,Toast.LENGTH_LONG); msg.show(); } }//error's popping up here > Description Resource Path Location Type Syntax error, insert ";" to complete FieldDeclaration MainActivity.ja…
accepted answer: http://stackoverflow.com/a/23848369

http://stackoverflow.com/q/23822401
has comment: http://stackoverflow.com/comment/66836615
has comment: http://stackoverflow.com/comment/36653881
linked to: http://stackoverflow.com/q/2408613
type: UnansweredQuestion
has title: How to get BufferedImage of CMYK type JPEG images
tagged with: javax.imageio
has body: I am not able to get the BufferedImage object of a CMYK image. ImageIO.getInstance(imgLocation) is giving an Exception for CMYK images. My intention is to compress a CMYK type image and print it in PDF. Everywhere i find suggestions to convert CMYK images to RGB and compress, but the conversion is brightening the image. Any solution to reduce the size of generated PDF with CMYK image would be helpful.
answer count: 0
has comment: http://stackoverflow.com/comment/36650855
tagged with: java
tagged with: itext
tagged with: image-processing
type: Question
linked to: http://stackoverflow.com/q/3123574
has comment: http://stackoverflow.com/comment/36653567
tagged with: image
score: 0

http://stackoverflow.com/q/23866898
has body: so when ever i fill up my text boxes and hit add my app comes crushing down , when its in debug mode it highlights in the String passwd = passowd.getText().toString() ; but here is the oncreateview method @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View rootview = inflater.inflate(R.layout.loging_fragment , container , false ); return rootview; name = (EditText) getActivity().findViewById(R.id.txtuser); passowd = (EditText) getActivity().findViewById(R.id.txtpaswd); session = new SessionManager(getActivity()); btnlogin = (Button) getActivity().findViewById(R.id.btnlogin); btnlogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub HashMap&lt;String, String&gt;user = session.getUserDetails(); String uname = user.get(session.KEY_NAME); String psswd = user.get(session.KEY_PASSWORD); String usernam = name.getText().toString(); String passwd = passowd.getText().toString() ; if ( usernam == uname | passwd == psswd) { Intent i = new Intent(getActivity(), MainActivity.class); startActivity(i); } else { Toast.makeText(getActivity(), "Enter username and password ", Toast.LENGTH_SHORT).show(); } } }); } now i do not know what goes wrong down there plus am real new in android....
has answer: http://stackoverflow.com/a/23867001
type: Question
score: 0
answer count: 1
tagged with: tostring
has comment: http://stackoverflow.com/comment/36735804
tagged with: java
type: UnansweredQuestion
has title: fragment crushes when it comes to convert text box data into string

http://stackoverflow.com/a/23913306
has body: I would use Find in Path with Regular expression. Text to find: would be something like that: @MyAnnotation\n\spublic.*myMethod1() regards
score: 0
answers question: http://stackoverflow.com/q/23907168
type: Answer

timer
tag name: timer
tags question: http://stackoverflow.com/q/23876524
tags question: http://stackoverflow.com/q/23859039
tags question: http://stackoverflow.com/q/23798791
tags question: http://stackoverflow.com/q/23844057
tags question: http://stackoverflow.com/q/23783882
tags question: http://stackoverflow.com/q/23790456
tags question: http://stackoverflow.com/q/23790146
type: Tag
tags question: http://stackoverflow.com/q/23820454
tags question: http://stackoverflow.com/q/23885552
tags question: http://stackoverflow.com/q/23808172
tags question: http://stackoverflow.com/q/23837504
tags question: http://stackoverflow.com/q/23811609
tags question: http://stackoverflow.com/q/23780345
tags question: http://stackoverflow.com/q/23824130
tags question: http://stackoverflow.com/q/23932887

http://stackoverflow.com/q/23878586
has title: How to integrate a JavaScript API with GWT?
type: Question
tagged with: gwt
linked to: http://stackoverflow.com/q/12812164
tagged with: javascript
has body: I am trying to develop a Documentum D2 External Widget with GWT. D2 provides an API built in JavaScript from OpenAjaxHub for communication. So, I tried to import this API to my GWT App inside a public folder and added to my gwt.xml the scripts. So, doing something simple like this... public class WidgetTest implements EntryPoint { @Override public void onModuleLoad() { final RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(new Label("Hello")); init(); } private native void init() /*-{ var d2OpenAjaxHub = new D2OpenAjaxHub(); }-*/; } I get the Error: com.google.gwt.core.client.JavaScriptException: (ReferenceError) @com.vilt.widgetTest.client.WidgetTest::init()([]): D2OpenAjaxHub is not defined The gwt.xml... &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd"&gt; &lt;module rename-to="widgetTest"&gt; &lt;inherits name="com.google.gwt.user.theme.clean.Clean" /&gt; &lt;inherits name="com.google.gwt.user.User" /&gt; &lt;script src="OpenAjaxManagedHub-all.js" /&gt; &lt;script src="D2-OAH.js" /&gt; &lt;source path="client" /&gt; &lt;entry-point class="com.vilt.widgetTest.client.WidgetTest" /&gt; &lt;/module&gt; and about the D2-OAH.js (I am extracting just a bit of it): D2OpenAjaxHub = function() { this.hubClient = null; if (typeof(console) == 'undefined') console = {}; if (typeof(console.log) == 'undefined') console.log = function(){}; if (typeof(console.debug) == 'undefined') console.debug = console.log; if (typeof(console.error) == 'undefined') console.error = console.log; // /////////////////// // CONTEXT / WIDGET INFO // /////////////////// this.sContextUid = null; this.sWidgetType = null; this.sWidgetId = null; this.bActive = true; // /////////////////// // EVENTS // /////////////////// this.registeredChannelIds = new Array(); this.registeredChannels = new Array(); this.sStoredChannel = null; this.sS…
tagged with: documentum
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23878923
possible better answer: http://stackoverflow.com/a/23878602
has answer: http://stackoverflow.com/a/23878602
has answer: http://stackoverflow.com/a/23878923
type: AnsweredQuestion
tagged with: documentum-d2
tagged with: java

http://stackoverflow.com/comment/36807797
type: QuestionComment
has text: Where are you testing this application?
score: 0
comment on: http://stackoverflow.com/q/23904391
type: Comment

http://stackoverflow.com/comment/36647686
type: Comment
comment on: http://stackoverflow.com/a/23820388
has text: I don't know how to do disable it. Should I post it in a new question?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23874971
downvote count: 0
has body: If you look at the source code. 1883 public View findViewById(int id) { 1884 return getWindow().findViewById(id); 1885 } 1886 The return type is View. Since its a EditText object you cast it to EditText. EditText editText = (EditText) findViewById(R.id.edit_message); // this (EditText) is explicit casting
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23874949

http://stackoverflow.com/comment/36707608
has text: If the values are being read from a file, you should really be using `Scanner`'s `nextInt()` method.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23851668

http://stackoverflow.com/q/23839826
has answer: http://stackoverflow.com/a/23839881
has body: My program parses SQL VALUES multi-row string into single-row string array. Typical input string looks like: (11,'-1','Service A (nested parentheses)','en') (22,'-2','Service B (nested parentheses)','en') Desired output: group 1: 11,'-1','Service A (nested parentheses)','en' group 2: 22,'-2','Service B (nested parentheses)','en' I have tried following regexp, with partial luck only: \(('.*?'|.*?)\) What would be the right way to handle this in regexp? EDIT: Target platform is Java 6/7 There is no need in replacing the parentheses with new line - only to capture the groups
has comment: http://stackoverflow.com/comment/36684400
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36684432
score: 5
has answer: http://stackoverflow.com/a/23840317
has comment: http://stackoverflow.com/comment/36684374
upvote count: 5
downvote count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23840467
has title: regex: split by parentheses ignore nested parentheses inside quotes
has answer: http://stackoverflow.com/a/23840467
tagged with: regex
favorite count: 0
accepted answer: http://stackoverflow.com/a/23840317

http://stackoverflow.com/q/23860331
score: -3
tagged with: swing
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36724017
type: Question
upvote count: 0
answer count: 1
tagged with: user-interface
has title: Switch selection between button and text field
favorite count: 0
has comment: http://stackoverflow.com/comment/36724399
has answer: http://stackoverflow.com/a/23860633
has body: I'm writing a piece of software in Java, with a GUI programmed using swing. The user has to do this two operations in a loop: write some words in a text field (let's call it A) and press Enter click a button (let's call it B) After Enter is pressed, some other fields show some data. After the button is clicked, all text fields are cleared and the procedure restarts. The text field to fill in is always A and the button to click is always B. This is what I would like to implement: After the text field is filled and Enter is pressed, the button is somehow selected so that if the user presses Enter again the button is clicked After the button is pressed, the text field is selected and in "write mode", so that the user can immediately start typing What is the easiest method to implement this? Below I'm reporting what I have already tried. I tried this to make the button selected immediately after Enter is pressed in the text field: this.getRootPane().setDefaultButton(ButtonNextQuestion); but when I press Enter, it is registered both by the text field and the button and I cannot see intermediate data. I tried also with these lines: ButtonNextQuestion.requestFocus(); ButtonNextQuestion.setSelected(true); in this case everything seems working, but when I press enter the button is not clicked.
type: UnansweredQuestion

http://stackoverflow.com/comment/36729619
comment on: http://stackoverflow.com/a/23837505
score: 0
type: AnswerComment
type: Comment
has text: You mean the line where you click on `login` button? If so, can you see in your code if you have checked the `checkbox` below username or emailid text field. I think it's mandatory to check that option, if you select enter emailid.

http://stackoverflow.com/comment/36629931
score: 0
type: Comment
type: QuestionComment
has text: Does it generate a jar file? .class files? is there an ant task to run the program itself?
comment on: http://stackoverflow.com/q/23811559

http://stackoverflow.com/a/23870487
answers question: http://stackoverflow.com/q/23870239
has body: Instead of using a Jpanel to show a message you can try to use a dialogue window. For this example you can use (try this code, but it can contain errors): Object[] options = {"&lt;html&gt;&lt;center&gt;RESET&lt;br&gt;CENTRE", "&lt;html&gt;&lt;center&gt;OFFSET&lt;br&gt;CENTRE"}; int n = JOptionPane.showOptionDialog(frame, "Left click...", // the title of the window "Pop-up window", // the meassage in the window JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, //the titles of buttons options[0]); You have a lot of other options. you can explore it in the api or in the website I gave previously. It is much simplier, because you don't need to have actionperformed methods! Good Work!
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36742562
downvote count: 0

http://stackoverflow.com/comment/36725651
has text: I don't have errors- the project will run. But in the Android simulator I see two gray buttons with no text instead of the images I have included.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23839739
type: Comment

http://stackoverflow.com/a/23916312
score: 0
answers question: http://stackoverflow.com/q/23916122
type: Answer
has body: It's generally not good to have too many constructors. It gives you a good opportunity to express how it should be used. public static Point Create(double... p) { if(p.length == 2) return Point(p[0], p[1]); else if(p.length == 3) return Point(p[0], p[1], p[2]); // default case or throw error } Alternatively you can create an initialize method, which you call from the constructors.

http://stackoverflow.com/comment/36585756
type: Comment
has text: By "two level of nesting" are you referring to the `{FOO {OOPS} BAR}` in my example `{1:{CLIENT ACCOUNT}, 2:{FOO {OOPS} BAR}, 3:{TEST}}`? If so, what do you ***expect*** the outcome to be..please update OP :)
comment on: http://stackoverflow.com/a/23787839
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36657143
has text: I can access the url through my browser but when I am trying to ping the hostname it does not reply back.
comment on: http://stackoverflow.com/a/23825713
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23918514
has comment: http://stackoverflow.com/comment/36837830
has comment: http://stackoverflow.com/comment/36834899
answer count: 1
has body: I am working on a TIFF encoder to encode with new JPEG compression (Technote2). To make it more like a new style JPEG, I am writing 2 strips with JPEG tables written separately. It works fine most of the time but with some special cases - image width equals 1000, 2000, 3000 etc, the encoded image become all gray color. I am sure the problem is not from any kind of overflow of data type and there isn't any error shown. I inspected the tags with AsTiffTagViewer but couldn't see any problem there. Note: if I write only 1 strip, there is no problem for any image size. The following is the relevant part: int rowsPerStrip = imageHeight/2 + 1; // Two strips JPEGWriter jpgWriter = new JPEGWriter(); // Write first strip jpgWriter.write(Arrays.copyOfRange(pixels, 0, imageWidth*(imageHeight/2 + 1)), imageWidth, imageHeight/2 + 1, randomOS); // Another strip jpgWriter.write(Arrays.copyOfRange(pixels, imageWidth*(imageHeight/2 + 1), pixels.length), imageWidth, imageHeight - imageHeight/2 - 1, randomOS); Here randomOS is a random access output stream to work with TIFF and pixels is an int array for the whole image. The tags shown by ASTiffTagViewer for One example image I have with dimension 2000x3000 are as follows: &gt; SubFileType (1 Long): Zero &gt; ImageWidth (1 Long): 2000 &gt; ImageLength (1 Long): 3000 &gt; BitsPerSample (3 Short): 8, 8, 8 &gt; Compression (1 Short): JPEG Technote #2 &gt; Photometric (1 Short): YCbCr &gt; StripOffsets (2 Long): 8, 82430 &gt; SamplesPerPixel (1 Short): 3 &gt; RowsPerStrip (1 Short): 1501 &gt; StripByteCounts (2 Long): 82422, 82422 &gt; PlanarConfig (1 Short): Contig &gt; DateTime (24 ASCII): 2014:05:28 13:29:54 EDT &gt; JpegTables (574 Undefined): &gt; YCbCrSubsampling (2 Short): 1, 1 &gt; ReferenceBlackWhite (3 Rational): The original image is just a fill with orange color, the same number of StripByteCounts should not be the problem. I have looking through Technote2 trying to find something I might have missed without success. I am hopin…
has comment: http://stackoverflow.com/comment/36837537
has comment: http://stackoverflow.com/comment/36837928
tagged with: http://stackoverflow.com/tag/jpeg
has comment: http://stackoverflow.com/comment/36840995
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36834373
tagged with: java
tagged with: compression
has title: Writting multi-strip JPEG encoded TIFF image failed with some image width
has comment: http://stackoverflow.com/comment/36837919
has answer: http://stackoverflow.com/a/25041379
accepted answer: http://stackoverflow.com/a/25041379
type: Question
tagged with: tiff
has comment: http://stackoverflow.com/comment/36841165
tagged with: image
score: 0

http://stackoverflow.com/a/24222526
has body: Configure Path to Java SQL-Developer needs to know how to find your Java Developer Kit: Note: You need to specify /usr/lib/jvm/java-6-openjdk-i386 on 32-bit OS installations. Terminal cd $HOME mkdir -p .sqldeveloper cd $HOME/.sqldeveloper echo "/usr/lib/jvm/java-6-openjdk" > jdk
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23800251
has comment: http://stackoverflow.com/comment/38732425

http://stackoverflow.com/comment/36865814
has text: If the remote side doesnt send NOTIFYs you should be looking at their logs. I don't understand your app very well. IMHO you should fix the exceptions and provide clean log. Also take a look at Jitsi, I think they support p2p presence in the way you are trying to implement it with JSIP.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23914687
type: AnswerComment

http://stackoverflow.com/q/23783710
tagged with: java
has comment: http://stackoverflow.com/comment/36577671
type: Question
score: 3
has answer: http://stackoverflow.com/a/23784029
has body: Here I have two strings. From that, how can I remove common alphabets/characters and store in result(third) String? &lt;% String[] firstString = {"google out"}; String[] secondString = {"stack overflow"}; String[] result={""}; for (int i = 0,k=0; i &lt; firstString.length; i++,k++) { for (int j = 0; j &lt; secondString.length; j++) { if (firstString[i].equalsIgnoreCase(secondString[j])) { } else { result[k]=result[j]+firstString[i]; out.println(result[k]); } } } %&gt; expected result is: g l e o u t s c k v f w
has answer: http://stackoverflow.com/a/31089032
possible better answer: http://stackoverflow.com/a/23783883
has answer: http://stackoverflow.com/a/23784377
has answer: http://stackoverflow.com/a/23783883
has comment: http://stackoverflow.com/comment/36577513
downvote count: 0
has title: How to remove duplicate alphabets from two strings in java without any builtin functions?
tagged with: string
has comment: http://stackoverflow.com/comment/36578335
favorite count: 0
accepted answer: http://stackoverflow.com/a/23784377
answer count: 4
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/36640961
type: Comment
has text: An interesting side effect of this though is that depending on the expression you're referencing, it may or may not trigger the loading of the referenced class at runtime. Which is somewhat scary.
score: 1
comment on: http://stackoverflow.com/a/23817174
type: AnswerComment

http://stackoverflow.com/comment/37016809
type: Comment
score: 1
type: AnswerComment
has text: Yes registering an interceptor on the "clientInboundChannel" is the right place for something like this. It intercepts all messages right after they're parsed and before any other message handling takes place.
comment on: http://stackoverflow.com/a/23959441

http://stackoverflow.com/comment/37016712
has text: Looks like it is a bug in Spring https://jira.spring.io/browse/SPR-9133 Just tried a newer version and it works. :S
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23931352
type: AnswerComment

pool
tags question: http://stackoverflow.com/q/23845268
tag name: pool
type: Tag
tags question: http://stackoverflow.com/q/23893793

http://stackoverflow.com/q/23823794
has body: I would like to have a jtable with 4 columns. One column must be a combobox. Other columns are strings. When i click one time on a cell, i would like the cell become editable with blinking caret/cursor.Also, if i click on the combobox i would like the combox set popup visble. I have read and tested tutorial "How to Use Tables", and if i make just one click on combobox in the cell, it opens. My first problem is that i don't understand why the code in the tutorial works when we implement abstract table model and not working DefaultTableModel. My code is : import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import javax.swing.DefaultCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; public class JtabletestOK { public static void main(String[] args) { JtabletestOK test = new JtabletestOK(); test.go(); } public void go() { //create the frame JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //create a table and add it to a scroll pane in a new tab JTable jTable1 = new JTable() { // Place cell in edit mode when it 'gains focus' public void changeSelection( int row, int column, boolean toggle, boolean extend) { super.changeSelection(row, column, toggle, extend); if (editCellAt(row, column)) { Component editor = getEditorComponent(); editor.requestFocusInWindow(); // System.out.println("ffin focus gagne"); if (editor instanceof JTextField) { JTextField jf = (JTextField) editor; jf.select(0, jf…
tagged with: combobox
favorite count: 0
has answer: http://stackoverflow.com/a/23824640
tagged with: swing
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/23833065
downvote count: 0
tagged with: java
type: Question
has title: Jtable jcombobox and cell editing
has comment: http://stackoverflow.com/comment/36654747
has answer: http://stackoverflow.com/a/23844409
accepted answer: http://stackoverflow.com/a/23844409
tagged with: jtable
upvote count: 3
has answer: http://stackoverflow.com/a/23833065
answer count: 3

http://stackoverflow.com/comment/36675564
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23834529
has text: Share your insights! You can write your own answer and other people might find it useful…

http://stackoverflow.com/q/23912610
has comment: http://stackoverflow.com/comment/36834093
tagged with: swing
has comment: http://stackoverflow.com/comment/36823453
has comment: http://stackoverflow.com/comment/36822945
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36841367
type: Question
has comment: http://stackoverflow.com/comment/36842001
has answer: http://stackoverflow.com/a/23924757
has title: Initialization of application and splash-screen with progress bar (Swing)
has comment: http://stackoverflow.com/comment/36837936
answer count: 1
has body: We have built a splash screen for our application. It works fine when the initialization of application is in the main thread, but when I move the initialization in EDT (SwingUtilities.invokeLater in main method), the progress bar and info label do not repaint itself due to blocking of EDT. I know, that using of invokeLater can help me to repaint the GUI. But my problem is: it's really hard to split the initialization of aplication in separate pieces (legacy code). And even if I do it, I will get a ugly matroshka-code (six times invokeLater in invokeLater). Which solution should I prefer: Leave initialization in main thread (my current decision) Try to move it to EDT (if possible) and get matroshka code Using Foxtrot lib to provide a non-blocking-sleep in EDT each time I update the splash screen (it works fine - the splash screen can repaint itself, but it's a hack for me) Probably someone has a better solution? P.S. I've already read some similar questions here but did not found anything helpful for me.
has comment: http://stackoverflow.com/comment/36822940
has comment: http://stackoverflow.com/comment/36823251
linked to: http://stackoverflow.com/q/2064427
upvote count: 3
tagged with: splash-screen
favorite count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/67447167
upvote count: 1
answers question: http://stackoverflow.com/q/23902492
downvote count: 0
has body: java.time The legacy date-time API (java.util date-time types and their formatting API, SimpleDateFormat) is outdated and error-prone. It is recommended to stop using it completely and switch to java.time, the modern date-time API*. Also, check the following notice at the Home Page of Joda-Time; Joda-Time is the de facto standard date and time library for Java prior to Java SE 8. Users are now asked to migrate to java.time (JSR-310). Solution using the modern API: The modern date-time API is based on ISO 8601 and does not require you to use a DateTimeFormatter object explicitly as long as the date-time string conforms to the ISO 8601 standards. import java.time.OffsetDateTime; public class Main { public static void main(String[] args) { OffsetDateTime odt = OffsetDateTime.parse("2014-05-19T07:16:29.63+00:00"); System.out.println(odt); } } Output: 2014-05-19T07:16:29.630Z The Z in the output is the timezone designator for zero-timezone offset. It stands for Zulu and specifies the Etc/UTC timezone (which has the timezone offset of +00:00 hours). For any reason, if you need to convert this object of OffsetDateTime to an object of java.util.Date, you can do so as follows: Date date = Date.from(odt.toInstant()); Learn more about the the modern date-time API* from Trail: Date Time. * For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.
type: Answer
score: 1

http://stackoverflow.com/a/23916249
answers question: http://stackoverflow.com/q/23914387
downvote count: 0
has body: You can use the SpEL ternary operator as described here: http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/spring-framework-reference/html/expressions.html &lt;spring:bean id="someOtherClass" class="org.demo.SomeOtherClass"&gt; &lt;spring:property name="injectedClass" ref="#{ my.config.doInject ? myClass : null } /&gt; &lt;spring:property name="someOtherProperty" value="12345"/&gt; &lt;/spring:bean&gt;
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/23904821
tagged with: http://stackoverflow.com/tag/c
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23919389
favorite count: 0
type: UnansweredQuestion
has title: How to send std::list<std::string> in JNI C to Android
tagged with: android
has body: sample.cc: std::list&lt;std::string&gt; lst; lst.push_back("this"); lst.push_back("is"); lst.push_back("test"); lst.push_back("message"); java_c_reference.cc: CALLBACK_START("handleSampleData",**XXXX**, objectReference); if(mid != NULL){ env-&gt;CallVoidMethod(reference_-&gt;handler_object, mid, **YYYY**); } DETACH_FROM_VM(reference_); Here XXXX is signature and YYYY is JNI datatype How to use a Signature and JNI type for std::list&lt;std::string&gt; lst to obtain my lst in Java ArryList&lt;String&gt; Test.java: public void handleSampleData(ArrayList&lt;String&gt; arrSample){ }
tagged with: list
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-native-interface

http://stackoverflow.com/q/23875240
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
has body: I try to play mp3 chace file from cache like this: public int onStartCommand(Intent intent, int flags, int startId){ objPlayer2.start(); return START_NOT_STICKY; } public void onCreate() { super.onCreate(); String cururl = "http://www.somesite.com:80/stream"; cururltag = Integer.parseInt(cururl); File tempMp3; try { tempMp3 = File.createTempFile("temp", ".mp3"); tempMp3.deleteOnExit(); FileOutputStream fos = new FileOutputStream(tempMp3); url = new URL(cururl); inputStream = url.openStream(); int bufferSize = 1024; byte[] bufferz = new byte[bufferSize]; int c; while ((c = inputStream.read(bufferz)) != -32) { fos.write(bufferz, 0, c); } objPlayer2 = new MediaPlayer(); objPlayer2.setDataSource(this, Uri.fromFile(tempMp3)); objPlayer2.setAudioStreamType(AudioManager.STREAM_MUSIC); objPlayer2.setOnPreparedListener(this); objPlayer2.setOnErrorListener(this); objPlayer2.prepareAsync(); } catch (IOException e) { e.printStackTrace(); } } in processs i get error: android.os.NetworkOnMainThreadException How i can to play temporary file not in main thread without any errors?
has answer: http://stackoverflow.com/a/23875352
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36750985
type: Question
has title: NetworkOnMainThreadException While read Audio temp file from cache
tagged with: android-mediaplayer
tagged with: networkonmainthread
answer count: 1
linked to: http://stackoverflow.com/q/6343166
tagged with: exception

http://stackoverflow.com/q/23781104
has title: Java if-else condition to change output color
tagged with: if-statement
has comment: http://stackoverflow.com/comment/36572745
has answer: http://stackoverflow.com/a/23782188
has body: I have this piece of code that I'm stuck with, basically what I'm trying to do is display a different colour of font according to the result. For example if the returnval &gt; 0 (positive), the output font will be blue, and if the returnval &lt; 0 (negative), the output font will be red. I think it is simple; however, the thing that I've tried so far doesn't work. Below is the code, hope you guys can guide me. while (rs1.next()) { if (rs1.getString("groupAcc") != null) groupAcc = rs1.getString("groupAcc"); if (rs1.getString("returnvalue") != null) returnval = rs1.getDouble("returnvalue"); if (returnval &gt; 0){ returnval = "&lt;font color=\"#3d9900\"&gt;&lt;/font&gt;"; } else { returnval = "&lt;font color=\"#e64343\"&gt;&lt;/font&gt;"; } // returnval if(rs1.getString("LOGIN") != null) login = rs1.getString("LOGIN"); if (rs1.getString("username")!=null) wallet_each_acc = rs1.getString("username"); HTML: &lt;td align="right"&gt;&lt;span class="box_acc_percent"&gt;&lt;%=returnval %&gt;%&lt;/span&gt;&lt;/td&gt;
score: 0
has answer: http://stackoverflow.com/a/23781939
downvote count: 2
answer count: 3
accepted answer: http://stackoverflow.com/a/23781939
has comment: http://stackoverflow.com/comment/36572730
favorite count: 0
has comment: http://stackoverflow.com/comment/36572803
tagged with: css
possible better answer: http://stackoverflow.com/a/23781346
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36572978
has answer: http://stackoverflow.com/a/23781346
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/a/23855251
downvote count: 1
has body: Have you tried setting the color to transparent? try this: playButton.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.3f); This sets the R to 0, G to 0, B to 0, and alpha(transparency) to 0.3. Make sure to use float values to set the colours. the numbers can be tweaked to whatever you like. If you want to change the transparency, change the last number to higher for more opaque, and lower for less. Good Luck!
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/36714177
answers question: http://stackoverflow.com/q/23854923
score: -1

http://stackoverflow.com/comment/37037993
score: 0
has text: No problem - it took me a week or so to find the problem in my code and I will hopefully NEVER make this mistake again.
type: Comment
comment on: http://stackoverflow.com/a/24027072
type: AnswerComment

http://stackoverflow.com/q/23936133
tagged with: java
has comment: http://stackoverflow.com/comment/36873068
tagged with: web-applications
type: Question
has comment: http://stackoverflow.com/comment/36874840
has comment: http://stackoverflow.com/comment/36868412
has comment: http://stackoverflow.com/comment/37052282
score: 0
has title: File upload to an application server through a web client
tagged with: file-upload
has comment: http://stackoverflow.com/comment/36867449
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/36870204
tagged with: php
has body: I'm actually on a project using sockets communications in Zend Framework. We have an application server (Java) hosted on a server, and a web client on another server, in php. The application server is the only one having access to the database, and we'd like to be able to send a file from the web client to the server, via file upload. While this is easy when everything happens on the same server, we don't really know how to do it this way. We thought about uploading the file temporarily on the web server, then send it asynchronously from the web server to the application server, and delete it in the web server when it's done, via cron jobs for example. Problem is that it will take some room, seems quite heavy and has an unnecessary step in the sending of files. It will also requires to make a database to keep track of the files, so that solution doesn't seem to be optimal. Is there a simpler way to do it that we didn't think about ?
answer count: 0

http://stackoverflow.com/comment/36822946
comment on: http://stackoverflow.com/a/23911502
type: AnswerComment
score: 0
type: Comment
has text: Yes now error is resolved. But I can not see 'label' column in the output its only showing lat and long :|

http://stackoverflow.com/a/23843833
has comment: http://stackoverflow.com/comment/36691658
has comment: http://stackoverflow.com/comment/36692082
score: 0
has comment: http://stackoverflow.com/comment/36692135
answers question: http://stackoverflow.com/q/23843805
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36691953
accepted answer of: http://stackoverflow.com/q/23843805
type: Answer
has body: I want only the number, I want to delete "Rooms: " from the result. Use Matcher#group() to get the matched group that is enclosed inside the Parenthesis ()that is used to enable grouping of regex phrases. Here group(1) returns the (\\d+) if found. Sample code: Pattern pattern = Pattern.compile("Rooms:\\s+(\\d+)"); Matcher matcher = pattern.matcher("Rooms: 2 Bedrooms: 1 Surface: 37 m² "); if (matcher.find()) { System.out.println(matcher.group(1)); // output 2 only } Please have a look at Java Regex Pattern where all the pattern are explained in details. Find sample code here on Java Tutorials - Quantifiers
has comment: http://stackoverflow.com/comment/36691633
has comment: http://stackoverflow.com/comment/36691644
has comment: http://stackoverflow.com/comment/36691991
has comment: http://stackoverflow.com/comment/36691722
has comment: http://stackoverflow.com/comment/36691906

http://stackoverflow.com/q/23806344
has comment: http://stackoverflow.com/comment/36875110
downvote count: 1
has answer: http://stackoverflow.com/a/23961255
has comment: http://stackoverflow.com/comment/36771731
type: Question
tagged with: url-encoding
has comment: http://stackoverflow.com/comment/36889773
has comment: http://stackoverflow.com/comment/36890884
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36619819
has body: I have problems with sending AES encrypted data from JAVA to PHP. My encrypt function: public static byte[] encrypt(String input, String key, String iv) { byte[] raw = key.getBytes(Charset.forName("UTF8")); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); try { Cipher cipher = Cipher.getInstance(CIPHER_MODE); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, new IvParameterSpec(iv.getBytes())); return cipher.doFinal(padString(input).getBytes("UTF-8")); } catch (Exception e) { } return new byte[0]; } encrypt function is returning data in byte array To send POST data, I'm using apache HttpClient/HttpPost (preferred, but not necessary) HttpEntity params = MultipartEntityBuilder.create() .addTextBody("data1", new String(encodedData1, Charset.forName("UTF8"))) .addTextBody("data2", new String((encodedData2, Charset.forName("UTF8"))) .addTextBody("data3", "data3").build(); Now, I recieve data with PHP server (i can't add functionality here) $data1 = filter_input(INPUT_POST, 'data1'); $data2 = filter_input(INPUT_POST, 'data2'); $data1decoded = DecryptAES($data1, $key, $iv); $data2decoded = DecryptAES($data2, $key, $iv); What is a proper way to send encoded byte[] from JAVA to PHP? I know, that Base64.encode would be probably best option, but unfortunately (as I have mentioned earlier) I can't modify PHP server-side code... new String(encodedData1, Charset.forName("UTF8")) is not working. In node.js I can use toString('binary') to send data in proper format.
accepted answer: http://stackoverflow.com/a/23960808
linked to: http://stackoverflow.com/q/8512121
tagged with: post
has title: Sending ByteArray from PHP to Java
possible better answer: http://stackoverflow.com/a/23961080
favorite count: 0
has comment: http://stackoverflow.com/comment/36655876
has answer: http://stackoverflow.com/a/23961080
has comment: http://stackoverflow.com/comment/36656099
answer count: 3
has comment: http://stackoverflow.com/comment/36667998
has comment: http://stackoverflow.com/comment/36667712
tagged with: php
has comment: http://stackoverflow.com/comment/36619700
has comment: http://stackoverflow.com/comment/36714855
has answer: http://stackoverflow.com/a/23960808
tagged with: aes
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36659471
has comment: http://stackoverflow.com/comment/36772605
has comment: http://stackoverflow.com/comment/36668460
upvote count: 2

http://stackoverflow.com/a/23855948
type: Answer
has body: In java the subclass - in your case GridNewValue automatically has the same properties as its parent class. So unless you override getColorValue() in the GridNewValue class, when calling (new GridNewValue()).getColorValue() it will call the method in the parent.
score: 0
answers question: http://stackoverflow.com/q/23855912

http://stackoverflow.com/a/23783688
score: 0
answers question: http://stackoverflow.com/q/23780963
type: Answer
has comment: http://stackoverflow.com/comment/36581074
has body: It's not very complicated, you can disable the masking characters when you set this value to “0″ with this method: setEchoChar((char) 0) pass.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { unhide(); } public void removeUpdate(DocumentEvent e) { unhide(); } public void insertUpdate(DocumentEvent e) { unhide(); } public void unhide(){ pass.setEchoChar((char) 0);//display password //here your timer pass.setEchoChar('*');//hide with '*' } }); The code above shows you a first idea of ​​what you should do. You'll have to use a thread to wait for the desired time.

http://stackoverflow.com/comment/36619461
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23804459
has text: You could have a look at Smack sources. It may provide you you a hint on how to avoid the exception.
score: 0

http://stackoverflow.com/a/23910180
has body: Comparable&lt;T&gt; is an interface whose contract means "we can compare this object to one of type T". If the object itself is of that type T, then the object is comparable to itself. This is the behavior that we desire here. Examples of similar behavior are Integer which implements Comparable&lt;Integer&gt;. Here, this method requires that you pass in objects that are comparable to themselves. If those objects are of type T then they must implement Comparable&lt;T&gt; in order to be comparable with each other. Since generic extends/implements constraints use the keyword extends in all cases, the generic declaration is T extends Comparable&lt;T&gt;.
upvote count: 1
answers question: http://stackoverflow.com/q/23910114
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/36894069
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23917743
has text: FYI, I got this bug recently: java.lang.NoSuchFieldException: sHasPermanentMenuKey : at java.lang.Class.getDeclaredField(Class.java:596). It happened with 6 different users, all using version 4.4.2.

http://stackoverflow.com/comment/36687966
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23841325
has text: You are welcome. Your question remind me that it made me confused too!
type: AnswerComment

http://stackoverflow.com/a/23869305
score: 0
answers question: http://stackoverflow.com/q/23869019
has body: findViewById() works with reference to a root view. Without having a view in the first place will throw a null pointer exception In any activity you set a view by calling setContentView(someView);. Thus when you call findViewById() , its with reference to the someView. Also findViewById() finds the id only if its in that someView. So in you case null pointer exception For fragments, adapters, activity, .... any view's findViewById() will only find if the id exixts in the view Alternately if you are inflating a view, then you can also use inflatedView.findViewById() to get a view from that inflatedView In short make sure you have the id in your layout you are referring to or make findViewById() call in appropriate place(Ex. adapters getView(), activity's onCreate() or onResume() or onPause() , fragments onCreateView(), ....) Also have an idea about UI &amp; background thread's as you cannot efficiently update UI in bg-threads
type: Answer

http://stackoverflow.com/comment/36717940
score: 0
type: AnswerComment
has text: Its not working still , i try something similar to add background color as well with the tablecellrenderer.
comment on: http://stackoverflow.com/a/23857324
type: Comment

http://stackoverflow.com/comment/36600904
type: AnswerComment
type: Comment
has text: Object Oriented programming.
comment on: http://stackoverflow.com/a/23796073
score: 0

http://stackoverflow.com/q/23830650
has comment: http://stackoverflow.com/comment/36667836
tagged with: postgresql
has title: Why do I get EOFException when deserializing an encrypted object?
has body: I am writing a serialized and encrypted object to a database via encrypted ByteArrayOutputStream into a Large Object. I can retrieve this Large Object, but I cannot deserialize it. Here is my code for writing: public void addMessages(int ID, List&lt;Message&gt; messages) { ObjectOutput output = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayInputStream bais = null; output = new ObjectOutputStream(CryptoHandler.encryptedStream(baos)); output.writeObject(messages); bais = new ByteArrayInputStream(baos.toByteArray()); output.close(); baos.close(); getMessages(ID, bais); } And here is for reading: public List&lt;Message&gt; getMessages(int ID, ByteArrayInputStream bais) { List&lt;Message&gt; messages = new ArrayList&lt;&gt;(); ObjectInput oi = CryptoHandler.decryptedObjectStream(bais); messages = (List&lt;Message&gt;) oi.readObject(); //here is where i get the EOFException } The encryption works fine with file stream, so therotically it should work here too. UPDATE: As sugested, I linked the output and the input skipping the DB, and I get the same error. I deleted the DB related code and updated the remaining to keep the question clean. Here is my code to encrypt the stream: public static CipherOutputStream encryptedStream(OutputStream out) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES"); SecretKey key = keyFactory.generateSecret(new PBEKeySpec(PASSWORD)); Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES"); pbeCipher.init(Cipher.ENCRYPT_MODE, key, new PBEParameterSpec(SALT, 20)); return new CipherOutputStream(out, pbeCipher); } catch (NoSuchAlgorithmException ex) { Logger.getLogger(CryptoHandler.class.getName()).log(Level.SEVERE, null, ex); }//Much more catches here... } public static ObjectInputStream decryptedObjectStream(InputStream in) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES"); SecretKey key = keyFactory.generateSecret(new PBEKeySpec(PASSWORD)); Ciphe…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36667223
tagged with: encryption
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36692942
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36667156
accepted answer: http://stackoverflow.com/a/23843293
has comment: http://stackoverflow.com/comment/36667920
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23843293

http://stackoverflow.com/a/23917684
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: When you extend a class, you automatically inherit the static methods of the parent classes too.
accepted answer of: http://stackoverflow.com/q/23917629
answers question: http://stackoverflow.com/q/23917629

http://stackoverflow.com/comment/36742201
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23870172
has text: And converting array to list?

http://stackoverflow.com/a/23905569
answers question: http://stackoverflow.com/q/23905333
type: Answer
has body: Same problem happen with me. Might be possible one of your libraries are using some classes internal which is not available in your lib or maven dependency pom.xml. Thats means you have analyze your error logs and identify these classes and then import all dependencies in maven or lib folder. I have fixed this error by the same way. because some of my libraries are using activation.jar and json.jar internally.
score: 0

http://stackoverflow.com/q/23864174
has title: Making container to occupy same space for components in GridLayout
has comment: http://stackoverflow.com/comment/36731322
tagged with: grid-layout
has comment: http://stackoverflow.com/comment/36731254
has body: In my swing application I have to create a number panel for taking user input. The required numbers can change according to requirement (For example at one place it contain numbers 1-90, at another place it contains 1-36 numbers). My problem is that at both places the space in the bottom of the panel and on the right side changes when number of buttons change (from 36 to 90). How can I manage that? I am sending the code for the reference. public class TestNumberPanel extends JPanel { private static final long serialVersionUID = 1L; private JButton[] btns; private static int NUM_BTNS = 42; private int initialValue = 1; private int gridRows = 6; private int gridCols = 7; public JButton[] getNumBtns() { return btns; } public TestNumberPanel(final int btns) { NUM_BTNS = btns; if (NUM_BTNS == 42) { gridRows = 6; gridCols = 7; } else if (NUM_BTNS == 90) { gridRows = 10; gridCols = 9; } else if (NUM_BTNS == 36) { gridRows = 6; gridCols = 6; } initComponents(); } private void initComponents() { btns = new JButton[NUM_BTNS]; for (int i = 0; i &lt; NUM_BTNS; i++) { btns[i] = new JButton(); btns[i].setBorder(BorderFactory.createLineBorder(Color.BLUE, 2)); btns[i].setText(String.valueOf(initialValue)); add(btns[i]); initialValue++; } setPreferredSize(new java.awt.Dimension(500, 370)); // setBackground(ScreenColor.COLOR_WHITE); setBorder(new EmptyBorder(0, 5, 5, 0)); // GridLayout gridLayout = new GridLayout(gridRows, gridCols, 5, 5); // gridLayout.minimumLayoutSize(this); setLayout(new GridLayout(gridRows, gridCols, 5, 5)); // setLayout(gridLayout); } @SuppressWarnings("serial") public static void main(String[] args) { new JFrame() { { try { add(new TestNumberPanel(36)); pack(); setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }; } } Any suggestion for improvement in this code also will be appreciated. Thanks in advance.
tagged with: layout-manager
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36731047
tagged with: swing
has comment: http://stackoverflow.com/comment/36731544
answer count: 0
has comment: http://stackoverflow.com/comment/36731036
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36732827
score: 0

http://stackoverflow.com/q/23847379
has body: How would I go about checking a string contains an ip address? example "Hello guys" returns false "Hello guys here is my ip 22.27.0.0" returns true Thanks!
has comment: http://stackoverflow.com/comment/36698397
score: -7
type: AnsweredQuestion
has title: Checking if a String Contains an IP
has comment: http://stackoverflow.com/comment/36698501
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/3669903
accepted answer: http://stackoverflow.com/a/23847538
has comment: http://stackoverflow.com/comment/36698435
type: Question
has comment: http://stackoverflow.com/comment/36699358
possible better answer: http://stackoverflow.com/a/23847719
duplicate of: http://stackoverflow.com/q/3669903
has answer: http://stackoverflow.com/a/23847719
has comment: http://stackoverflow.com/comment/36698400
answer count: 2
has comment: http://stackoverflow.com/comment/36698493
has comment: http://stackoverflow.com/comment/36699145
favorite count: 0
has answer: http://stackoverflow.com/a/23847538
has comment: http://stackoverflow.com/comment/36698693
has comment: http://stackoverflow.com/comment/36698849
downvote count: 8

http://stackoverflow.com/comment/36742139
type: Comment
has text: I've now included my full code with class. Kindly have a look and let me know the error
comment on: http://stackoverflow.com/a/23870135
type: AnswerComment
score: 0

http://stackoverflow.com/a/23840570
has comment: http://stackoverflow.com/comment/36685752
answers question: http://stackoverflow.com/q/23840528
type: Answer
has comment: http://stackoverflow.com/comment/36685706
upvote count: 1
has comment: http://stackoverflow.com/comment/36686319
has body: That is not the correct way to access a static method. this is not static. Instead do Basic5.main_hooo()
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36685829

http://stackoverflow.com/a/23924251
downvote count: 2
has comment: http://stackoverflow.com/comment/36846440
score: 1
answers question: http://stackoverflow.com/q/23923696
has body: Turn off this inspection: File -> Settings -> Inspections(under Project Settings) -> Unused declaration(under Declaration redundancy group)， move the hook before it.
type: Answer
has comment: http://stackoverflow.com/comment/36845972
upvote count: 3

http://stackoverflow.com/q/23885014
type: Question
has comment: http://stackoverflow.com/comment/36770342
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36770234
favorite count: 0
has answer: http://stackoverflow.com/a/23885249
tagged with: selenium-webdriver
has body: When I am running this code a runtime Exception is thrown by Compiler, String ExistUser = driver.findElement(By.xpath(".//*@id='**UserBody']/tr[j]**/td[1]")).getText(); while when I changed j into 1, I get the output String ExistUser = driver.findElement(By.xpath(".//*@id=**'UserBody']/tr[1]**/td[1]")).getText(); but I am unable to understand why it happens, can anyone please help me. if (driver.findElements(By.xpath(".//*[@id='UserBody']/tr[1]/td[1]") ).size()!= 0) { int j; for (j=1 ; j&lt; 10; j++) { String ExistUser = driver.findElement(By.xpath(".//*@id='UserBody']/tr[j]/td[1]")).getText(); //String value = ExistUser.getAttribute("value"); System.out.println(ExistUser); } }
has answer: http://stackoverflow.com/a/23885157
tagged with: selenium
upvote count: 1
possible better answer: http://stackoverflow.com/a/23885249
type: AnsweredQuestion
tagged with: testing
accepted answer: http://stackoverflow.com/a/23885157
score: 1
tagged with: java
has title: Unable to change value to element dynamically in Selenium Webdriver
tagged with: ui-automation

http://stackoverflow.com/q/23917030
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/39635740
tagged with: netty
has answer: http://stackoverflow.com/a/25397918
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36841093
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36839333
type: Question
accepted answer: http://stackoverflow.com/a/25397918
has title: Exception during Netty server shutdown
has body: I have application running on Tomcat. I use Netty 4 for websocket handling. Netty server run in ServletContextListener in contextInitialized method and stop in contextDestroyed. This my class for Netty server: public class WebSocketServer { private final int port; private final EventLoopGroup bossGroup; private final EventLoopGroup workerGroup; private Channel serverChannel; public WebSocketServer(int port) { this.port = port; bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); } public void run() throws Exception { final ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .childHandler(new WebSocketServerInitializer()); serverChannel = b.bind(port).sync().channel(); System.out.println("Web socket server started at port " + port + '.'); System.out .println("Open your browser and navigate to http://localhost:" + port + '/'); } public void stop() { if (serverChannel != null) { ChannelFuture chFuture = serverChannel.close(); chFuture.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { shutdownWorkers(); } }); } else { shutdownWorkers(); } } private void shutdownWorkers() { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } It's work fine after running, but when I try stop Tomcat I get exception: INFO: Illegal access: this web application instance has been stopped already. Could not load io.netty.util.concurrent.DefaultPromise$3. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1610) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.…
has comment: http://stackoverflow.com/comment/36871384

http://stackoverflow.com/comment/36726507
comment on: http://stackoverflow.com/q/23861287
has text: I modified and added a working copy of my code. I labeled each .java file at the top of the code and put it into code quotes.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23838700
has comment: http://stackoverflow.com/comment/36682402
has body: I need some advice on how to manage state of hash map/Array list when it comes to service running on server. I am trying designing IP address management system in which requirement is when ever API call happens, method should provide first available which is not been allocated IP address from the hash map/Array list. I considered two approaches for this. When ever IP address is allocated to some logical name, default.property file is created for that particular IP address/logical name which stores all information. So each time request comes I can go through all files to check what IP addresses are assigned previously and than allocate IP address. But I think this will increase processing time. I can maintain data structure which will have all available IP addresses ad I will stores that object in a file each time ip address is allocated. But I feel this will lead to single point of failure. It will be great if any one can advice me on this Thanks for your time.
downvote count: 0
has comment: http://stackoverflow.com/comment/36682286
answer count: 1
has comment: http://stackoverflow.com/comment/36682457
has answer: http://stackoverflow.com/a/78918655
favorite count: 0
has comment: http://stackoverflow.com/comment/36682714
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
tagged with: ip-address
has comment: http://stackoverflow.com/comment/36682313
has title: Managing data struture state on multithreaded application
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/36806080
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23903407
has text: How do you process individual pixels in this method?
score: 0

http://stackoverflow.com/comment/37387256
comment on: http://stackoverflow.com/a/23801098
score: 1
has text: Interestingly, at least one of the Eclipse maintainers [thinks otherwise](https://bugs.eclipse.org/bugs/show_bug.cgi?id=435485)... No response from Oracle yet, and don't think there will be one anytime soon.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23924794
type: Answer
score: 2
has body: System.out.println ("User: " + nameQualified + "\n"); **//Error here** System.out.println ("Users Address: " + addressQualified + "\n"); **//Error here** Wrong syntax, it's "+" instead of "," "+" is used for concatenation of String "," is used to separate different arguments/parameters for methods.
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23924773
answers question: http://stackoverflow.com/q/23924773

http://stackoverflow.com/comment/36664401
score: 0
has text: I have tried using the normal for loops for finding the conflicts and splitting it. But I feel I am trying to reinvent the wheel and the code doesnt look neat also. In the java world, there will be many libraries available which can split the date-ranges based on the conflicts(eg: apache commons for string related manipulations).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23829640

http://stackoverflow.com/comment/36752170
comment on: http://stackoverflow.com/q/23875543
type: Comment
type: QuestionComment
has text: But `readBoolean()` is blocking operation so it would wait for something to be sent.I don't think this is not the issue.
score: 2

http://stackoverflow.com/a/23909822
has body: The spaces / border visible on your screenshot is just the spacing of the parent panel, it is not the border of the JProgressBar. For example you will see no borders around the progress bar in this example: final JFrame f = new JFrame("Test"); final JProgressBar pb = new JProgressBar(); pb.setValue(50); f.getContentPane().add(pb); f.pack(); f.setVisible(true); But if you use a JPanel as content pane with FlowLayout which has default 5 pixel horizontal and veritcal gap, you will see something like in your screenshot. f.setContentPane(new JPanel(new FlowLayout())); The spaces disappear if you use 0 spacing between components like this: f.setContentPane(new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)));
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23909205
has comment: http://stackoverflow.com/comment/36861419
has comment: http://stackoverflow.com/comment/36857418

http://stackoverflow.com/q/23834521
has title: Android FTP DownLoad Progressbar
answer count: 1
has answer: http://stackoverflow.com/a/49672210
has comment: http://stackoverflow.com/comment/36674082
has body: FTP code, but only the download... public class ImageUploadTask extends AsyncTask &lt;String, Void, String&gt;{ String e; protected String doInBackground(String...args) { String strResponce = ""; ftpClient = new FTPClient(); s="finish"; try { ftpClient.connect(InetAddress.getByName(SERVER)); ftpClient.login(USERNAME, PASSWORD); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); textTargetUri.setText("good"); final String remote = "/1.jpg";//FTP adress/filename String savefilepath = "/sdcard/download"+remote; File downloadfile = new File(savefilepath);//download local = new FileOutputStream(downloadfile); ftpClient.retrieveFile(remote, local); local.close(); ftpClient.disconnect(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ } return s; } } BUT!! FTP DownLoad code do insert CountingOutputStream function. CountingOutputStream function is commons-io-2.4.jar. project in commons-io-2.4.jar and commons-net-3.3.jar to there. T_T public class ImageUploadTask extends AsyncTask &lt;String, Void, String&gt;{ String e; protected String doInBackground(String...args) { String strResponce = ""; ftpClient = new FTPClient(); s="finish"; try { ftpClient.connect(InetAddress.getByName(SERVER)); ftpClient.login(USERNAME, PASSWORD); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); textTargetUri.setText("good"); final String remote = "/1.jpg";//FTP adress/filename String savefilepath = "/sdcard/download"+remote; File downloadfile = new File(savefilepath);//download local = new FileOutputStream(downloadfile); long fileSize = 0; FTPFile[] files = ftpClient.listFiles(remote); if (files.length == 1 &amp;&amp; files[0].isFile()) { fileSize = files[0].getSize(); String a = String.valueOf(fileSize); Log.d("File Size", a); } CountingOutputStream cos = new CountingOutputStream(local) { protected void beforeWrite(int n) { super.beforeWrite(n); int progress = Math.round((getCount() * 100) / 879394); //String b = String.valueOf(progress); //Log.d("File persent",…
type: UnansweredQuestion
tagged with: android
tagged with: android-asynctask
tagged with: ftp
has comment: http://stackoverflow.com/comment/36673770
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/36747168
has text: If there are any crashes, please post your stack trace. Importantly, never show your real adunit id when posting. Remove it or replace with "***" Someone might use it for bad purposes which can lead to admob banning you.
comment on: http://stackoverflow.com/q/23871856
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23940217
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23939775
downvote count: 0
has body: The resolution of your problem is pretty simple. First, you don't need to create an Image and use createImage(getWidth(), getHeight()) on it to create the Graphics. Apart of that, when you override a method, you "invalidate" it and "replace" it with your code. Swing uses the paint(Graphics g) method to draw the components (like JButtons and JLabels). Override it will cause that your method is called not swing's. To fix the error, in the draw(Graphics g) you simply can write super.paint(g) to call the swing's method. So your class will be like this: import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.Image; import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame { JLabel label; public Main() { setSize(400, 300); setTitle("Title"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); label = new JLabel("Text inside"); add(label, BorderLayout.NORTH); } public void paint(Graphics g){ Image img = createImage(getWidth(), getHeight()); Graphics gr = img.getGraphics(); draw(gr); g.drawImage(img, 0, 0, this); } public void draw(Graphics g){ super.paint(g); g.drawRect(100, 100, 200, 100); } public static void main(String[] args) { Main start = new Main(); } }

http://stackoverflow.com/a/23788955
type: Answer
answers question: http://stackoverflow.com/q/23788803
has body: Writing jstl tags in javascript is not going to work. JQuery's .append(...) method is going to fire on the client side long after jstl tags are parsed. If your goal is to choose, via jstl, what to append, a significant rewrite is needed. edit: Try this: $("#medicine").append(' ' +' '+medtype[medCurrentIndex]+' ' +' '+medicineName[medCurrentIndex]+' ' +' '+frequency[medCurrentIndex]+' ' +' '+dose[medCurrentIndex]+' ' +' '+quantity[medCurrentIndex]+' ' +' '+numberofDays[medCurrentIndex]+' ' <c:choose> <c:when test="${role eq 'doctor' }"> +' Edit ' +' Delete ' </c:when> <c:otherwise> +' ' </c:otherwise> </c:choose> +' '); I want to emphasize that although the above snippet might work, I wouldn't recommend it. A better solution would be to dump ${role} into a global variable or a hidden input and do the decision making from the JS side. Or set the whole append string in jstl. Mixing the two makes this significantly harder to read.
has comment: http://stackoverflow.com/comment/36702770
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23788803
score: 0
has comment: http://stackoverflow.com/comment/36595909
has comment: http://stackoverflow.com/comment/36587251

http://stackoverflow.com/comment/36713972
score: 1
type: AnswerComment
has text: Generally, that should work. See the last part of my answer I updated with. Maybe you'll get a better understanding of Eclipse and how it works :-)
comment on: http://stackoverflow.com/a/23855179
type: Comment

http://stackoverflow.com/comment/36625567
has text: Use java.util.Collections.synchronizedMap() if there is a chance of concurrent modification
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23809129

http://stackoverflow.com/comment/36714871
type: QuestionComment
has text: That means when I run my project with : Run as-> Maven build-> clean package, at that time i get this error.
comment on: http://stackoverflow.com/q/23855807
score: 0
type: Comment

http://stackoverflow.com/comment/36735438
type: Comment
comment on: http://stackoverflow.com/q/23866413
score: 0
has text: Thanks, that worked. Post it as an answer and I will accept it, so that you gain the reputation. Thanks.
type: QuestionComment

http://stackoverflow.com/q/23834763
has comment: http://stackoverflow.com/comment/36674364
has comment: http://stackoverflow.com/comment/36674323
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36674444
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36674462
has comment: http://stackoverflow.com/comment/36674398
has body: "Can you help me with these points below... Please split and store all the words from the file into an ArrayList. Print the contents of the ArrayList. Using the ArrayList created in previous question, please create a new ArrayList that contains only unique words in the book (get rid of all the duplicates from the ArrayList). For simplicity, please ignore case differences (upper vs. lower case) and punctuation marks. Please print a list of all the words used in the file (christmas_carol.txt) and their frequency, i.e. how many times each word appears in the file. Thanks," import java.io.File; import java.io.IOException; import java.util.ArrayList; import org.apache.commons.io.FileUtils; public class Practice { public static void main (String[] args) { ArrayList&lt;String&gt; array = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; dup = new ArrayList&lt;String&gt;(); File file = new File ("christmas_carol.txt"); try { String line = FileUtils.readFileToString(file); String[] lines = line.split(" "); for (int i = 0 ; i &lt; lines.length; i ++) { array.add(lines[i]); //System.out.println(lines[i]); //printing the contents of the file. } for (int i = 0 ; i &lt; dup.size(); i ++){ dup.add(line); if (dup.equals(lines)) { dup.remove(i); System.out.print(i); } } } catch (IOException ie) { System.err.print("No Such File Found!"); } } }
has comment: http://stackoverflow.com/comment/36674396
downvote count: 5
has comment: http://stackoverflow.com/comment/36674230
accepted answer: http://stackoverflow.com/a/23835196
has comment: http://stackoverflow.com/comment/36674251
has comment: http://stackoverflow.com/comment/36674533
has comment: http://stackoverflow.com/comment/36674508
type: AnsweredQuestion
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/36674311
tagged with: java
has answer: http://stackoverflow.com/a/23835196
has comment: http://stackoverflow.com/comment/36674208
type: Question
has comment: http://stackoverflow.com/comment/36674563
has comment: http://stackoverflow.com/comment/36674228
has comment: http://stackoverflow.com/comment/36674217
has comment: http://stackoverflow.com/comment/36674386
has title: duplicates from the ArrayList

http://stackoverflow.com/comment/36786567
type: QuestionComment
comment on: http://stackoverflow.com/q/23893275
score: 1
has text: @KonstantinNaryshkin: That was a typo. Edited the question..
type: Comment

http://stackoverflow.com/comment/36854387
score: 0
type: Comment
type: QuestionComment
has text: Sorry @AleksandrM, i didnt got what you're trying to imply. What i'm specifically asking is how can i call a simple javascript function within the iteration.
comment on: http://stackoverflow.com/q/23929229

http://stackoverflow.com/comment/36793944
comment on: http://stackoverflow.com/a/23865522
type: AnswerComment
has text: Exactly: using LDAP and the same user ID
score: 0
type: Comment

http://stackoverflow.com/q/23910607
has title: Respond to invalid JSON requests with application/json type response
score: 0
tagged with: playframework
answer count: 1
tagged with: playframework-2.2
accepted answer: http://stackoverflow.com/a/23914852
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23914852
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36819455
linked to: http://stackoverflow.com/q/10699595
has body: I am using Play framework 2.2.3. I want to respond to invalid JSON requests with a JSON response saying response type is invalid JSON like {"message": "invalid json"} but Play by default sends html data. I am using @BodyParser.Of(BodyParser.Json.class) annotation for my action method in the controller class. How do I send a JSON response instead of the default html response?

http://stackoverflow.com/comment/36818828
has text: Well, there are some inbuilt solutions - say for large queries Hibernate has a configurable cache, for connections to a DB you have connection pools. The current used general-purpose cache is Ehcache I believe, though I haven't tried it out.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23894046
type: AnswerComment

http://stackoverflow.com/a/23875269
has comment: http://stackoverflow.com/comment/36786924
has body: Simply do the same thing as you have done before, but now using the new attribute as the "name" property of the ui:repeat. &lt;ui:repeat value="#{cmsBean.cmsVo.attributesList}" var="attribute"&gt; &lt;ui:repeat value="#{attribute.newList}" var="newList"&gt; &lt;/ui:repeat&gt; &lt;/ui:repeat&gt; A similar question along with a sample code can be found here: How to use &lt;ui:repeat&gt; to iterate over a nested list? Simply do the same thing as you have done before, but now using the new attribute as the "name" property of the ui:repeat. &lt;ui:repeat value="#{cmsBean.cmsVo.attributesList}" var="attribute"&gt; &lt;ui:repeat value="#{attribute.newList}" var="newList"&gt; &lt;/ui:repeat&gt; &lt;/ui:repeat&gt; A similar question along with a sample code can be found here: How to use &lt;ui:repeat&gt; to iterate over a nested list? If you want to create a new html unordered list: Inside the same ui:repeat: simply begin it again, and you will have a nested unordered list. item1 item2 Outside the ui:repeat: you should save the list with the values in another variable inside the managed bean in order to access it (through a getter) as the property value of the second ui:repeat.
has comment: http://stackoverflow.com/comment/36779927
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23874154
downvote count: 0

http://stackoverflow.com/comment/36758618
score: 0
type: AnswerComment
has text: All true but it doesn't explain the problem.
type: Comment
comment on: http://stackoverflow.com/a/23874000

http://stackoverflow.com/q/23780905
has title: Type full width colon (:) to setProperty in Java
has comment: http://stackoverflow.com/comment/36572388
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36574446
type: Question
tagged with: escaping
linked to: http://stackoverflow.com/q/17990740
has comment: http://stackoverflow.com/comment/36573260
tagged with: java
has answer: http://stackoverflow.com/a/23781199
score: 0
has body: I'm trying to set my database property, so in the future users could change it if they want to change the route of the database. The problem is when I try to set something with full width colon, which always add a backslash escape character . I've tried normal and double escape, but it doesn't work. import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Properties; public class SetProps { public static void SetDefaultProps(){ Properties prop = new Properties(); OutputStream output = null; try { output = new FileOutputStream("./build/classes/configuracion.properties"); // Set the database property prop.setProperty("url", "jdbc:mysql://192.168.1.192:3306/ordenestaller"); // Save Properties prop.store(output, null); } catch (IOException io) { io.printStackTrace(); } finally { if (output != null) { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static void main(String[] args) { SetDefaultProps(); } }
answer count: 1
has comment: http://stackoverflow.com/comment/36573052
has comment: http://stackoverflow.com/comment/36574299

http://stackoverflow.com/comment/76301857
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23861084
type: AnswerComment
has text: Not suggesting that the library should buffer it, but saying that by having streams as one-offs, it forces people who want to reuse a seed stream (ie: sharing the declarative logic used to define it) to build multiple derived streams to either collect the seed stream, or have access to a provider factory that will create a duplicate of the seed stream. Both options have their pain points. This answer has much more detail on the topic: https://stackoverflow.com/a/28513908/114200.

primefaces
tags question: http://stackoverflow.com/q/23868911
tags question: http://stackoverflow.com/q/23872672
tags question: http://stackoverflow.com/q/23931009
tags question: http://stackoverflow.com/q/23838873
tags question: http://stackoverflow.com/q/23920239
tags question: http://stackoverflow.com/q/23878113
tags question: http://stackoverflow.com/q/23920198
tags question: http://stackoverflow.com/q/23823353
tags question: http://stackoverflow.com/q/23780474
tag name: primefaces
tags question: http://stackoverflow.com/q/23907061
tags question: http://stackoverflow.com/q/23874154
tags question: http://stackoverflow.com/q/23817254
tags question: http://stackoverflow.com/q/23837008
tags question: http://stackoverflow.com/q/23859158
tags question: http://stackoverflow.com/q/23787319
tags question: http://stackoverflow.com/q/23796665
tags question: http://stackoverflow.com/q/23791680
tags question: http://stackoverflow.com/q/23870008
tags question: http://stackoverflow.com/q/23901560
tags question: http://stackoverflow.com/q/23815933
tags question: http://stackoverflow.com/q/23893764
tags question: http://stackoverflow.com/q/23912741
type: Tag
tags question: http://stackoverflow.com/q/23937885
tags question: http://stackoverflow.com/q/23909599
tags question: http://stackoverflow.com/q/23803511
tags question: http://stackoverflow.com/q/23920090

http://stackoverflow.com/a/24333586
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: What version of Intellij are you using? Version 13.1.3 automatically selects one of the existing property files in the project and keeps previously selected file when used multiple times. See details for this feature on Jetbrains website http://www.jetbrains.com/idea/webhelp/extracting-hard-coded-string-literals.html You may need to mark your folder as "resources root"
has comment: http://stackoverflow.com/comment/37669815
has comment: http://stackoverflow.com/comment/37675062
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37789875
has comment: http://stackoverflow.com/comment/37670733
has comment: http://stackoverflow.com/comment/37659955
accepted answer of: http://stackoverflow.com/q/23929821
has comment: http://stackoverflow.com/comment/37902428
has comment: http://stackoverflow.com/comment/37674965
answers question: http://stackoverflow.com/q/23929821

http://stackoverflow.com/q/23929542
has comment: http://stackoverflow.com/comment/36856543
has comment: http://stackoverflow.com/comment/36856962
has comment: http://stackoverflow.com/comment/36856370
type: UnansweredQuestion
has body: I have a form with drop-down box on JSP page. User chose what kind of documentation he would like to get. Post is send to servlet. Then servlet is getting data from different files combines them and add to arrayList. Send it back to JSP: rules = vp.getProperyRules();//ArrayList&lt;RuleObject&gt; request.setAttribute("rules", rules); request.getRequestDispatcher("rulesDocumentation.jsp").forward(request, response); Then JSP is printing them out in nice table. But I was asked to give an user opportunity to download an excel file as well. When he clicks "Get Documentation" button I want to add a link that will allow him to get a report as well as printing out table with documentation. So I have couple of questions: Now I am sending back Arraylist of all rules contained in documentation. Should I modify it to send excel file as well? Or I should just create link that will point to temp file on server(report) when user will click on that link he will download a file. How to do it? Modify response that it will send arraylist and fileName of temp report stored on server side? I would really appreciate your help
tagged with: excel
has title: Servlets: sending 2 requests to JSP
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36855645
has comment: http://stackoverflow.com/comment/36854719
tagged with: jsp
has comment: http://stackoverflow.com/comment/36857123
tagged with: servlets
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36856796

http://stackoverflow.com/comment/36875559
score: 0
type: Comment
has text: Thats because they are supposed to give different values. `X` is different from `centerX` of a `View`'s bounds. I thought it was obvious.
comment on: http://stackoverflow.com/a/23940194
type: AnswerComment

http://stackoverflow.com/comment/36681610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23838349
has text: @JoopEggen can you please clarify with a code fragment of what it is you mean?
score: 0

http://stackoverflow.com/a/23843994
has body: You are dividing the array's length by the constant 10 (which just happens to be the length), so naturally you'd get 1. You should sum all values of the array and only then divide them by its length: double englighSum = 0; for (int i = 0; i &lt; english.length; ++i) englishSum += english[i]; } double englishAverage = englishSum / english.length;
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23843971
score: 1
downvote count: 0

http://stackoverflow.com/comment/36868535
score: 0
has text: `callFunc.yourMethod();`
comment on: http://stackoverflow.com/q/23936982
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23903840
has body: try this: String p = "FILLIN [^\\\\]+\\\\\\\* MERGEFORMAT"; System.out.println(a.replaceAll(p , "" ));
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36807009
type: Answer
accepted answer of: http://stackoverflow.com/q/23903494
answers question: http://stackoverflow.com/q/23903494
upvote count: 1

spring-webflow
tags question: http://stackoverflow.com/q/23876008
tags question: http://stackoverflow.com/q/23808633
tags question: http://stackoverflow.com/q/23870008
type: Tag
tag name: spring-webflow

http://stackoverflow.com/a/67259522
score: 1
downvote count: 0
has body: I've been "criticised" that my comment "Pixels don't have fractions, it's simply not possible." is not "accurate" So, let's focus on a simple example... import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Test { public static void main(String[] args) { new Test(); } public Test() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.add(new TestPane()); frame.pack(); frame.setVisible(true); } }); } public class TestPane extends JPanel { @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.LIGHT_GRAY); for (int x = 0; x < getWidth(); x += 2) { for (int y = 0; y < getHeight(); y += 2) { g2d.drawLine(x, y, x, getHeight()); g2d.drawLine(x, y, x + getWidth(), y); } } g2d.setColor(Color.RED); Rectangle2D.Double rect = new Rectangle2D.Double(10.5, 10.5, 10.5, 10.5); g2d.draw(rect); g2d.dispose(); } } } The above code produces something like... So, by default, anti-aliasing is not enable in Swing. So in the example above, the rectangle starts at 10x10 and is 11x11 pixels in size If we modify the code to include (in my testing, this was done below the code that drew the grid and before the code which drew the rectangle)... g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, Rend…
type: Answer
answers question: http://stackoverflow.com/q/23796063
upvote count: 1

http://stackoverflow.com/q/23800718
tagged with: nutch
has title: Searching a set of keywords in a large string
has comment: http://stackoverflow.com/comment/36610477
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23810000
has comment: http://stackoverflow.com/comment/36610671
tagged with: lucene
type: Question
upvote count: 2
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/23810000
favorite count: 0
possible better answer: http://stackoverflow.com/a/23800799
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/36610515
has comment: http://stackoverflow.com/comment/36611337
has answer: http://stackoverflow.com/a/23800799
has comment: http://stackoverflow.com/comment/36610780
has body: I have to do a search in a text file or a large string to check if the text contains a set of keywords (could be millions). If it contains the keywords I have to highlight whatever keywords got matched. What approach should be taken for this? Does lucene provide a solution for this?
tagged with: solr

http://stackoverflow.com/q/23883695
type: UnansweredQuestion
tagged with: android
has title: Unable to unregisterListener while using accelerometer during incoming calls
has body: I have created a simple broadcast receiver to capture the accelerometer movement while the device receives. The motive of the app is turning the device over will mute incoming calls. Please check this (last point under motions heading). The app is working okay, but I want to unregisterListener when the broadcast receiver detects the idle mode. When I try to do that, I am getting this error: 05-27 13:01:21.122: E/MyApp(9836): Vibrate mode 05-27 13:01:25.426: E/Detecting(9836): PhoneIdle 05-27 13:01:25.436: E/actualRingerMode(9836): Actual State: Vibrate mode 05-27 13:01:25.446: E/AndroidRuntime(9836): FATAL EXCEPTION: main 05-27 13:01:25.446: E/AndroidRuntime(9836): java.lang.RuntimeException: Unable to start receiver com.abhideep.silentfacedown.IncommingCallReceiver: java.lang.NullPointerException 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2495) 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.app.ActivityThread.access$1500(ActivityThread.java:150) 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.os.Handler.dispatchMessage(Handler.java:99) 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.os.Looper.loop(Looper.java:213) 05-27 13:01:25.446: E/AndroidRuntime(9836): at android.app.ActivityThread.main(ActivityThread.java:5225) 05-27 13:01:25.446: E/AndroidRuntime(9836): at java.lang.reflect.Method.invokeNative(Native Method) 05-27 13:01:25.446: E/AndroidRuntime(9836): at java.lang.reflect.Method.invoke(Method.java:525) 05-27 13:01:25.446: E/AndroidRuntime(9836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) 05-27 13:01:25.446: E/AndroidRuntime(9836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 05-27 13:01:25.446: E/AndroidRuntime(9836): at dalvik.system.NativeStart.main(Native Method) 05-27 13:01:25.446: E/AndroidRunti…
has answer: http://stackoverflow.com/a/23883800
type: Question
tagged with: broadcastreceiver
tagged with: java
score: 0
tagged with: accelerometer
answer count: 1

http://stackoverflow.com/q/23896432
has comment: http://stackoverflow.com/comment/36793396
tagged with: java
has comment: http://stackoverflow.com/comment/36793174
accepted answer: http://stackoverflow.com/a/23897001
has comment: http://stackoverflow.com/comment/36792472
type: Question
has comment: http://stackoverflow.com/comment/36792807
linked to: http://stackoverflow.com/q/8983709
has comment: http://stackoverflow.com/comment/36792565
has body: XCode just corrected my use of the . operator to the -&gt; operator. I have searched around to find a definition or documentation for the -&gt; operator but could find any. I am trying to emulate a Java-style of instance variable. Specifically I am initializing an instance with a provided configuration object which I want to keep around for subsequent use after the method initializeService has executed. A good answer to this question would provide a comparison with Java instance variable declaration and subsequent assignment via an instance method. Code before XCode correction: #import "MY_Service.h" #import "MY_Configuration.h" @implementation MY_Service { MY_Configuration *configuration; } -(void)initializeService:(MY_Configuration *)configuration { self.configuration = configuration; } @end Code after XCode correction: #import "MY_Service.h" #import "MY_Configuration.h" @implementation MY_Service { MY_Configuration *configuration; } -(void)initializeService:(MY_Configuration *)configuration { self-&gt;configuration = configuration; } @end
score: 0
answer count: 3
tagged with: xcode
tagged with: objective-c
tagged with: operators
has answer: http://stackoverflow.com/a/23897001
possible better answer: http://stackoverflow.com/a/23896517
has comment: http://stackoverflow.com/comment/36792922
has answer: http://stackoverflow.com/a/23896511
has answer: http://stackoverflow.com/a/23896517
has title: What does the '->' operator signify in Objective C?
type: AnsweredQuestion

http://stackoverflow.com/q/23834353
tagged with: jexcelapi
has comment: http://stackoverflow.com/comment/36673780
upvote count: 1
tagged with: excel
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23857518
has body: I have an array that I want to retrieve the values from and insert them into excel using Jxl, one value into one row eg: 1| blah blah blah 2| blah blah blah 3| blah blah blah I can retrieve the values from the array as is shown in the code below, but inserting them into rows is proving difficult for me....the best I have managed through various attempts is inserting the right number of rows but all of the same value (the last value stored in the array). private static void InsertStrings() throws RowsExceededException, WriteException { try { System.out.println("Starting Write to Excel"); WritableWorkbook workbook = Workbook.createWorkbook(new File("C:\\Users\\Jason\\Documents\\Development\\Seaport Crawler\\CrawlerResults.xls")); WritableSheet sheet = workbook.createSheet("Results", 0); Label label = new Label(0, 0, "Notices to Mariners"); sheet.addCell(label); for ( int indx = 0; indx &lt; arr_Heading.size(); indx++) { /********HEADING and TITLE ARRAY*********/ String heading; int rowValue = indx; heading = arr_Heading.get(rowValue); //Editing the Descriptions if (heading.contains("-")) { // Split it String string = heading; String[] parts = string.split("-",2); String part1 = parts[0]; // Heading String part2 = parts[1]; // Title //String part1s = part1.replaceAll("\\s+","");//Replace Spaces with none // String part2s = part2.replaceAll("\\s+",""); System.out.println("row Value........" + rowValue + " Heading... " + part1 + " Title... " + part2); //Insert Strings to Excel Workbook Label ntmHeading = new Label(2, indx, part1); sheet.addCell(ntmHeading); }else{ //something } // All sheets and cells added. Now write out the workbook workbook.write(); workbook.close(); } } catch (IOException e) { System.out.println("WRITE TO EXCEL FAILED"); e.printStackTrace(); } Thanks
answer count: 1
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/23857518
tagged with: jxl
has comment: http://stackoverflow.com/comment/36673690
has title: Inserting an array into Excel
favorite count: 0
has comment: http://stackoverflow.com/comment/36673909

http://stackoverflow.com/q/23876864
answer count: 0
has comment: http://stackoverflow.com/comment/36754413
tagged with: biginteger
tagged with: java
tagged with: md5
upvote count: 1
type: Question
has body: I intend to parition md5 hash (2^128) into four quadrants. I'm using BigInteger java class to represent md5 hash. Below is the code I tried to partition it but seems to be not working: private static final BigInterger chunkSize_ = (new BigInterger(2)).pow(125); ... byte[] hashValue = new byte[hash.remaining()]; // hash is md5 bytebuffer hash.get(hashValue); BigInteger hashNumber = new BigInteger(hashValue); String chunk = hashNumber.divide(chunkSize_).toString(); Collecting stats I see chunk value to as high as 34. Idea was to divide 2^128 into 4 halves. Please let me know what is wrong with above code snippet. Thanks
downvote count: 0
score: 1
favorite count: 0
has title: Md5 hash namespace partition
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36754535
has comment: http://stackoverflow.com/comment/36754377

http://stackoverflow.com/comment/36627033
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23806808
has text: I edited the question, since I was able to produce working java code.
score: 0

http://stackoverflow.com/comment/36763221
type: QuestionComment
comment on: http://stackoverflow.com/q/23875007
score: 1
has text: I took a look at Spring Integration and it makes sense. Although, my app is going to be deoloyed in a web container. Does this mean I don't use ContextLoaderListener in my web.xml and have Guice load my spring context files instead?
type: Comment

http://stackoverflow.com/comment/36664807
type: Comment
type: QuestionComment
has text: think, i will read this.
score: 0
comment on: http://stackoverflow.com/q/23827757

http://stackoverflow.com/comment/36807112
has text: I am worried about there might be some read-write concurrent issues.
comment on: http://stackoverflow.com/q/23903726
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23801811
has comment: http://stackoverflow.com/comment/36611579
type: Question
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/23802060
accepted answer: http://stackoverflow.com/a/23802029
has answer: http://stackoverflow.com/a/23802060
has comment: http://stackoverflow.com/comment/36611486
has answer: http://stackoverflow.com/a/23802177
has comment: http://stackoverflow.com/comment/36611468
has comment: http://stackoverflow.com/comment/36611735
answer count: 7
has answer: http://stackoverflow.com/a/23801867
favorite count: 0
upvote count: 2
has body: Set s = userIdVsUserInfo.keySet(); As you can see im taking the keySet from a hashmap userIdVsUserInfo and store it in a Set s. Since the construction of the hashmap is dynamic,the keyset may have more than 100 objects. how can i get 100 objects as a collection?
tagged with: collections
has answer: http://stackoverflow.com/a/68926143
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23801863
has title: How to get 100 objects from a Set as a collection?
has answer: http://stackoverflow.com/a/68924580
has answer: http://stackoverflow.com/a/23802029
tagged with: java
tagged with: set

http://stackoverflow.com/comment/36859319
score: 0
comment on: http://stackoverflow.com/a/23931533
type: Comment
has text: Thank you.But the solution is also not working as expected (result is same as before).please look at the code of viewLineNumbersActionPerformed().I think some modification need inside the if block.Plese give me some suggestions...
type: AnswerComment

http://stackoverflow.com/comment/36618189
comment on: http://stackoverflow.com/q/23805432
has text: Thanks, but how?. I am new in this...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36706079
comment on: http://stackoverflow.com/q/23850912
score: 0
type: Comment
type: QuestionComment
has text: It's not wrongly formatted. Spacing is irelevant

http://stackoverflow.com/q/23898427
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/36796646
type: Question
answer count: 2
upvote count: 0
has title: Array Table Error
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/23898460
possible better answer: http://stackoverflow.com/a/23898753
has answer: http://stackoverflow.com/a/23898753
has body: In line 133, I keep getting the error ArrayIndexOutOfBoundsException and I cant find a solution for it. I tried changing some values around but to no avail Any ideas? I feel like I might need to do something with the number of columns and rows but I am not 100% sure. Thanks a lot in advance! import java.io.*; class myTable { public static void main (String [] args) throws IOException { int Input, Input2, Input3, Input4, Input5, Input6, Input7, Input8, Input9, Input10;//Inputs are int int Input11, Input12, Input13, Input14, Input15, Input16, Input17, Input18, Input19, Input20;//Inputs are int InputStreamReader inStream = new InputStreamReader (System.in); BufferedReader mVHS = new BufferedReader (inStream); System.out.println("Enter 20 numbers to make a table"); System.out.println("Type a number:");//Enter a number String userInput = mVHS.readLine(); Input = Integer.parseInt(userInput); System.out.println("Type a number:");//Enter a number String userInput2 = mVHS.readLine(); Input2 = Integer.parseInt(userInput2); System.out.println("Type a number:");//Enter a number String userInput3 = mVHS.readLine(); Input3 = Integer.parseInt(userInput3); System.out.println("Type a number:");//Enter a number String userInput4 = mVHS.readLine(); Input4 = Integer.parseInt(userInput4);; System.out.println("Type a number:");//Enter a number String userInput5 = mVHS.readLine(); Input5 = Integer.parseInt(userInput5); System.out.println("Type a number:");//Enter a number String userInput6 = mVHS.readLine(); Input6 = Integer.parseInt(userInput6); System.out.println("Type a number:");//Enter a number String userInput7 = mVHS.readLine(); Input7 = Integer.parseInt(userInput7); System.out.println("Type a number:");//Enter a number String userInput8 = mVHS.readLine(); Input8 = Integer.parseInt(userInput8); System.out.println("Type a number:");//Enter a number String userInput9 = mVHS.readLine(); Input9 = Integer.parseInt(userInput9); System.out.println("Type a number:");//Enter a number String…
downvote count: 2
accepted answer: http://stackoverflow.com/a/23898460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36796462

http://stackoverflow.com/a/23897938
answers question: http://stackoverflow.com/q/23897699
downvote count: 0
has comment: http://stackoverflow.com/comment/36811069
has body: per the lang spec (http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.4): A write to a volatile variable v (§8.3.1.4) synchronizes-with all subsequent reads of v by any thread (where "subsequent" is defined according to the synchronization order). and A write to a volatile field (§8.3.1.4) happens-before every subsequent read of that field. so the volatile variable itself is safe from stale cache problems. Your questions is; "what about all other variables?" Well no, the volatile keyword only affects caching on the variable it is on: all other variables on those threads are unsynchronized.
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/36829375
comment on: http://stackoverflow.com/q/23915723
score: 0
type: QuestionComment
has text: @LuiggiMendoza - I read the javadoc, just wrong explanation from my side...I actually need just the top N highest elements of the array.
type: Comment

http://stackoverflow.com/comment/36851702
comment on: http://stackoverflow.com/q/23927866
score: 0
has text: Try to print that value that what u getting.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23932436
favorite count: 0
has title: Unable to upload file with jersey
tagged with: rest
type: UnansweredQuestion
score: 1
tagged with: java
has body: I am using this webservice to upload a file using jersey public class upload { @POST @Path(value = "upload") @Consumes("image/jpg") public Response uploadPng(File file) throws IOException { file = new File("C:/Users/Marwa/Desktop/Capture.jpg"); String uploadedFileLocation = "C:/Users/Desktop/" + file.getName(); DataInputStream diStream =new DataInputStream(new FileInputStream(file)); long len = (int) file.length(); byte[] fileBytes = new byte[(int) len]; int read = 0; int numRead = 0; while (read &lt; fileBytes.length &amp;&amp; (numRead =diStream.read(fileBytes, read,fileBytes.length - read)) &gt;= 0) { read = read + numRead; } // save it writeToFile(diStream, uploadedFileLocation); System.out.println("File uploaded to : " + uploadedFileLocation); return Response.status(200).entity(file).build(); } // save uploaded file to new location private void writeToFile(InputStream uploadedInputStream,String uploadedFileLocation) { try { OutputStream out =new FileOutputStream(new File(uploadedFileLocation)); int read = 0; byte[] bytes = new byte[1024]; out = new FileOutputStream(new File(uploadedFileLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); } catch (IOException e) { e.printStackTrace();}}} When I execute my code i get a 405 error !! Are there any suggestions to this issue?
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/31875310
answer count: 2
upvote count: 1
downvote count: 0
tagged with: upload
has answer: http://stackoverflow.com/a/23933660

http://stackoverflow.com/comment/36590497
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23790512
has text: I have tested this and was getting the expected result
type: AnswerComment

http://stackoverflow.com/comment/36695112
score: 0
comment on: http://stackoverflow.com/q/23841222
type: Comment
type: QuestionComment
has text: for now , when i send a message from the client , it gets to the server and the server send a message back to the client to assure connection, and the client gets it. .............. what i want ? is that the message that i send to the server , the server to send it to a specific client not to me back.

http://stackoverflow.com/q/23923323
answer count: 0
downvote count: 0
tagged with: java
tagged with: apache-storm
has comment: http://stackoverflow.com/comment/42504717
has title: ClassNotFoundException when trying to start topology
type: Question
score: 3
has comment: http://stackoverflow.com/comment/40147198
has body: This is a strange problem that I'm hoping someone's encountered and overcome. I have a relatively simple topology: Spout -> BoltA -> BoltB -> BoltC If I use bolts A and B, it works. A and C works too. Enabling all three though gives me this: 16:05:20.627 [main] WARN backtype.storm.daemon.nimbus - Topology submission exception. (topology name='traffic') #<RuntimeException java.lang.RuntimeException: java.lang.ClassNotFoundException: backtype.storm.daemon.nimbus$normalize_conf$get_merged_conf_val__3916$fn__3917> 16:05:20.634 [main] ERROR o.a.zookeeper.server.NIOServerCnxn - Thread Thread[main,5,main] died java.lang.RuntimeException: java.lang.ClassNotFoundException: backtype.storm.daemon.nimbus$normalize_conf$get_merged_conf_val__3916$fn__3917 at backtype.storm.utils.Utils.deserialize(Utils.java:88) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating] at backtype.storm.daemon.nimbus$read_storm_conf.invoke(nimbus.clj:89) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating] at backtype.storm.daemon.nimbus$start_storm.invoke(nimbus.clj:724) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating] at backtype.storm.daemon.nimbus$eval3974$exec_fn__1459__auto__$reify__3987.submitTopologyWithOpts(nimbus.clj:962) ~[na:na] at backtype.storm.daemon.nimbus$eval3974$exec_fn__1459__auto__$reify__3987.submitTopology(nimbus.clj:971) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_55] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_55] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_55] I'm running it locally using the code below: LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topoName, conf, buildTopology(source, service)); try { Thread.sleep(10000); } catch (InterruptedException e) { throw new RuntimeException(e); } cluster.killTopology(topoName); cluster.shutdown(); I'm running against storm-core-0.9.1-incubating.jar All I could find was th…
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/36910830
has comment: http://stackoverflow.com/comment/36906457
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/64120504

cachedrowset
type: Tag
tag name: cachedrowset
tags question: http://stackoverflow.com/q/23878099

http://stackoverflow.com/q/23858975
type: Question
has title: Mapping using reflection in Objective-c?
has comment: http://stackoverflow.com/comment/36721142
score: 0
answer count: 1
tagged with: objective-c
has body: As java developer is used to use such approach sometimes: // init Map&lt;Class, Handler&gt; map = new HashMap&lt;Class, Handler&gt;; map.put(MyClass1.class, new Handler1()); map.put(MyClass2.class, new Handler2()); // later Handler handler = map.get(currentObject.getClass()); handler.handle(); Is there similar approach in Objective-c? PS. I know that this can probably be solved in another way: MyClass can return Handler instance (base method and overriden in inheritor), but it's not good because MyClassN does not know Handler and it can be resolved in runtime f.e.
has comment: http://stackoverflow.com/comment/36721180
type: UnansweredQuestion
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/23859056

http://stackoverflow.com/q/23901970
tagged with: modal-dialog
answer count: 1
has title: Show all frames (child and parent) after they lost focus
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23912151
score: 0
tagged with: lost-focus
has body: I have jFrame from which I creating new jDialog frame with DEFAULT_MODALITY_TYPE. Then I maximizing some other app (like browser or something) so my app is not seen. When I want to show my app and clicking on icon from taskbar, it shows only child frame. What can I do to show all frames without disabling modality?
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23912151

http://stackoverflow.com/comment/36621129
type: AnswerComment
comment on: http://stackoverflow.com/a/23803257
type: Comment
has text: @ShashankTulsyan I think it's useful if it can be called even if it is there is no starting thread. Also you could print just the stack trace so the Throwable doesn't appear to avoid confusion.
score: 0

http://stackoverflow.com/q/23814439
has title: Excluding certain modules from proguard Android Gradle Buildscript
answer count: 0
tagged with: java
upvote count: 7
tagged with: gradle
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/87163471
score: 7
has body: I have a Project structure of the following form: Root Project +------ Module A +------ Module B Now Module B is a huge project, but I use an API to access it, so I would like to load the classes of Module B at runtime. As such I would like to compile it but in a separate DEX file. I am able to compile a separate DEX file by the following gist: https://gist.github.com/nickcaballero/7045993 In the debug compile mode this work fine since one can change the libraries being DEXed via the buildscript in this form def libraryFiles = new ArrayList&lt;?&gt;() variant.dex.libraries.each { File file -&gt; // Exclude Module B from Dex library list if (!file.absolutePath.contains("ModuleB/unspecified/classes.jar")) { libraryFiles.add(file); } } variant.dex.libraries = libraryFiles Now this works well since when not doing proguard, the AndroidBuilder simply uses variant.dex.libraries to create the DEX file and excluding it is easy. The pain comes when one needs to do proguard of the intermediate class. Since ModuleB is a compile time dependency (for the purpose of resource integration/layouts etc.) therefore its classes, get compiled into the build directory. However when it is getting proguarded, the default proguard task defined in the Android Builder throws in the classes.jar file as libraryJars. At the end of it, the task creates classes-proguard which contains all the classes from the above library Jars. This then gets DEXed, and the classes which were to be loaded via Runtime are present in it. Is there any way to exclude certain jars to not be fed into the default proguard task?
tagged with: proguard
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/23794115
score: 0
has answer: http://stackoverflow.com/a/64952015
favorite count: 0
type: UnansweredQuestion
tagged with: choco
upvote count: 1
tagged with: java
has title: Constraint in Choco
downvote count: 1
type: Question
answer count: 2
tagged with: constraint-programming
has answer: http://stackoverflow.com/a/23794419
has body: I've found a Choco solver as constraint programming software working with Java. I would like to learn it more. I have done some basic example. But now I would like to try something more complex (Pritsker project scheduling alg) and I need your help. In order to progress I have to understand how to put constraints on rows of matrix variable. Exactly I need to keep a sum of rows equal 1 (task starts only once). I have tried it but unsuccessfuly. Could you help? I do use Choco 2.1.5 My matrix is as follows: int n = 10; // projects int m = 12; // time horizon in months IntegerVariable[][] x = new IntegerVariable[n][m]; int i, j; for (i = 0; i &lt; n; i++){ for (j = 0; j &lt; m; j++){ x[i][j] = Choco.makeIntVar("x_" + i +"_" + j, 0, 1, Options.V_ENUM); model.addVariable(x[i][j]); } }

http://stackoverflow.com/comment/36673817
type: QuestionComment
has text: Did you try searching for "array access Java"? Because the tutorial linked by @Boann is the first result.
comment on: http://stackoverflow.com/q/23834496
score: 0
type: Comment

http://stackoverflow.com/comment/36679211
score: 0
type: Comment
has text: How would I specify where the font is? I would still have to register the font with the createFont() method? Just not returning anything?
type: AnswerComment
comment on: http://stackoverflow.com/a/23836247

http://stackoverflow.com/comment/36700553
type: Comment
type: QuestionComment
has text: Let's start at the basics: Do you call `showInformation` before `getPatientData`? Plus, have you considered using a `HashMap` instead of littering the code with private fields? It's a bit of a code smell
comment on: http://stackoverflow.com/q/23848083
score: 0

http://stackoverflow.com/comment/36765683
comment on: http://stackoverflow.com/q/23882057
has text: can you post your test.proto?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36845132
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23923047
type: AnswerComment
has text: The `v` command specifies a 3D vertex. It looks like this format is based on the Wavefront .obj files, so I'm guessing you can then reference these vertices with other commands like `pointlight` or `player` by their index (starting at 1 for the first vertex in the file).

http://stackoverflow.com/comment/36750198
has text: Your code works very well and very clean. A few things that I noticed, however, is that your code always returns true so that now the pieces never just move, meaning that they either jump over if there is an adjacent black piece or they do not move at all. Also (and this is a minor detail) I am thinking about adding an additional else if that decides (if there are two possible choices to jump) which way to jump randomly. In your code, the piece will, if it has two options, always choose jump1. I will try to randomize this,. But thank you very much!
comment on: http://stackoverflow.com/a/23860881
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23819111
type: Answer
answers question: http://stackoverflow.com/q/23818979
score: 0
has body: A likely reason is how MySQL grants are set up. Log in using localhost and look at the grant tables using SHOW GRANTS, as well as database permissions. It is very likely that different permissions are set for clients from 127.0.0.1 than localhost. If this isn't the issue, there are miscellaneous local networking fixes available.

postfix-notation
tags question: http://stackoverflow.com/q/23932316
tag name: postfix-notation
type: Tag

http://stackoverflow.com/a/23834634
has comment: http://stackoverflow.com/comment/36702478
has comment: http://stackoverflow.com/comment/36683550
has body: This is not so much a matter of the language, but rather of the virtual machine - that's why it is defined in the Java Virtual Machine Specifiction, but not in the Java Language Specification. In fact, the results of these bitwise computations are independent of the endianness. Assume Big-Endian: int value = 4111; // 0x0000100F int lastByte = value & 0xFF; // & 0x000000FF // = 0x0000000F Or Little-Endian: int value = 4111; // 0xF0010000 int lastByte = value & 0xFF; // & 0xFF000000 // = 0xF0000000 In both cases, the result is the same (in either of both forms). One could now argue about the fact that 0x0000000F stands for 15, which implies big-endianness. This is at least implicitly defined in the definition of the lexical structure, in JLS Section 3.10.1, Integer Literals: The largest positive hexadecimal, octal, and binary literals of type int - each of which represents the decimal value 2147483647 (2^31-1) - are respectively: 0x7fff_ffff, 0177_7777_7777, and 0b0111_1111_1111_1111_1111_1111_1111_1111 Apart from that, the endianness is mainly relevant for storage and communication, but these are not language aspects and facilitated with things like the ByteOrder class, or on an API-level, like in the DataOutputStream::writeInt method: Writes an int to the underlying output stream as four bytes, high byte first. The only part where the endianness could be considered to influence the semantics of the language are the shift operations. But even there, it's mainly a matter of the interpretation of the language. The JLS Section 15.19 about Shift Operators states: The value of n << s is n left-shifted s bit positions; this is equivalent (even if overflow occurs) to multiplication by two to the power s. The value of n >> s is n right-shifted s bit positions with sign-extension. The resulting value is [ n / 2s ]. For non-negative values of n, this is equivalent to truncating integer division, as computed by the integer division operator /, by two to the power s. The specifi…
type: Answer
has comment: http://stackoverflow.com/comment/36702227
has comment: http://stackoverflow.com/comment/36703334
upvote count: 4
answers question: http://stackoverflow.com/q/23832964
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36702253
accepted answer of: http://stackoverflow.com/q/23832964
has comment: http://stackoverflow.com/comment/36680581
score: 4

http://stackoverflow.com/comment/36789324
type: AnswerComment
score: 0
has text: This is very weird! We need to investigate more
type: Comment
comment on: http://stackoverflow.com/a/23894787

http://stackoverflow.com/comment/87536978
has text: Hi, Did you get any solution for your question. I am exactly looking any clue for same question
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23927671

list
type: Tag
tags question: http://stackoverflow.com/q/23831085
tags question: http://stackoverflow.com/q/23786955
tags question: http://stackoverflow.com/q/23935796
tags question: http://stackoverflow.com/q/23794576
tag name: list
tags question: http://stackoverflow.com/q/23852884
tags question: http://stackoverflow.com/q/23798354
tags question: http://stackoverflow.com/q/23782636
tags question: http://stackoverflow.com/q/23870518
tags question: http://stackoverflow.com/q/23872945
tags question: http://stackoverflow.com/q/23912554
tags question: http://stackoverflow.com/q/23937743
tags question: http://stackoverflow.com/q/23794262
tags question: http://stackoverflow.com/q/23814063
tags question: http://stackoverflow.com/q/23836415
tags question: http://stackoverflow.com/q/23904821
tags question: http://stackoverflow.com/q/23879227

http://stackoverflow.com/comment/36701029
score: 0
has text: At what line no you are getting this exception?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23848548

http://stackoverflow.com/comment/36777084
type: QuestionComment
comment on: http://stackoverflow.com/q/23888243
score: 0
type: Comment
has text: print `((JComboBox)parameterArray.get(i).getComp()).getSelectedIndex()` to see if you have a problem selecting the items, or retrieving the item selected

http://stackoverflow.com/a/23935577
has body: Maybe you should try to catch SQLExcepton and then, send notification like this : try { Connection connInitial = DriverManager.getConnection(conDetails.getUrl(), conDetails.getUser(), conDetails.getPassword()); } catch (SQLException e) { //send notification here }
answers question: http://stackoverflow.com/q/23935486
score: 0
type: Answer

http://stackoverflow.com/comment/36807070
type: AnswerComment
has text: Hi Thomas, This will notify all the waiting thread but what about notifying the Main thread? I want Main thread to get notified after ThreadT1 completion.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23898125

http://stackoverflow.com/comment/36606707
score: 0
type: Comment
type: QuestionComment
has text: @user3580294 There is no need for duplicate values and switching between collection/set. The parent data can be directly available in `hashset` and search values in a `String` separated by commas. We just have to check if atleast one of the string in search string is present in the `hashset`
comment on: http://stackoverflow.com/q/23783550

http://stackoverflow.com/q/23870645
score: 2
has answer: http://stackoverflow.com/a/23879983
upvote count: 2
type: UnansweredQuestion
tagged with: java
has body: I have a collection of profiles(name: profiles) in a database(name: db) in mongo. Each profile has {id, lastUpdatedAt, createdAt} fields. Each profile can be decided to be stale, based on lastUpdated field of the profile. If now_in_millisecs-profile.lastUpdated&gt;30*60*1000(30 mins), profile is stale. I have multiple workers(running on diff.machines) who try to grab unused profile and assume that they are owning. All workers try to read profiles.all(); Loop through each profile, check for a stale profile and grab it. (if no profile is free, a new profile is created). Each active worker keeps updating lastUpdated at every 30mins (same time window I was checking above) As I tried this setup, I see multiple workers picking up same stale profile. I guess this is because, all workers see same stale profile and decide to reuse it and everyone gets the same profile name. How can I avoid this in mongodb. Am I supposed to use Transactions in mongodb(which are not supported directly). Looks like reader writer lock on one document does not help here. I m using spring-mongo-java.
type: Question
tagged with: mongodb
has title: Multiple readers attempting to update same document in mongodb
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/36676164
type: Comment
has text: I suppose it depends on what you mean by "correctly"; I'll retract my earlier comment.
comment on: http://stackoverflow.com/a/23835642
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36721320
type: Comment
type: QuestionComment
has text: And how do you `put` objects in a `HashMap`?
comment on: http://stackoverflow.com/q/23859041
score: 0

http://stackoverflow.com/a/23796119
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/36601208
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/118883457
accepted answer of: http://stackoverflow.com/q/23796063
answers question: http://stackoverflow.com/q/23796063
has body: You are looking for a java.awt.geom.Rectangle2D.Double. Which allow you to draw at decimal coordinates. Rectangle2D.Double rect = new Rectangle2D.Double(.5, .5, 4, 6); Creates a rectangle at coordinates of (.5, .5) and dimensions of (4, 6). You should draw this using Graphics2D. Here's how to convert your Graphics g into a Graphics2D object then draw the rect: Graphics2D g2d = (Graphics2D)g.create(); g2d.draw(rect);
has comment: http://stackoverflow.com/comment/118878975
has comment: http://stackoverflow.com/comment/36601231
has comment: http://stackoverflow.com/comment/36601675
has comment: http://stackoverflow.com/comment/118883494
upvote count: 5
has comment: http://stackoverflow.com/comment/118878933
type: Answer

http://stackoverflow.com/comment/36691076
type: AnswerComment
has text: thats the result so far ... I don't understand the compilers statement `[Ljava.lang.Comparable;@13060ee9 Exception in thread "main" java.lang.StackOverflowError at java.io.PrintStream.write(Unknown Source) at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source) at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source) at sun.nio.cs.StreamEncoder.flushBuffer(Unknown Source) at java.io.OutputStreamWriter.flushBuffer(Unknown Source) at java.io.PrintStream.write(Unknown Source) ... at java.io.PrintStream.println(Unknown Source) at src.MergeSort.sort(MergeSort.java:21)`
type: Comment
comment on: http://stackoverflow.com/a/23843290
score: 0

http://stackoverflow.com/comment/36871349
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23935534
has text: one usually don't make a webapp jar it and pass it on to others for use rather we deploy it on a server within a servlet container and giv access to app over network.
score: 1

http://stackoverflow.com/comment/36694487
type: QuestionComment
comment on: http://stackoverflow.com/q/23843348
has text: @user3580294 Sure, I'm not processing data _while_ taking it out of the queue, but with only one queue I would need to wait until the slowest worker returns and then start over with the next element.
score: 0
type: Comment

http://stackoverflow.com/comment/36866982
comment on: http://stackoverflow.com/q/23920239
score: 0
type: Comment
type: QuestionComment
has text: sure let me put a part of the code :)

http://stackoverflow.com/comment/36858869
has text: @zx81 Can you explain this. How it works.The lookahead (?=.*?[0-9a-zA-Z])
comment on: http://stackoverflow.com/a/23930162
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23816030
tagged with: java
upvote count: 2
answer count: 1
tagged with: amazon-web-services
favorite count: 0
has title: AWS S3 JAVA SDK - listObjects returns incomplete directory listings
has body: When i use the listObjects() method, AWS returns a list of files and folders similar to this: root/ root/projects/ root/projects/101/ root/projects/102/ root/projects/102/file1.pdf root/images/image1.png root/images/image2.png root/favicon.ico My results are not being truncated, and I'm wondering why it doesn't return a record for root/images/ I am not using the delimiter feature.
type: UnansweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23852590
type: Question
tagged with: amazon-s3

http://stackoverflow.com/q/23929046
answer count: 4
accepted answer: http://stackoverflow.com/a/23929241
has comment: http://stackoverflow.com/comment/36854081
upvote count: 1
has answer: http://stackoverflow.com/a/23929691
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40156449
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23929691
has answer: http://stackoverflow.com/a/23929295
type: Question
has title: java string subsitutions using object
has answer: http://stackoverflow.com/a/23929241
tagged with: ognl
downvote count: 0
has body: Output of the below code is : This is Raja from ${Address.Street} i did my ${Education.degree} from ${Education.university} but what I need is This is Raja from Namakkal i did my B.E from Anna University is it possible to achieve by using Freemarker, OGNL or by using spring. public class Test { public static void main(String arg[]) throws TemplateModelException { Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); Map&lt;String, Object&gt; address = new HashMap&lt;String, Object&gt;(); address.put("Street", "Namakkal"); Qualification qualification = new Test.Qualification(); map.put("Name", "Raja"); map.put("Address", address); map.put("Education", qualification); StrSubstitutor strsub = new StrSubstitutor(map); String str = "This is ${Name} from ${Address.Street} i did my ${Education.degree} from ${Education.university}"; System.out.println(strsub.replace(str)); } public static class Qualification { public String getDegree() { return "B.E"; } public String getUniversity() { return "Anna University"; } } } please explain the simplest and effective way to achieve this.
has comment: http://stackoverflow.com/comment/36854444
favorite count: 0
tagged with: freemarker
has comment: http://stackoverflow.com/comment/36854128

http://stackoverflow.com/a/23799074
score: 4
has body: Readers are to read text data with particular character encoding (UTF-8, ISO etc..) while on the other hand, streams are binary data. They work same but there parent classes are different. in a nutshell, if you have to read binary data and save it somewhere, use stream. If you have to read text in a particular encoding and then play with it, then use readers. Hope this answers.
upvote count: 4
answers question: http://stackoverflow.com/q/23799015
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23799015
type: Answer
has comment: http://stackoverflow.com/comment/36606557
has comment: http://stackoverflow.com/comment/36607099
has comment: http://stackoverflow.com/comment/36607166
has comment: http://stackoverflow.com/comment/36606500

http://stackoverflow.com/comment/36811013
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23905162
has text: Everything seems to be ok. Could you post all your code?. I can see that myElements is a field so, where do you assign values and use them?

http://stackoverflow.com/q/23884885
accepted answer: http://stackoverflow.com/a/23885032
score: 0
has comment: http://stackoverflow.com/comment/36770638
has answer: http://stackoverflow.com/a/23885032
answer count: 1
has title: Regex split by delimeter excluding escaped ones and keep empty strings
tagged with: regex
has comment: http://stackoverflow.com/comment/36770003
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36770689
type: Question
has comment: http://stackoverflow.com/comment/36770210
has body: I need to split a string using "|" as a delimeter, which can be escaped using preceeding "?", in which case it should not be treated as delimeter. I also want to keep the empty strings in the result, where there are multiple delimeters following each other with nothing in between - I am actually having problem with this part. Few examples: aaa|bbb|ccc Result: aaa bbb ccc aaa?|bbb|ccc Result: aaa?|bbb ccc aaa?|bbb||ccc|||ddd Result: aaa?bbb &lt;empty string&gt; ccc &lt;empty string&gt; &lt;empty string&gt; ddd I am using below regex which splits the string correctly while escaping delimeters, but it discards all the empty strings in case of "||". I am using Pattern/Matcher and Java. ([^?\\|]|\\?.)+ Any help appreciated.

http://stackoverflow.com/q/23939966
score: 0
answer count: 1
tagged with: jlabel
type: UnansweredQuestion
has title: java moving jlabel with picture inside other jlabel bounds
tagged with: java
tagged with: image
tagged with: move
type: Question
has comment: http://stackoverflow.com/comment/36883545
has body: Im programing game in netbeans in java I have 2 jlabels first jLabel1 I want to move around because it has figure picture i usualy use jLabel1.setLocation(x,y); // problem is that this focuses on whole frame and starts coordinates from upper-left corner of the frame I want coordinating within jLabel2 wich has picture inside so that coordinate 0,0 will be on upper-left of the jlabel2 (upper-left of the jLabel2 picture) Is this possible and how Tnx for answers
has answer: http://stackoverflow.com/a/23960588

http://stackoverflow.com/comment/36836491
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23919562
has text: there should be key-value pairs, which are Strings, and represent Post request data.

http://stackoverflow.com/comment/36626246
type: QuestionComment
comment on: http://stackoverflow.com/q/23808386
has text: It is generally recommended to use caching on the producer side when using a `JmsTemplate`. I can't speak to the hornetq issue.
score: 0
type: Comment

http://stackoverflow.com/a/23783781
type: Answer
accepted answer of: http://stackoverflow.com/q/23783720
upvote count: 3
answers question: http://stackoverflow.com/q/23783720
score: 3
has body: copyOfRange returned T[], but you put it in sort() and sort() returned a Object[].
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36808559
comment on: http://stackoverflow.com/q/23904731
score: 0
has text: @StanislavL. It will cover the JTextfield and any input can't be seen anymore.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23826660
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23809242
type: Answer
has body: hi i tried your example case, it worked , use like this while executing the query for JDBC Client : String sql = "INSERT OVERWRITE DIRECTORY '/user/jim/dir' select * from " + tableName; stmt.execute(sql); Note : make sure /user/jim/dir is writable , if not make it writable as hadoop fs -chmod a+rwx /user/jim/dir use stmt.execute(sql) not stmt.executeQuery(sql); PS: problem still exists means let me know, will share the complete code.
answers question: http://stackoverflow.com/q/23809242
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36661184
type: AcceptedAnswer

http://stackoverflow.com/comment/36590806
type: Comment
type: QuestionComment
score: 0
has text: as constant do you mean .. persistent queue?
comment on: http://stackoverflow.com/q/23789001

http://stackoverflow.com/comment/66152287
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23905202
type: QuestionComment
has text: what stops you from injecting both dependencies in both of those classes?

http://stackoverflow.com/comment/36841980
type: Comment
type: QuestionComment
score: 1
has text: From your last screenshot, looks like your Eclipse doesn't have the JDK 7 configured or that your project lost that configuration.
comment on: http://stackoverflow.com/q/23922387

http://stackoverflow.com/q/23896840
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23896977
tagged with: path
linked to: http://stackoverflow.com/q/3861989
has body: I have have a file that I want to use in my project which is in the resources package src.res Following what was stated in this answer, I believe that my code is valid. File fil = new File("/res/t2.nii"); // Prints C:\\res\\t2.nii System.out.println(fil.getAbsolutePath()); The problem is that I that file is in my projects file not there, so I get an Exception. How am I suppose to properly convert from relative path to absolute?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23896871
tagged with: java
has answer: http://stackoverflow.com/a/23896977
has answer: http://stackoverflow.com/a/23896871
linked to: http://stackoverflow.com/q/3204955
type: Question
has answer: http://stackoverflow.com/a/23896875
has title: Relative to absolute path in java
tagged with: relative-path

http://stackoverflow.com/comment/36633166
comment on: http://stackoverflow.com/a/23812609
score: 0
has text: I think i got the answer because i am passing value of brand and flavor as any array because i am using check box. i tried accessing the servlet without calling the function, so if i leave brand or flavor unchecked then it shows me null pointer exception. Don't you think that is the reason
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23935248
answer count: 0
has comment: http://stackoverflow.com/comment/36865545
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36869639
tagged with: java
tagged with: hibernate
has title: What may be causing this WrongClassException Hibernate
type: Question
tagged with: jsf-2
has body: I'm starting to work with Hibernate and I just got this exception that I don't know where to start to look. I know the beginning of the Exception says "Error reading 'frotas' on type br.com.wplex.cccw.mbean.FrotaMBean", but thats because the error occurs inside the method getFrotas(), at more or less this query : String hql = "from FrotaBO f order by f.aPartirDe". getHibernateSession().createQuery(hql).list(); Both DadosDeCobrancaBO and ClienteBO extend AbstractBO Exception: javax.el.ELException: /cadastros/Frota/frotaLista.xhtml @24,34 value="#{frotaBean.frotas}": Error reading 'frotas' on type br.com.wplex.cccw.mbean.FrotaMBean at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:107) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178) at javax.faces.component.UIData.getValue(UIData.java:554) at org.primefaces.component.datatable.DataTable.getValue(DataTable.java:867) at org.primefaces.component.api.UIData.getDataModel(UIData.java:579) at javax.faces.component.UIData.getRowCount(UIData.java:339) at org.primefaces.component.api.UIData.calculateFirst(UIData.java:157) at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:176) at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:82) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878) at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:63) at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:47) at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:202) at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:119) at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:56) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878) at javax.faces.component.UI…
has comment: http://stackoverflow.com/comment/36865685
score: 0
has comment: http://stackoverflow.com/comment/36869367

http://stackoverflow.com/comment/36764467
type: QuestionComment
comment on: http://stackoverflow.com/q/23881999
score: 0
has text: Did you print the **json** ?
type: Comment

http://stackoverflow.com/q/23889208
has answer: http://stackoverflow.com/a/23889960
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/36779335
has comment: http://stackoverflow.com/comment/36778337
score: 2
has comment: http://stackoverflow.com/comment/36779139
tagged with: java
has comment: http://stackoverflow.com/comment/36778531
has comment: http://stackoverflow.com/comment/36778989
has body: I Have a client-Server connection.. Whem my server is connected to the client it must send a message through the outputstream and then print it when it receive the message from the inputStream. But when the client is connected I receive back the "Connected" message but I don't see the "this is a Text message\n" sent my the Server This is my Server: public class Server1 extends JFrame{ static JTextArea testoarea; static Socket socket; static ServerSocket server; public Server1(){ testoarea = new JTextArea(); add(new JScrollPane(testoarea)); setSize(600, 700); setVisible(true); } public static void main(String[] args) { Server1 server1 = new Server1(); server1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); inizzializza(); connetti(); } private static void inizzializza(){ try { server = new ServerSocket(7100); showMessage("Server Iniziato\n"); } catch (IOException e) { System.out.println(e); } } private static void connetti() { try { socket = server.accept(); showMessage("Connected \n"); PrintWriter output = new PrintWriter(socket.getOutputStream()); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); output.println("this is a Test message\n"); showMessage(input.readLine().toString()); output.flush(); } catch (IOException e) { e.printStackTrace(); } } private static void showMessage(final String text) { // TODO Auto-generated method stub SwingUtilities.invokeLater( new Runnable() { public void run() { testoarea.append(text); } } ); } } this is what I get back:
type: Question
has title: Socket server, I don't receive the message sent by my Server
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36778384
has comment: http://stackoverflow.com/comment/36778664
has comment: http://stackoverflow.com/comment/36778434
has comment: http://stackoverflow.com/comment/36778553

http://stackoverflow.com/a/23832555
upvote count: 8
has body: It sounds like you shouldn't implement this as a runtime check. It can only fail if a developer who has control over the code did some bad changes. Detecting changes that introduce bugs is what tests are for. Write a simple test that checks if everything is correct. The other answers already provide some good solutions to check for duplicated enums. Instead of running the application to see if the enum initialisation fails, run the test (I hope you already write and run tests anyway).
type: AcceptedAnswer
downvote count: 0
score: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/23831903
answers question: http://stackoverflow.com/q/23831903

http://stackoverflow.com/comment/36760309
comment on: http://stackoverflow.com/a/23879719
type: AnswerComment
score: 0
type: Comment
has text: it gives me an outofBounds exception, here is the code

listview
tags question: http://stackoverflow.com/q/23894986
tags question: http://stackoverflow.com/q/23863932
tags question: http://stackoverflow.com/q/23912903
tags question: http://stackoverflow.com/q/23860062
tag name: listview
tags question: http://stackoverflow.com/q/23822064
tags question: http://stackoverflow.com/q/23837139
tags question: http://stackoverflow.com/q/23894260
tags question: http://stackoverflow.com/q/23800837
tags question: http://stackoverflow.com/q/23836145
tags question: http://stackoverflow.com/q/23929496
tags question: http://stackoverflow.com/q/23852471
tags question: http://stackoverflow.com/q/23822550
tags question: http://stackoverflow.com/q/23896302
tags question: http://stackoverflow.com/q/23866602
tags question: http://stackoverflow.com/q/23880813
type: Tag
tags question: http://stackoverflow.com/q/23939800

http://stackoverflow.com/q/23902073
answer count: 2
upvote count: 0
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
has title: get the max volume from an arrayList of type objects
downvote count: 1
has answer: http://stackoverflow.com/a/23902128
has answer: http://stackoverflow.com/a/23902106
type: Question
has body: ok so I made a class that implements comparable public abstract class Shape3D implements Comparable&lt;Shape3D&gt; { private String type; public double radious; public double height; public Shape3D(){ } protected Shape3D(String type){ this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; } public abstract double area(); public abstract double volume(); public int compareTo(Shape3D o) { double volume1 = this.volume(); double volume2 = o.volume(); if (volume1 &gt; volume2){ return 1; } else if (volume1 &lt; volume2){ return -1; } else { return 0; } } public int compareTo2(Shape3D o) { double area1 = this.area(); double area2 = o.area(); if (area1 &gt; area2){ return 1; } else if (area1 &lt; area2){ return -1; } else { return 0; } } } two classes will extend from this one Cylinder and Pyramid and I have a class that reads a file and returns an array of the file import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class ShapeReader { private File inputFile; public ShapeReader(){ } public ShapeReader(File inputFile){ this.inputFile = inputFile; } public ArrayList&lt;Shape3D&gt; readShapes(){ ArrayList&lt;Shape3D&gt; shapes = new ArrayList&lt;Shape3D&gt;(); try { inputFile = new File("shapes3D.txt"); Scanner sc = new Scanner (inputFile); while(sc.hasNextLine()){ String type = sc.nextLine(); if (type.contains("Pyramid")){ String[] data = type.split(","); Pyramid p = new Pyramid(); p.setType(data[0]); p.setBase(Double.parseDouble(data[1])); p.setHeight(Double.parseDouble(data[2])); p.setSlant(Double.parseDouble(data[3])); shapes.add(p); } else if (type.contains("Cylinder")){ String[] data = type.split(","); Cylinder c = new Cylinder(); c.setType(data[0]); c.setRadious(Double.parseDouble(data[1])); c.setHeight(Double.parseDouble(data[2])); shapes.add(c); } } } catch (Exception e) { e.printStackTrace(); } return shapes; } } now on the class that has t…
tagged with: java
score: -1
tagged with: comparable

http://stackoverflow.com/a/23795644
has comment: http://stackoverflow.com/comment/53991569
answers question: http://stackoverflow.com/q/23795360
has comment: http://stackoverflow.com/comment/36600550
accepted answer of: http://stackoverflow.com/q/23795360
type: AcceptedAnswer
downvote count: 0
has body: 1. Using a local Thread variable prevents other threads invoking the run() method on your object. Only the thread represented by this object instance can use the run() method. It is generally bad practice to invoke the run() method of a Thread manually from a different Thread, but certainly possible. 2. This point needs to be explained in the context of point 1. This part also considers the case when interval is very long, and the thread needs to be stopped ASAP. You certainly need to nullify the reference because otherwise the code in part 1 will just continue looping. But consider what may happen if you simplify the stop method to: public void stop() { waiter.interrupt(); waiter = null; } Since this is executed from another thread, it can be intertwined with the run() method in any way. For example, threadA calls stop() to stop threadB which is in run(): threadB: sleep(interval) threadA: waiter.interrupt() threadB: caught InterruptedException threadB: call to repaint threadB: enter next while cycle threadB: enter sleep(interval) threadA: waiter == null In this case, instead of immediately stopping, threadB does another cycle of sleeping, which fails the set task of stop a thread that waits for long periods. In the given implementation you first nullify, then interrupt, which prevents this kind of behaviour. 3. In short: Because another thread may have notified your code, without setting the correct flag. The general contract of notify() is that it is harmless to call (but a useless call will obviously consume some resources). All threads are supposed to be able to cope with spurious wake-ups.
type: Answer
has comment: http://stackoverflow.com/comment/36623689
has comment: http://stackoverflow.com/comment/53997436
has comment: http://stackoverflow.com/comment/54075444
has comment: http://stackoverflow.com/comment/53993281
upvote count: 3
has comment: http://stackoverflow.com/comment/36617706
has comment: http://stackoverflow.com/comment/54075626
has comment: http://stackoverflow.com/comment/54001350
score: 3

http://stackoverflow.com/q/23841232
tagged with: java
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/36687308
has body: Suppose that I have an arraylist called myList of threads all of which are created with an instance of the class myRunnable implementing the Runnable interface, that is, all the threads share the same code to execute in the run() method of myRunnable. Now suppose that I have another single thread called singleThread that is created with an instance of the class otherRunnable implementing the Runnable interface. The synchornization challenge I have to resolve for these threads is the following: I need all of the threads in myList to execute their code until certain point. Once reached this point, they shoud sleep. Once all and only all of the threads in myList are sleeping, then singleThread should be awakened (singleThread was already asleep). Then singleThread execute its own stuff, and when it is done, it should sleep and all the threads in myList should be awakened. Imagine that the codes are wrapped in while(true)'s, so this process must happen again and again. Here is an example of the situation I've just described including an attempt of solving the synchronization problem: class myRunnable extends Runnable { public static final Object lock = new Object(); static int count = 0; @override run() { while(true) { //do stuff barrier(); //do stuff } } void barrier() { try { synchronized(lock) { count++; if (count == Program.myList.size()) { count = 0; synchronized(otherRunnable.lock) { otherRunnable.lock.notify(); } } lock.wait(); } } catch (InterruptedException ex) {} } } class otherRunnable extend Runnable { public static final Object lock = new Object(); @override run() { while(true) { try { synchronized(lock) { lock.wait(); } catch (InterruptedException ex) {} // do stuff try { synchronized(myRunnable.lock) { myRunnable.notifyAll(); } } } } class Program { public static ArrayList&lt;Thread&gt; myList; public static void main (string[] args) { myList = new ArrayList&lt;Thread&gt;(); for(int i = 0; i &lt; 10; i++) { myList.add(new Thread(new myRunnable())); myList…
type: Question
has comment: http://stackoverflow.com/comment/36687555
has comment: http://stackoverflow.com/comment/36687486
tagged with: deadlock
answer count: 1
downvote count: 0
favorite count: 0
tagged with: synchronization
has title: how to synchronize a set of multiple threads with respect to a single thread in Java
has comment: http://stackoverflow.com/comment/36687525
has answer: http://stackoverflow.com/a/23841547
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/23866308
has body: I want to start up my application within my test class to test it. I've written a base class for my tests and have a method such like that: public static void startServerIfRequired() { if (server != null) { return; } server = new Server(TEST_PORT); ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig"); sh.setInitParameter("com.sun.jersey.config.property.packages", "org.gogo.rena.rest"); sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true"); ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS); context.setResourceBase("src/main/webapp"); context.setContextPath("/"); context.addServlet(sh, "/*"); server.setHandler(context); try { server.setStopAtShutdown(true); server.start(); //server.join(); } catch (Exception e) { fail("Error has occurred while starting! Error is as follows: " + e.getMessage()); } } I do not have any resources at test package. I use Jersey at my Spring application. My rest packages are under gogo.rena.rest. Server does not throws error but when I try to get any URL I get 404 error? EDIT: When I check the logs it says that: ... Server - Started @20756ms and also it founds my rest class as a root resource.
tagged with: java
tagged with: unit-testing
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/36737345
score: 0
has title: Embedded Jetty for Unit Testing
has comment: http://stackoverflow.com/comment/36736920
tagged with: embedded-jetty
has comment: http://stackoverflow.com/comment/36739948
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/36735716
answer count: 0

http://stackoverflow.com/comment/36773750
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23886913
has text: You state that you have a problem decrypting but post a code that performs encryption. What do you expect in return?
type: Comment

http://stackoverflow.com/a/23888465
score: 2
accepted answer of: http://stackoverflow.com/q/23888255
has comment: http://stackoverflow.com/comment/36808510
has comment: http://stackoverflow.com/comment/36809189
answers question: http://stackoverflow.com/q/23888255
has comment: http://stackoverflow.com/comment/36808995
has body: How the below code runs? Because I am calling the begintransaction after save. Hibernate will not try to insert/update the database as soon as you call save(). It will try to insert only when you try to commit a transaction. If you don't commit a transaction, it will not run as you expect. @Transactional(propagation=Propagation.NEVER) what does that mean? Following are the 7 different Transaction propagation behaviors supported by Spring PROPAGATION_REQUIRED (default) PROPAGATION_REQUIRED_NEW PROPAGATION_SUPPORTS PROPAGATION_NOT_SUPPORTED PROPAGATION_MANDATORY PROPAGATION_NEVER PROPAGATION_NESTED (Note: You don't need to use a transaction in all your methods. You can also have a normal method without a transaction) To execute a method under a transaction, annotate it with @Transactional. By default it runs under PROPAGATION_REQUIRED behavior which means one of the two things New transaction will be activated if there is no existing transaction in the caller. Join the existing transaction if one is already activated by the caller. When a method is annotated with @Transaction(prorogation=Propagation.NEVER) it shouldn't be called, by another method, with an active transaction. Otherwise, an exception will be thrown. Propagation.NEVER is used when you want a specific logic/method to be executed strictly without an active transaction. In my experience, I have never used this attribute. 95% of the time you will be satisfied with the default PROPAGATION_REQUIRED behavior. However, it is good to have a knowledge on different behaviors. Let me explain with an example: @Component public class TransactionTutorial { @Transactional public void aboutRequired() { //This method will create a new transaction if it is called with no active transaction //Some logic that should be executed within a transaction //normal() method will also run under the newly created transaction. normal(); //An exception will be thrown at this point //because aboutNever() is marked as Propagation.NEVER a…
has comment: http://stackoverflow.com/comment/36810064
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36806936
has comment: http://stackoverflow.com/comment/36809922
has comment: http://stackoverflow.com/comment/36808175
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36808833

http://stackoverflow.com/comment/36683054
type: QuestionComment
comment on: http://stackoverflow.com/q/23839027
score: 0
has text: I just realize this is a bad example. I want to print what goes inside setSalary(). In my example would be 100. Thanks for being nice guys.
type: Comment

http://stackoverflow.com/q/23849471
answer count: 2
has answer: http://stackoverflow.com/a/23874126
tagged with: jar
tagged with: tomcat
tagged with: servlets
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am having a problem where I have Apache CXF jar included in my project (I use Eclipse as IDE) and after running Tomcat I get the following: INFO: validateJarFile(/home/USER/programming/tools/apache-tomcat-7.0.50/webapps/abosi/WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class This is because Apache CXF is deploying geronimo-servlet_3.0_spec-1.0.jar as a part of the app to WEB_INF/lib directory but Tomcat already has it's servlet implementation in TOMCAT_ROOT/./lib/servlet-api.jar. How can I prevent this ?
has comment: http://stackoverflow.com/comment/36703308
has comment: http://stackoverflow.com/comment/36702861
has answer: http://stackoverflow.com/a/24979606
tagged with: cxf
tagged with: java
has title: Apache CXF geronimo-servlet_3.0_spec-1.0.jar - jar not loaded having Tomcat's servlet jar
type: Question

http://stackoverflow.com/a/23905890
downvote count: 0
has body: You can use various image loader library for this purpose. The images loading library will handle all the issues related to image,memory caching for image,asyn task and all that. 1.)http://square.github.io/picasso/ This is an very efficient library to load images from URL. you have to write only one line code to perform all your work. Picasso.with(context) .load(url) .placeholder(R.drawable.user_placeholder) .error(R.drawable.user_placeholder_error) .into(imageView); 2.)https://github.com/koush/ion Here is another library for the same purpose Ion.with((ImageView) viewImage) .resize(96, 96) .centerInside() .load(url); You can find so many other library for this purpose: Universal image loader library etc.. You have to just include these library into your project and you can do your work by few lines of code..
accepted answer of: http://stackoverflow.com/q/23905546
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23905546
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/comment/36874973
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23940400
has text: I'm pretty sure that the code that's in your constructor should be called from the Swing Event Dispatch Thread. Not sure if it's completely relevant, but it's what I'd try. Check out http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#invokeAndWait%28java.lang.Runnable%29

libgdx
tags question: http://stackoverflow.com/q/23884606
tags question: http://stackoverflow.com/q/23898851
tags question: http://stackoverflow.com/q/23836085
tags question: http://stackoverflow.com/q/23809849
tags question: http://stackoverflow.com/q/23932887
tags question: http://stackoverflow.com/q/23840597
tags question: http://stackoverflow.com/q/23921555
tag name: libgdx
tags question: http://stackoverflow.com/q/23886695
tags question: http://stackoverflow.com/q/23871510
tags question: http://stackoverflow.com/q/23938879
tags question: http://stackoverflow.com/q/23876868
tags question: http://stackoverflow.com/q/23915568
tags question: http://stackoverflow.com/q/23809143
tags question: http://stackoverflow.com/q/23859039
tags question: http://stackoverflow.com/q/23841976
tags question: http://stackoverflow.com/q/23818908
tags question: http://stackoverflow.com/q/23816414
tags question: http://stackoverflow.com/q/23836328
tags question: http://stackoverflow.com/q/23937330
tags question: http://stackoverflow.com/q/23883563
tags question: http://stackoverflow.com/q/23859194
type: Tag
tags question: http://stackoverflow.com/q/23925782
tags question: http://stackoverflow.com/q/23824662
tags question: http://stackoverflow.com/q/23817034
tags question: http://stackoverflow.com/q/23905129
tags question: http://stackoverflow.com/q/23888671
tags question: http://stackoverflow.com/q/23847103
tags question: http://stackoverflow.com/q/23859603
tags question: http://stackoverflow.com/q/23814452
tags question: http://stackoverflow.com/q/23872082
tags question: http://stackoverflow.com/q/23838634
tags question: http://stackoverflow.com/q/23861320
tags question: http://stackoverflow.com/q/23841307
tags question: http://stackoverflow.com/q/23838726
tags question: http://stackoverflow.com/q/23815954
tags question: http://stackoverflow.com/q/23849905
tags question: http://stackoverflow.com/q/23833879
tags question: http://stackoverflow.com/q/23927941
tags question: http://stackoverflow.com/q/23845741
tags question: http://stackoverflow.com/q/23901398
tags question: http://stackoverflow.com/q/23856505
tags question: http://stackoverflow.com/q/23814987

http://stackoverflow.com/q/23840473
type: AnsweredQuestion
tagged with: java
has title: error when import AWTUtilities
type: Question
tagged with: jdk-internal-api
answer count: 1
downvote count: 0
favorite count: 0
has body: I try to use AWTUtilities if these are enabled so I use the ways import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.*; public class MenuPrincipal extends Llaves{ JFrame Frame=new JFrame(); }; public MenuPrincipal() { try {Class.forName("com.sun.awt.AWTUtilities"); } catch (Exception e) {} Frame.setSize(600, 500); Frame.setResizable(false); Frame.setUndecorated(true); Frame.setLayout(null); Frame.setLocationRelativeTo(null); Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.getContentPane().setBackground(Color.WHITE); try {AWTUtilities.setWindowOpaque(Frame, false); } catch (Exception e) {} } so it shows an error when I try to compile with netBeans try {AWTUtilities.setWindowOpaque(Frame, false); } catch (Exception e) {} but if I use this import, the problem is solved import com.sun.awt.AWTUtilities; but when I run the jar in a PC without AWTUtilities it throws an error in the import import com.sun.awt.AWTUtilities; I can't put a try catch() in the import, so what can I do?
has answer: http://stackoverflow.com/a/23840596
accepted answer: http://stackoverflow.com/a/23840596
tagged with: awtutilities
score: 2
upvote count: 2
tagged with: swing
tagged with: import

http://stackoverflow.com/a/24627785
score: 1
upvote count: 1
has body: So what I am assuming here is that you have the following repository: interface PersonRepository extends CrudRepository<Person, Long> { List<Person> findByAgeBetween(Long min, Long max); } Based on this you'd get the following resources exposed: A collection resource as generally described here named persons (we're using a pluralization library by default, but you can tweak these names and paths using @RepositoryRestResource). An item resource as generally described here for each element in the collection. A search resource named search as generally described here. It contains a list of links pointing to individual query method resources (see next). A query method resource per query method as generally described here. The parameter names need to be defined using @Param annotations as on Java versions before 8, interface methods do not carry naming information so that we cannot find out about it. That means an improved repository declaration would look something like this: interface PersonRepository extends CrudRepository<Person, Long> { List<Person> findByAgeBetween(@Param("min") Long min, @Param("max") Long max); } This will cause the following output when you access the search resource: _links : { self : { href : "…" }, findByAgeBetween : { href : "…/persons/search/findByAgeBetween{?min,max}", templated : true } } A client would now go ahead, find the link named findByAgeBetween, recognize that its an RFC 6570 Uri template (through the templated parameter as the HAL spec suggests) and expand the template with the adequate values for min and max. The important aspect here is that the server is free to change the URI structure as long as the parameter names stay the same. You could go ahead and rather use path variables instead of request parameters or the like. By using the template approach the client doesn't need to know about the structure. It only knows about template variables in general. Both the name of the link and the path can be customized by using @RestR…
answers question: http://stackoverflow.com/q/23901494
accepted answer of: http://stackoverflow.com/q/23901494
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23916595
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23916947
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36830706
tagged with: url-rewriting
favorite count: 0
has title: Is this the correct xml regex for URL?
accepted answer: http://stackoverflow.com/a/23916947
tagged with: regex
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I am implementing urlReWriter into my Java web project. I want to change this url: /read-post.jsp?id=1&amp;title=some-cool-blog-title into this shortened/cleaner url: /read-post/1/some-cool-blog-title This is the rule I have implemented: &lt;rule&gt; &lt;from&gt;^/read-post/([0-9]+)/([0-9][a-z][A-Z]+)&lt;/from&gt; &lt;to&gt;/read-post.jsp?id=$1&amp;amp;title=$2&lt;/to&gt; &lt;/rule&gt; The problem is it isn't re writing the url and I suspect it is because the xml regex I've used is incorrect? How do i format it correctly when there can be any number for the id and any number, character or special character - for the title?

http://stackoverflow.com/q/23793310
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23793456
has title: Android in-app shop: How to restore purchases
tagged with: andengine
type: Question
upvote count: 4
downvote count: 0
score: 4
has body: I'm developing an Android game that contains a shop where the player can buy virtual clothes for the main character like t-shirts, hats, trousers etc. These articles can be bought with coins which the player can buy as an in-app-purchase (unmanaged). Example: Assuming that the player buys 100 coins for 1.99$ and then buys 4 different t-shirts using these coins: Now 4 t-shirts are unlocked (stored locally) and the 100 coins are spent. But what if the player buys a new device or wants to play the game on another device? Then the 4 t-shirts cannot be restored, right? Is there a way to store such purchases to a google account? And what is the best way to restore such in-app purchases? I've read about androids AccountManager and cloud services from google, but it would be nice to achieve what I want using the In-app Billing API from google?
accepted answer: http://stackoverflow.com/a/23793456
answer count: 1
favorite count: 0
tagged with: google-api
tagged with: google-play
tagged with: android

apache-httpclient-4.x
tags question: http://stackoverflow.com/q/23823252
tags question: http://stackoverflow.com/q/23870899
tags question: http://stackoverflow.com/q/23905017
tags question: http://stackoverflow.com/q/23866171
tag name: apache-httpclient-4.x
type: Tag
tags question: http://stackoverflow.com/q/23855202

http://stackoverflow.com/comment/36749281
score: 0
has text: what have you tried so far? There is a setVisible(boolean) method that seems to be a good start
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23874314

http://stackoverflow.com/comment/36629459
score: 0
type: Comment
has text: Thank you for the analysis. I really don't have an issue about the float fitting into the byte because it's just rgb values casted to float for arithmetic reasons. The whole idea is to make this conversion in memory than reading again the input image file, which I guess it's costlier, isn't?
comment on: http://stackoverflow.com/a/23809064
type: AnswerComment

http://stackoverflow.com/q/23881225
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/36764054
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36805489
has comment: http://stackoverflow.com/comment/36763025
upvote count: 2
has answer: http://stackoverflow.com/a/66373116
answer count: 1
favorite count: 0
has title: Cookie cannot be resolved to a type in eclipse
has body: I am doing a simple project to learn session management in java. I am getting an error Cookie cannot be resolved to a type when I write my jsp page: &gt; Cookie[] cookies = request.getCookies();` shows error. I am using Tomcat v6.0. A few blogs suggested in adding a targeted runtime to resolve this. But I am unable to add. Please help me resolve this. Thanks.

http://stackoverflow.com/comment/36840718
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23921386
has text: Closing the connection is a part of real close right? I mean if I use JTA, then I don't have to close the JDBC connection explicitly right?
score: 0

http://stackoverflow.com/comment/36701665
score: 0
comment on: http://stackoverflow.com/q/23847988
type: Comment
type: QuestionComment
has text: Ok,I understand @camickr.Thank you.

screen-scraping
tags question: http://stackoverflow.com/q/23906609
type: Tag
tag name: screen-scraping

http://stackoverflow.com/comment/36623987
comment on: http://stackoverflow.com/a/23805059
type: AnswerComment
score: 0
has text: hrm, my goal is to get the results back to Java so I can benchmark and compare my results to the stored proc's results. So if I need to use another table, then every test, I'll be clearing the table, inserting new values into it, and then selecting from the table, which is not fair for benchmarking. I presume the code works from a SQL perspective, but I'm wondering if there's any direct way to get the SELECT output back to Java without this intermediary table that needs to be cleared each time?
type: Comment

http://stackoverflow.com/a/23879510
answers question: http://stackoverflow.com/q/23879154
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36760002
has comment: http://stackoverflow.com/comment/36759947
has comment: http://stackoverflow.com/comment/36760049
has body: What about this? It uses negative lookahead to make sure any time it matches a space, it isn't followed by a space. \w(\w| (?! )){2,10}\w
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23879154
type: Answer

http://stackoverflow.com/comment/36869045
type: QuestionComment
score: 0
has text: @peeskillet The logical instances (containing variables with Hosts, Names, subnetmask, etc. ) are stored in a ArrayList. The panels are created inside a jScrollpane
comment on: http://stackoverflow.com/q/23937050
type: Comment

http://stackoverflow.com/q/23813047
tagged with: java
has body: I want to bundle an image with a ssh and ftp server as well as a jar file that will run as soon as the container gets started. The problem is that I don't want to have a different installation of the JVM on each image (I will potentially have many instances running on the same host, it will be a waste of resources). So I was wondering if its possible to use the host JVM to run the jar's in the containers. Thanks! Rodrigo.
has title: Using host JVM to run jar inside a docker container
type: Question
score: 3
tagged with: docker
answer count: 1
tagged with: jvm
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/35759454
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36860765
type: QuestionComment
comment on: http://stackoverflow.com/q/23932543
has text: BEFORE variable names. not in variable names is my question!!!!!! This is not a duplicate!!
score: 0
type: Comment

http://stackoverflow.com/a/23851445
score: 0
answers question: http://stackoverflow.com/q/23851348
type: Answer
has body: Yes, of course it is possible, that's exactly what is Hibernate used for. Start with Java Persistence API part of Java EE tutorial. This will show you how to map entities to database tables and how to query them. http://docs.oracle.com/javaee/6/tutorial/doc/bnbpy.html

http://stackoverflow.com/comment/75698786
comment on: http://stackoverflow.com/a/41842007
score: 0
type: AnswerComment
type: Comment
has text: yes if we modify gradle properties from module settings dialog it happen

http://stackoverflow.com/comment/36834575
has text: You can't modify the structure of an ArrayList while you're iterating over it... Check out the linked duplicate (adding elements to the list is the same thing as removing them, you're _structurally modifying the list_).
comment on: http://stackoverflow.com/q/23918707
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36766887
score: 0
type: Comment
has text: well as for INSERT i figure this out and its now working But still Update return this annoying java.lang.NullPointerException and pointing my st.executeUpdate();
type: QuestionComment
comment on: http://stackoverflow.com/q/23881201

http://stackoverflow.com/comment/39635740
has text: I had a similar problem and posted a solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23917030
score: 0

http://stackoverflow.com/q/23871255
downvote count: 0
answer count: 1
favorite count: 0
has body: what am I doing? I have an app that I want to test across different environments - dev, staging, etc What I do? I am using maven cargo plugin to deploy application war to run integration tests. What I need? I need to my test to infer the spring.profiles.active based on environment variable set by cargo like tomcat7x <spring.profiles.active>development</spring.profiles.active> Why? so that I can remove the hard coding in my Integration Test @ActiveProfiles("development") and the test can infer what active profile is from environment variable Question - I found Spring integration tests with profile which mentions about using ActiveProfilesResolver - I tried to find how can I make use of it, but could not find any resources I am looking for guidance/recommendations on how to use ActiveProfilesResolver
tagged with: maven
score: 11
tagged with: spring
has title: Spring Profiles: Simple example of ActiveProfilesResolver?
has answer: http://stackoverflow.com/a/24026851
upvote count: 11
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24026851
type: Question
linked to: http://stackoverflow.com/q/20551681

http://stackoverflow.com/comment/36785851
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23888827
has text: Thanks. However, I have been trying this code and it doesn't work for me, not even launches the Hibernate configuration. Maybe I am not injecting the dependency correctly or it is not possible to inject it in a test class. I have also tried creating JndiConfig object and injecting the datasource to an HibernateConfig object, and it doesn't work that way

http://stackoverflow.com/q/23841845
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/29525884
upvote count: 1
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/23865147
has comment: http://stackoverflow.com/comment/36688280
has comment: http://stackoverflow.com/comment/36690589
has title: Selenium webdriver - unable to locate an element on youtube
answer count: 2
has body: I am trying to retrieve the search results from YouTube suggestions using Selenium webdriver (Java) but i am getting the following error. Please help. Error: Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"class name","selector":"gssb_e"} Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15' System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.3', java.version: '1.7.0_55' Driver info: driver.version: unknown Code package test3; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class YoutubeSuggest { public static void main(String[] args) { // The Firefox driver supports javascript WebDriver driver = new FirefoxDriver(); // Go to the youtube home page driver.get("http://www.youtube.com/"); // Enter the query string "Ozzy " WebElement query = driver.findElement(By.name("search_query")); query.sendKeys("Ozzy "); // Sleep until the div we want is visible or 10 seconds is over long end = System.currentTimeMillis() + 10000; while (System.currentTimeMillis() < end) { WebElement resultsDiv = driver.findElement(By.className("gssb_e")); // If results have been returned, the results are displayed in a drop down. if (resultsDiv.isDisplayed()) { break; } } // And now list the suggestions List<WebElement> allSuggestions = driver.findElements(By.xpath("//td[@class='gsq_a']")); for (WebElement suggestion : allSuggestions) { System.out.println(suggestion.getText()); } //driver.quit(); } } HTML generated by youtube suggestions: ozzy osbourne ozzy osbourne crazy train ozzy osbourne no more tears ozzy osbourne mama i'm coming home ozzy osbourne paranoid ozzy osbourne justin bieber ozzy osbourne mr crowley ozzy osbourne bark at the moon ozzy osbourne interview ozzy osbourne dreamer
downvote count: 0
possible better answer: http://stackoverflow.com/a/29525884
favorite count: 0
has comment: http://stackoverflow.com/comment/36688643
tagged with: youtube
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23865147
tagged with: nosuchelementexception

http://stackoverflow.com/comment/36850066
type: QuestionComment
score: 1
has text: your question is not clear. do you want to compare all the values in the csv file with the "stat" value. If yes then you will have to parse the excel with some 3rd party tools like apache poi which are specifically for this purpose.
comment on: http://stackoverflow.com/q/23926814
type: Comment

http://stackoverflow.com/q/23796471
has body: Below is my code that displays images in a JList. I want to edit the description by each of the images shown in the JList. I don't know how to do it &amp; need help. Thanks... import java.util.*; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.Border; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.image.BufferedImage; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.io.Serializable; public class DesignPicture2 { private static String imageName; static ArrayList&lt;String&gt; imgName = new ArrayList&lt;String&gt;(); public static void main(String[] args) throws Exception { DesignPicture2 mm = new DesignPicture2(); mm.getImageName("C:\\Images 2 display"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame = new JFrame("Image panel"); frame.setSize(800, 500); //frame.setLocationByPlatform(true); frame.setLocation(600, 300); JList imageList = createImageList(); frame.getContentPane().add(new JScrollPane(imageList)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } private static JList createImageList() { JList imageList = new JList(createModel("C:\\Images 2 display")); imageList.setCellRenderer(new ImageCellRenderer()); imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP); imageList.setVisibleRowCount(0); imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); imageList.setFixedCellWidth(240); imageList.setFixedCellHeight(120); // imageList.setDragEnabled(false); //imageList.setDropMode(DropMode.INSERT); imageList.setTransferHandler(new ImageTransferHandler(imageList)); return imageList; } private static DefaultListModel createModel(String path) { File folder = new File(path); File[] listOfFiles = folder.listFiles(); DefaultListModel model = new DefaultListModel(); int count = 0; for (int i = 0; i &lt…
has title: How to change description image in JList java
has comment: http://stackoverflow.com/comment/36602028
favorite count: 0
has comment: http://stackoverflow.com/comment/36601836
has comment: http://stackoverflow.com/comment/36602049
has answer: http://stackoverflow.com/a/23796729
has comment: http://stackoverflow.com/comment/36602128
tagged with: swing
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/23797943
downvote count: 0
has comment: http://stackoverflow.com/comment/36602143
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23797943
possible better answer: http://stackoverflow.com/a/23796729
has comment: http://stackoverflow.com/comment/36602081
has comment: http://stackoverflow.com/comment/36601866
has comment: http://stackoverflow.com/comment/36602324
has comment: http://stackoverflow.com/comment/36601911
tagged with: defaultlistmodel
upvote count: 3
answer count: 2
tagged with: imageicon
tagged with: jlist

http://stackoverflow.com/comment/36758691
score: 0
type: Comment
type: QuestionComment
has text: @Obicere Ok, you're right, there is some scaling going on, since the oval shifts further down and to the right as I get closer to the bottom right corner of the frame. Now I just need to find where this is happening, thanks :).
comment on: http://stackoverflow.com/q/23878654

http://stackoverflow.com/comment/36801529
type: Comment
comment on: http://stackoverflow.com/q/23901050
type: QuestionComment
score: 0
has text: You need to configure classpath in your jar;s manifest file please refer to link I duplicated with

http://stackoverflow.com/q/23821973
downvote count: 1
tagged with: java
has body: I have a autotextview which get data from a webservice. I have implemented TextChangedListener to it. to get data from internet. Each time on Textchanged new characters are get and on afterTextChanged AsyncTask is called.I want to make it fast because if user enter a text manually .. it take a long time to fetch some new data. textView.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { seq = cs; } @Override public void beforeTextChanged(CharSequence s, int arg1, int arg2, int arg3) { } @Override public void afterTextChanged(Editable arg0) { new SearchTask().execute(seq.toString().trim()); } }); AsyncTask is.. private class SearchTask extends AsyncTask&lt;CharSequence, Void, String&gt; { ArrayAdapter&lt;String&gt; adapter; String[] array; @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(CharSequence... params) { try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(pak_url + params[0]); HttpResponse responce = httpclient.execute(httppost); HttpEntity httpEntity = responce.getEntity(); String response = EntityUtils.toString(httpEntity); Log.d("response is", response); if (response != null) { String substr = response.split("\\(")[2].split("\\)")[0]; array = substr.split(","); for (int i = 0; i &lt; array.length; i++) { array[i] = array[i].replace("'", ""); } } return response; } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); if (array != null) { adapter = new ArrayAdapter&lt;String&gt;(PlayListActivity.this, android.R.layout.simple_list_item_1, array); textView.setAdapter(adapter); adapter.getFilter().filter(seq); } /*else { Toast.makeText(PlayListActivity.this, "Could not connect to server try again later...", Toast.LENGTH_LONG).show(); }*/ } }
type: Question
has answer: http://stackoverflow.com/a/23822268
answer count: 1
score: 0
has title: Speed up the autoTextView android
has comment: http://stackoverflow.com/comment/36650193
tagged with: android
has comment: http://stackoverflow.com/comment/36650134
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36650405
upvote count: 1

http://stackoverflow.com/q/23822349
has title: Why java method does not support multiple return values?
has answer: http://stackoverflow.com/a/23822637
has comment: http://stackoverflow.com/comment/36651009
favorite count: 0
tagged with: return-value
tagged with: design-principles
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36651039
tagged with: oop
tagged with: java
linked to: http://stackoverflow.com/q/7470861
downvote count: 3
tagged with: methods
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/7470861
score: 5
has body: While working with Java Applications, I feel most of the times one question : Why Java doesn't support multiple return values of methods? I know that people who designed Java, must have done thinking about this topic but I didn't get any answer or particular reason while thinking myself.
has comment: http://stackoverflow.com/comment/36650852
has answer: http://stackoverflow.com/a/23822443
upvote count: 8

http://stackoverflow.com/comment/36605093
type: AnswerComment
has text: so what is the Exception? `e.printStackTrace ();`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23798030

http://stackoverflow.com/a/24055501
has comment: http://stackoverflow.com/comment/37090986
has comment: http://stackoverflow.com/comment/37091696
score: 1
has comment: http://stackoverflow.com/comment/37090757
has comment: http://stackoverflow.com/comment/37091440
answers question: http://stackoverflow.com/q/23934355
downvote count: 0
has comment: http://stackoverflow.com/comment/37090858
has comment: http://stackoverflow.com/comment/37091539
has comment: http://stackoverflow.com/comment/37091367
type: Answer
has comment: http://stackoverflow.com/comment/37091810
has comment: http://stackoverflow.com/comment/37091623
has comment: http://stackoverflow.com/comment/37090883
upvote count: 1
has body: list="cities" and list="%{getCities()}" both are exactly same. Both calls getter of List&lt;City&gt; cities in action class to read value from valuestack. Both will throw an error if getter would be removed. 1. &lt;s:select name="city" label="City" list="cities[0]" listKey="id" listValue="name" /&gt; is evaluated to a. &lt;s:select name="city" label="City" list="%{cities[0]}" listKey="id" listValue="name" /&gt; b. &lt;s:select name="city" label="City" list="%{getCities().get(0)}" listKey="id" listValue="name" /&gt; 1, a &amp; b are same because % forces OGNL evaluation. that will query stack for particular property. OGNL supports collections, that's why we can use this three. We call actions when we use particular need. For Example &lt;s:url id="databaseList" action="fetch-citynames" /&gt; &lt;sd:autocompleter key="search" href="%{databaseList}" name="searchText" /&gt; Here fetch-citynames return json list. Also see this link Actually I read from here The principal reason is because %{} syntax is used to force OGNL evaluation where Struts would otherwise be treating the value as a String literal. For example, &lt;s:property value="name" /&gt; will look for a name property in the value stack i.e. is a value retrieved by calling getName(). If you wanted to force it to use literal value "name", you will need to use the %{} syntax - &lt;s:property value="%{'name'}" /&gt; But in the case of &lt;s:select list="" /&gt; it uses OGNL Collection Construction Here is how OGNL call methods.. See here

http://stackoverflow.com/comment/36762163
score: 0
type: Comment
type: QuestionComment
has text: @JimGarrison do you know any good tutorial about debugging?
comment on: http://stackoverflow.com/q/23880493

http://stackoverflow.com/a/23863737
has comment: http://stackoverflow.com/comment/36732016
has comment: http://stackoverflow.com/comment/36733731
accepted answer of: http://stackoverflow.com/q/23863660
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/36730234
has comment: http://stackoverflow.com/comment/36733197
has comment: http://stackoverflow.com/comment/36732155
has body: This post is not an answer but a "confusion cleanup" post. First of all, a Unicode code point ranges from U+0000 to U+10FFFF; in all this range, some code points are in fact invalid. Java's char is, in essence, a UTF-16 code unit. For Unicode code points outside the Basic Multilingual plane, that is, above U+FFFF, two chars are needed to encode one code point; see Character.toChars(). For code points inside the BMP there is a one-to-one mapping between Unicode and char. Other than that, despite its particular role, a char is a numeric type; it is also the only unsigned numeric type in Java. You can use arithmetic operations on it, and for a code point inside the BMP, adding 7 to a char which is '\u9876' will give code point '\u9883'. But given the above, this is a dangerous manoeuver... (fwiw, above the BMP, Character.toChars() will return a "pair of char"s; the first element of the returned array will be a lead surrogate and the second will be a trail surrogate; the Java API still uses the old Unicode terminology and calls them a "high" and "low" surrogate respectively. For more details see the Wikipedia article on UTF-16, which does a pretty good job at explaining what is what)
has comment: http://stackoverflow.com/comment/36733920
has comment: http://stackoverflow.com/comment/36731664
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36734019
answers question: http://stackoverflow.com/q/23863660
type: Answer

http://stackoverflow.com/a/23838285
has body: You check the resource to be not null in one ClassLoader and try to load from another ClassLoader (The may be different).
answers question: http://stackoverflow.com/q/23838253
score: 0
type: Answer

http://stackoverflow.com/a/23822267
type: Answer
answers question: http://stackoverflow.com/q/23822046
has body: You need to provide the value for the parameter From in the flight method. You can use any of the method mentioned below: Use @Parameters annotation on the method and supply values in testng.xml file. Dataprovider (also mentioned by Cedric in his response) .. Documentation can be found at http://testng.org/doc/documentation-main.html#parameters-dataproviders Put @Optional annotation on your parameter and supply default value. Please check the TestNG document. Hope it helps!
has comment: http://stackoverflow.com/comment/36651934
has comment: http://stackoverflow.com/comment/36663635
score: 0

http://stackoverflow.com/q/23787260
possible better answer: http://stackoverflow.com/a/48940173
type: Question
has comment: http://stackoverflow.com/comment/36584226
tagged with: java
has comment: http://stackoverflow.com/comment/36584166
accepted answer: http://stackoverflow.com/a/23787573
tagged with: access-modifiers
upvote count: 10
has comment: http://stackoverflow.com/comment/36584049
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/36584091
favorite count: 0
tagged with: visibility
has answer: http://stackoverflow.com/a/23787573
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48940173
tagged with: reflection
has title: How can I find out what a method's visibility is via reflection?
has body: Context: I'm trying to learn/practice TDD and decided I needed to create an immutable class. To test the 'immutability invariant' (can you say that?) I thought I would just call all the public methods in the class via reflection and then check that the class had not changed afterwards. That way I would be unlikely to break the invariant carelessly later on. This may or may not be practical/valid in itself but I thought it would also be an exercise in reflection for me. Strategies: Use getMethods(): Using getMethods(), I get the public interface only, but of course this includes all the inherited methods as well. The problem then is that methods such as wait() and notify() cause InvocationTargetExceptions because I haven't synchronized etc... Use getDeclaredMethods(): (Naively?) assuming that only the methods that I declare are able to break the class's immutability, I tried using getDeclaredMethods() instead. Unfortunately this calls all methods, private and public that are declared in the class, but not super classes. The private methods obviously are not relevant as they are allowed to break immutability. Question: So my question is, how can I find out whether a method obtained via getDeclaredMethods() is public or not so that I can invoke it via reflection? Nothing jumped out at me looking through the docs... I can see other ways of solving this problem like specifically ignoring methods like wait() etc but that seems even hackier than I can handle.
downvote count: 1

http://stackoverflow.com/q/23871889
tagged with: java
accepted answer: http://stackoverflow.com/a/23872145
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36748072
has answer: http://stackoverflow.com/a/23872145
has title: How to link a local file
has body: I'm trying to use a local file in which I've specified my db connection properties which is named dao.properties. And I'm proceeding this way: InputStream fichierProperties = classLoader.getResourceAsStream( "/src/dao/dao.properties" ); However, when using this path, I'm getting an exception stating that the debugger wasn't able to find that file. Here are some packages in my project: The dao.properties is just under the dao package. How do I resolve this, please?
score: 0
has comment: http://stackoverflow.com/comment/36745212
answer count: 1
linked to: http://stackoverflow.com/q/2308188
linked to: http://stackoverflow.com/q/676250
has comment: http://stackoverflow.com/comment/36744928
has comment: http://stackoverflow.com/comment/36746571
has comment: http://stackoverflow.com/comment/36745141

http://stackoverflow.com/q/23904417
score: -1
has body: Array a is printing all zeroes, whereas it should print the values of i (which are all of the integers from m to n, both also integers) System.out.println("\n enter the values of m and n"); int m,n,i,j=0; int[] a=new int[100]; m=in.nextInt(); n=in.nextInt(); for(i=m;i&lt;=n;i++) { a[j]=i;//array a is storing the value of i j++; System.out.println(a[j]);//printing array a }
downvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23904446
upvote count: 0
tagged with: arrays
favorite count: 0
has title: Why is my array printing all zeroes and not all of the integers in a range?
type: Question
has comment: http://stackoverflow.com/comment/36807930

http://stackoverflow.com/q/23784312
has comment: http://stackoverflow.com/comment/36578660
favorite count: 0
tagged with: reverse
has comment: http://stackoverflow.com/comment/36578635
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36578663
has answer: http://stackoverflow.com/a/23785041
type: Question
possible better answer: http://stackoverflow.com/a/23784448
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23784448
has answer: http://stackoverflow.com/a/23785207
accepted answer: http://stackoverflow.com/a/23785207
has body: I am writing java code for a music demo in which I have a java array: int[][] a = {{1,2,3,},{4,5,6},{7,8,9},{10,11,12}; and I want to reverse this array to get this shape: int[][] b = {{3,2,1},{6,5,4},{9,8,7},{12,11,10}}; Kindly suggest me some easy solution for it.
downvote count: 3
has answer: http://stackoverflow.com/a/23784766
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/36578639
has title: How to reverse two dimensional java array?

http://stackoverflow.com/comment/36570318
has text: "I am getting errors in executing JAVA program" - what are the specific error messages?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23779254
type: QuestionComment

http://stackoverflow.com/comment/36828928
type: QuestionComment
comment on: http://stackoverflow.com/q/23915838
has text: What was wrong with Thread.sleep(1000); for 1 second?
score: 0
type: Comment

http://stackoverflow.com/a/23791067
has body: You could do the following: Java Model Foo Instead of @XmlElements and a property of type Object, you can use @XmlElementRefs and a property of type JAXBElement. A JAXBElement allows you to preserve the element name. import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.*; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Foo { @XmlElementRefs({ @XmlElementRef(name = "A", type = JAXBElement.class), @XmlElementRef(name = "B", type = JAXBElement.class), @XmlElementRef(name = "C", type = JAXBElement.class), @XmlElementRef(name = "D", type = JAXBElement.class) }) protected JAXBElement<?> aOrBOrCOrD; } ObjectFactory Along with @XmlElementRef you need to have a corresponding @XmlElementDec annotations on a class annotated with @XmlRegistry. import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.*; import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { @XmlElementDecl(name="A") public JAXBElement<String> createA(String value) { return new JAXBElement<String>(new QName("A"), String.class, value); } @XmlElementDecl(name="B") public JAXBElement<Integer> createB(Integer value) { return new JAXBElement<Integer>(new QName("B"), Integer.class, value); } @XmlElementDecl(name="C") public JAXBElement<String> createC(String value) { return new JAXBElement<String>(new QName("C"), String.class, value); } @XmlElementDecl(name="D") public JAXBElement<String> createD(String value) { return new JAXBElement<String>(new QName("D"), String.class, value); } } Demo Code Demo import java.io.StringReader; import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Foo.class, ObjectFactory.class); StringReader xml = new StringReader(" <C>Hello World</C> "); Unmarshaller unmarshaller = jc.createUnmarshaller(); Foo foo = (Foo) unmarshaller.unmarshal(xml); JAXBElement<?> aOrBOrCOrD = foo.aOrBOrCOrD; System.out.println(aOrBOrCOrD.getName().getLocalPart())…
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/23779674
type: Answer
answers question: http://stackoverflow.com/q/23779674
has comment: http://stackoverflow.com/comment/37002017

http://stackoverflow.com/comment/36617393
score: 0
type: Comment
has text: For now the game will be very easy, human vs computer without multiplayer. I need "pause" when the computer has already played or the user has already played, and it's necessary to determine who won the hand, otherwise the user will not understand nothing. Anyway thanks for the tips, it can be a good start, but not all the actions of the game can be instantaneous.
type: AnswerComment
comment on: http://stackoverflow.com/a/23803267

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/23860240

http://stackoverflow.com/q/23884190
has comment: http://stackoverflow.com/comment/36768743
accepted answer: http://stackoverflow.com/a/23894439
has comment: http://stackoverflow.com/comment/36769161
has title: Row edit in TableView
has comment: http://stackoverflow.com/comment/36768875
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: javafx
has body: I have a TableView in JavaFX (2.2/Java 7 to be specific), where each column is sortable (real-time sorted) and all rows/columns are editable. As an example, let's assume the entire table represents an "order". Each row in the table, represents "order lines", and the columns represents properties of the "order line", like "product", "quantity", "price" etc. The user can add, remove and edit rows ("order lines") as he wish. To make the UI less confusing for the user, I would like to use row selection, and also make sure that only a single row is editable at a time (because sorting would otherwise make the currently edited value "jump" around in the table). I also have validation per "order line", which is easier to visualize for a row, rather than individual columns (as an example, assume the combination or product X and the quantity 7 is illegal, as product X can only be ordered in units of 5, I want to highlight both X and the value 7). Row selection can easily be enabled. But is there a good way to implement row editing? The default/built in editing mode in a TableView is more like that of Excel where each column may be edited, committed and validated individually, and this is not what I want. I want something like the file list in a file explorer. It is important that all edits for the edited row are committed to the backing model (items property of the TableView) at once (ie. no onEditCommit for individual columns) because of the sorting and validation. I've implemented something similar before in Swing, and then ended up using what I named a ColumnList, which is really a List, but with column headers and columns, to make it appear just like a table. Would this be a viable choice in JavaFX too? The TableColum class seems very bound to a TableView, but I might be missing something. I also am aware of the "Address book" example in the JavaFX tutorials, which has row selection and editor fields below the table. This is what I have currently implemented in my applica…
type: Question
has answer: http://stackoverflow.com/a/23894439
downvote count: 0
has comment: http://stackoverflow.com/comment/36769397
answer count: 1
favorite count: 0
tagged with: javafx-2

http://stackoverflow.com/q/23889764
favorite count: 0
has comment: http://stackoverflow.com/comment/36779583
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/36780000
answer count: 1
has comment: http://stackoverflow.com/comment/36928225
has answer: http://stackoverflow.com/a/25073582
has comment: http://stackoverflow.com/comment/36979831
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/36779151
has title: Concurrency in distributed Task Queue (Producer/Consumer)
tagged with: distributed
downvote count: 0
has comment: http://stackoverflow.com/comment/36780372
type: UnansweredQuestion
score: 1
has body: My application(Java) randomly produces some tasks and asynchronous consumed by distributed background threads. I don't have distributed lock solution such as ZooKeeper at present. I don't have any 3rd party message queues. I use a database as the task queue and the consumed results are also saved in the database, which shared access by all consumers/producers. I have some code like this: Consumer: while(true) { // block the thread and wait from producer's notify // my producers would produce MANY work items but only notify each consumer ONCE. waitProducer(); // consume the queue while(database.queueNotEmpty()) { // consume each work item and remove from database queue consumeAll(); } } Producer: for(...) { database.enqueue(work[i]); } // notify all consumers notifyAllConsumer(); Apparently the code above has concurrent bugs. I have 3 questions: 1.How to avoid distributed consumers consume the same task? (about the line: "consumeAll()") or reduce the duplicated compute. consume one task multi times won't be a bug but less efficient in my case. 2.How to avoid the queue is NOT empty but no consumer active? the sequence would be: one consumer &amp; one producer sample: Consumer: while(database.queueNotEmpty()) // queue is empty, break the while loop Producer: database.enqueue(work[i]); // produce a task Producer: notifyAllConsumer(); // notify the consumer, but it is already active Consumer: waitProducer(); // hang the thread but still has work to do 3.Any best practice for this problem? especially in pure java. Is a third party message queue or something like zookeeper a must? Less lock or no lock is preferred; efficient is prefer to correctness in my case. Thanks!
has comment: http://stackoverflow.com/comment/36779462
has comment: http://stackoverflow.com/comment/36779760
type: Question
tagged with: task-queue
has comment: http://stackoverflow.com/comment/36779228
has comment: http://stackoverflow.com/comment/36780122

http://stackoverflow.com/a/23931237
type: Answer
has body: Even supposing you can find an operating system where the timezone isn't set, you won't be able to determine this from your Java code. The timezone is retrieved from a Calendar object stored within the formatter. A Calendar is always associated with a timezone, using the value returned by TimeZone.getDefault() if you don't specify anything in the call to Calendar.getInstance(). TimeZone.getDefault() will always return a time zone value, using GMT if it really cannot figure out what is being used locally. From the Javadocs: [Uses] GMT as the last resort if the given or detected time zone ID is unknown
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23930566
downvote count: 0

http://stackoverflow.com/comment/36742695
comment on: http://stackoverflow.com/a/23870403
type: AnswerComment
has text: Do you know how to execute it step by step in netbeans? It is your best option to know what is happening
score: 0
type: Comment

http://stackoverflow.com/q/23780472
score: 0
has comment: http://stackoverflow.com/comment/36571932
tagged with: package-explorer
tagged with: eclipse-plugin
has title: Add a selection listener to package explorer
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I'm currently developing a plugin for eclipse. The thing is that, I want when the user click a specific type of project, folder or file, insert in the properties view some attributes to edit. I found some examples, but I still don't know how to add a listener to the package explorer from the begining. Does Any one know the solution? Thanks in advance.
has comment: http://stackoverflow.com/comment/36617572
tagged with: eclipse
type: Question

http://stackoverflow.com/q/23934428
has body: I just need a function that will, for two given strings, return negative, positive or zero value. In C, strcmp is used: char* a = "Hello"; char* b = "Aargh"; strcmp(a, b); //-1 strcmp(a, a); //0 strcmp(b, a); //1 Does Java have any easy intuitive way to do it, or do I have to use the Comparator interface?
tagged with: java
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/23934487
tagged with: string-comparison
has answer: http://stackoverflow.com/a/23934489
has answer: http://stackoverflow.com/a/36082889
has answer: http://stackoverflow.com/a/23934491
possible better answer: http://stackoverflow.com/a/23934489
has comment: http://stackoverflow.com/comment/36863781
accepted answer: http://stackoverflow.com/a/23934491
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/36864083
has answer: http://stackoverflow.com/a/23934535
answer count: 5
has comment: http://stackoverflow.com/comment/36863841
has title: Get integer difference between string just like strcmp
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/23882410
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23882308
upvote count: 2
has body: What could be a use case for such a nested class? You would use this if: you were going to implement a number of nested classes with common functionality, and you didn't want the base class with that functionality to be visible. You would probably also make the leaf classes either final or private. How would it be used and what sort of design benefits are there from using such a class? See above. Basically, you are hiding the class so that it cannot be directly subclassed outside of the outermost enclosing class. I think this will also prevent the subclasses from being used polymorphically outside of the outermost enclosing class. This is not a common use-case, but I imagine it is sensible in the context that you found it.

http://stackoverflow.com/comment/36751071
type: QuestionComment
type: Comment
has text: Of Course. I have just done CTRL+Z, nothing was modified. i've started the application this morning, i have just noticed about this exception.. I'm logging on a file, and the exception output has been wrote on the Eclipse console
comment on: http://stackoverflow.com/q/23875215
score: 0

http://stackoverflow.com/q/23832120
possible better answer: http://stackoverflow.com/a/23832194
tagged with: replace
has title: Replacing a line in a new textfile
score: 0
answer count: 2
has body: I have a textfile with several lines. Line 1 Line 2 Line 3 Line 4 ... I am trying for example to replace line 3 with a new sentence. I tred using the code below, but instead of replacing it, it just adds the new sentence next to it and the rest of the text as well. I need it to be removed and place the new sentence in the same spot, and then continue the writing of the rest of the lines. What should I fix? try { PrintWriter out = new PrintWriter(new FileWriter(filenew, true)); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); if (line.contains(line 2)) { line = line.replaceAll("", "new sentence"); } out.write(line); out.write("\n"); } out.flush(); out.close(); scanner.close(); } catch (IOException e) { e.printStackTrace(); } Thanks in advance!
has answer: http://stackoverflow.com/a/23832527
tagged with: java.util.scanner
tagged with: java
tagged with: printwriter
type: Question
has answer: http://stackoverflow.com/a/23832194
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23832527

http://stackoverflow.com/comment/36689733
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23841222
has text: What is happening now, and what don't you like about it?

http://stackoverflow.com/comment/36621319
type: QuestionComment
comment on: http://stackoverflow.com/q/23807012
has text: This is not possible. What would be the benefit? There are multiple problems with that. 1) This is a fixed path, it only works either on windows or linux 2) the user can't replace the implementation with a different implementation (unless he renames the jar) 3) You are fixed on a version 4) You would still need to import the classes, e.g. `import com.mongodb.Query;`
score: 0
type: Comment

http://stackoverflow.com/comment/36681873
has text: @bruno It can be hard to find evidence that a non-existent feature doesn't exist. After checking the Javadoc man page, the Oracle documentation, the javadoc-dev mailing list, and SO itself and finding nothing I've done as threatened and grabbed the source to prove it. I hope that this satisfies you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23829273
type: Comment

http://stackoverflow.com/comment/36739516
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23864472
has text: Sorry. I dont know how to do it. But some pointers are available here. https://www.ibm.com/developerworks/community/blogs/738b7897-cd38-4f24-9f05-48dd69116837/entry/debugging_java_application_crashes_without_any_logs4?lang=en

http://stackoverflow.com/q/23780315
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: Anyone Please help me to find how to mock a database by using mockito
type: Question
tagged with: testing
tagged with: mockito
has answer: http://stackoverflow.com/a/23780725
accepted answer: http://stackoverflow.com/a/23780725
tagged with: database
score: -1
tagged with: mocking
answer count: 1
downvote count: 1
has body: I am new to unit testing. I want to know how can I use mockito framework to mock database. I am sick of searching. Please help me with this.
favorite count: 0
has comment: http://stackoverflow.com/comment/36572296

http://stackoverflow.com/comment/36850314
comment on: http://stackoverflow.com/a/23913778
type: AnswerComment
has text: Hi, As you suggested i have used below mouse events and try to click that element in new window.facing same issue and program is not even running after opening the new window list box. WebElement we = driver.findElement(By.cssSelector("a[id='C20_W57_V58_V59_V60_marketing_struct.classific-btn'] > img:nth-child(1)")); for (String handle : driver.getWindowHandles()){ driver.switchTo().window(handle); } Actions action = new Actions(driver); action.moveToElement(we).click().moveToElement(driver.findElement(By.cssSelector("a[id='dynshlp_sel_2rowsel']"))).click().build().perform();
type: Comment
score: 0

http://stackoverflow.com/q/23886499
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/36773285
has body: How to redirect stdin and stdout to take data as input from a text file and pass data as output to another textfile. My input and output files look like this. Input File.txt 1 2 3 The output should be the sum of the numbers in the input file. Output File.txt 6
has comment: http://stackoverflow.com/comment/36772999
has answer: http://stackoverflow.com/a/23886542
accepted answer: http://stackoverflow.com/a/23886542
has answer: http://stackoverflow.com/a/23886729
favorite count: 0
has answer: http://stackoverflow.com/a/29269723
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
upvote count: 6
has title: how to redirect stdin and stdout to a text file in java
possible better answer: http://stackoverflow.com/a/23886729

http://stackoverflow.com/q/23882883
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23883118
answer count: 1
downvote count: 0
favorite count: 0
has title: Numerological seqience
type: UnansweredQuestion
has body: Hi I am developing an android app ... related to numerology .. where I need to calculate the corresponding value of current number.. First I will give information about how to calculate it.. In numerology each letter have its own value. That values are giving below. A-1,B-2,C-3,D-4,E-5,F-6,G-7,H-8,I-9 J-1,K-1,L-3,M-4,N-5,O-6,P-7,Q-8,R-9 S-1,T-2,U-3,V-4,W-5,X-6,Y-7,Z-8 and my problem is I need to display the current working number of a person from year 2012 to 2022. It is calculated like this. If suppose my name Jocheved and my Date of birth is 12-02-1988 then on 1988 my letter is J, because that is my first letter of my Firstname and value J according to above table is 1 so the effect of J in my life is for 1 year ie, from 1988 to 1989 and my next letter is O, its value is 6. So the effect of O will last for 6 years ie, from 1989 to 1995 and from 1996 effect of C will start and it will go like that once the letter finished then it will start again from the starting letter in my case ie, J. In my program I need to display the effective letter of person from 2012 to 2022 . I developed a programme and I can display the values from my DOB to 2022 but I need only from the year 2012 . that means it should be like 2012 - X 2013 -X Like that .. I am giving my code below.. if anybody can help.. pls help tv23.setText(getValueCycle2(2022)); private CharSequence getValueCycle2(int endYear) { // TODO Auto-generated method stub int c = 0; String out = "FName\n\n"; char[] cycle = getLetterCycle(); if(birthYear + 1 &gt; endYear) { return ""; } for (int i = birthYear + 1; i &lt;= endYear ; i++) { out += cycle[c] + "\n"; Log.v(TAG, "i - " + i + " : c - " + c + " : cycle(c) - " + cycle[c]); c++; if (c == cycle.length) { c = 0; } } return out; } private char[] getLetterCycle() { // TODO Auto-generated method stub int value; char ch; String str = ""; for (int i = 0; i &lt; fName.length(); i++) { ch = fName.charAt(i); if (ch &gt;= 'A' &amp;&amp; ch &lt;= 'Z') { value = letterValue(ch); f…
tagged with: android
upvote count: 1
tagged with: android-edittext

http://stackoverflow.com/q/23883104
has comment: http://stackoverflow.com/comment/36894528
has comment: http://stackoverflow.com/comment/36894719
favorite count: 0
has answer: http://stackoverflow.com/a/24046791
possible better answer: http://stackoverflow.com/a/24046791
has comment: http://stackoverflow.com/comment/36846930
type: AnsweredQuestion
upvote count: 19
has comment: http://stackoverflow.com/comment/37107492
tagged with: java
has comment: http://stackoverflow.com/comment/37104099
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/24078004
downvote count: 1
has comment: http://stackoverflow.com/comment/37103977
type: Question
has comment: http://stackoverflow.com/comment/37112218
has body: I am struggling to understand and get more details on the steps involved in CMS tenured collection cycles. Initial Mark Concurrent Mark Concurrent pre-clean Re-mark Concurrent Sweep Concurrent Reset These steps are explained in lot of places in very short. But if I have to describe them in a class with diagrams and psuedo-examples where can I get that information from? PS - I have searched extensively on Google, it throws up with a lot of textual stuff and jargon which I understand. But I am looking for a more animated explanation so that I can teach my audience. These are some of the links which are popular, the 3rd one was very promising but it failed to explain the CMS in particular http://www.infoq.com/articles/Java_Garbage_Collection_Distilled http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html http://www.cubrid.org/blog/dev-platform/understanding-java-garbage-collection/ Dear all, thanks for commenting and pointing me to some resources. I have tried to create a visual representation of the CMS steps, can you please let me know if this matches your understanding ? Also I seem to be missing the Compacting step, which step does it belong to ? Answer : Ok so compacting is not handled by CMS, instead it is delegated to full GC.
score: 18
has comment: http://stackoverflow.com/comment/36987466
has comment: http://stackoverflow.com/comment/36789807
has title: Concurrent Mark and Sweep algorithm details
answer count: 2
accepted answer: http://stackoverflow.com/a/24078004
has comment: http://stackoverflow.com/comment/36925247

http://stackoverflow.com/q/23898162
has answer: http://stackoverflow.com/a/23906963
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: Im using Jprofiler to profile a tomcat web application. The web application contains a file search.jsp . Jprofiler hot spot shows that the search.jsp is a hot spot and from its methods, it takes long time to execute the following method: java.util.concurrent.ThreadPoolExecutor$Worker.run This is the end of call tree, but I want to know what is happening inside this method. Is there any way to profile methods of a new thread?
tagged with: jsp
tagged with: jprofiler
accepted answer: http://stackoverflow.com/a/23906963
has title: JProfiler Profiling a new thread
upvote count: 1
tagged with: profiling
answer count: 1

http://stackoverflow.com/q/23861459
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23861511
type: Question
tagged with: rounding
tagged with: bigdecimal
has body: I am currently using BigDecimal types for a project, and they've been working great. Except for very large values - each divide appears to be giving me an unusually round and incorrect answer. Here is an excerpt from my code: System.out.print("a: "+a+", b: "+b); i = a.divide(b, mc).setScale(0, RoundingMode.FLOOR); System.out.println(", result: "+i); And I am getting printouts such as: a: 100000000000106, b: 1.414213562373095048801688724209699005327534773448623528143294164, result: 70000000000000 a: 100000000000022, b: 1.414213562373095048801688724209699005327534773448623528143294164, result: 70000000000000 a: 100000000000036, b: 1.414213562373095048801688724209699005327534773448623528143294164, result: 70000000000000 When I plug these three divides into a calculator, they each give me roughly 70710678118704. However the BigDecimal divide is giving me an even 70000000000000. Does this have to do with me rounding incorrectly? Note: All types (a, b, and i) are all BigDecimals Edit: Added the instantiation of mc: MathContext mc = new MathContext(1, RoundingMode.DOWN);
has answer: http://stackoverflow.com/a/23861511
has comment: http://stackoverflow.com/comment/36726332
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36726298
favorite count: 0
has title: Why is BigDecimal.divide() giving me a wrong answer?

http://stackoverflow.com/q/23867381
upvote count: 1
possible better answer: http://stackoverflow.com/a/23867662
has title: public AsyncTask to be called from several classes
has answer: http://stackoverflow.com/a/23867662
type: Question
has answer: http://stackoverflow.com/a/23867862
has answer: http://stackoverflow.com/a/23867755
has answer: http://stackoverflow.com/a/23867623
has body: I'm new in Android. It's been a few weeks since I started working in this project. Reading the code already made I see a lot of private async tasks doing basically the same (call an API) So I wonder if there is a better solution, my idea would be create a public async task called ApiCaller which will return a JSONObject and the responsible for parsing the JSON would be the class calling the ApiCaller: public class ApiCaller extends AsyncTask&lt;String, String, JSONObject&gt; { private static final String TAG = "ApiCall"; private final String apiVersion = "v1"; private final String baseURL = "http://my.api.com/"; private String URL = null; /** * Generates the URL to call the API. * * @param params List with the params to call the API. */ public ApiCaller(ArrayList&lt;NameValuePair&gt; params){ String apiURL = this.baseURL + this.apiVersion + "/?"; String paramsList = URLEncodedUtils.format(params, "utf-8"); this.URL = apiURL + paramsList; } @Override protected JSONObject doInBackground(String ... params) { Log.i(TAG, "API:"); Log.i(TAG, this.URL); JSONManager jParser = new JSONManager(); JSONObject jsonObject = jParser.getJSONFromUrl(this.URL); return jsonObject; } Is there a way to return that JSONObject outside of the class so I can do something like: JSONObject js = apiCaller.execute(); Or any other solution to avoid creating new asynctasks every time I need to call the API? With my current code I can't get it but I don't know what is missing? maybe returning it in onPostExecute?
downvote count: 0
favorite count: 0
tagged with: android-asynctask
tagged with: android
tagged with: architecture
accepted answer: http://stackoverflow.com/a/23867623
answer count: 4
linked to: http://stackoverflow.com/q/3291490
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23680546
linked to: http://stackoverflow.com/q/13330509
score: 1
tagged with: java

http://stackoverflow.com/comment/57804452
type: Comment
comment on: http://stackoverflow.com/a/35039569
score: 0
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/11046968)
type: AnswerComment

http://stackoverflow.com/comment/36926893
comment on: http://stackoverflow.com/q/23914599
has text: Hi, And what if I would like to have four buttons? I will update the description how it should look like (picture)
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/23802439
has comment: http://stackoverflow.com/comment/36618887
accepted answer of: http://stackoverflow.com/q/23802159
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23802159
downvote count: 0
has body: You need another parameter to pass in your object values to the invoked method. So with that said you need to add another parameter to your runPrivateVoidMethod with type as Object[] public static void runPrivateVoidMethod(Object ob, String methodName, Class&lt;?&gt;[] paramTypes, Object[] paramvalues) NOTE: size of paramType and paramValues must match and paramValues must contain the value at specified index with the same type as defined on same index in paramTypes. get the method using method = ob.getClass().getDeclaredMethod(methodName, paramTypes); Then use Method#invoke(Object obj,Object... args) to pass your parameters to invoked method. method.invoke(ob,paramValues); Hope this gives you some idea.
has comment: http://stackoverflow.com/comment/36618311
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36619482
has comment: http://stackoverflow.com/comment/36620635
score: 1
has comment: http://stackoverflow.com/comment/36619048

http://stackoverflow.com/a/23807433
has comment: http://stackoverflow.com/comment/36624884
has comment: http://stackoverflow.com/comment/36653627
has comment: http://stackoverflow.com/comment/36631027
score: 0
has body: Looks like you need quotes on: ... Ingredient.name in ('milk', 'flour', 'egg') group by....
answers question: http://stackoverflow.com/q/23807104
has comment: http://stackoverflow.com/comment/36622053
type: Answer
has comment: http://stackoverflow.com/comment/36625077
has comment: http://stackoverflow.com/comment/36630981
has comment: http://stackoverflow.com/comment/36622862
has comment: http://stackoverflow.com/comment/36626336

http://stackoverflow.com/a/23892965
type: Answer
has body: I've discovered that the problem was rooted in the fact that I was running my code using a unit test. Apparently unit tests are setup as transactions that are automatically rolled back, but I can't find documentation to support that. My unit test was creating a row in a table and then deleting the row based on it's ID. It was always failing because it was always rolling back the transaction. If you need unit tests that actually do a delete then add the rollback(false) annotation so your unit test method looks like this: @Autowired MyEntityRepository myEntityRepository; @Test @Rollback(false) public void createAndThenDeleteRow() { MyEntity testRecord = new TestRecord( "fake", "data" ); TestRecord savedRecord = myEntityRepository.save( testRecord ); Long id = savedRecord.getId(); TestRecord loadedRecord = myEntityRepository.findOne( id ); assertNotNull( loadedRecord ); myEntityRepository.delete( id ); TestRecord reloadedRecord = myEntityRepository.findOne( id ); assertNull( reloadedRecord ); }
upvote count: 7
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23839391
answers question: http://stackoverflow.com/q/23839391
type: AcceptedAnswer
score: 6

http://stackoverflow.com/q/23864935
tagged with: string
has title: How to effectively remove immediate tags in XML String in Java
has comment: http://stackoverflow.com/comment/36734291
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23865668
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36733255
has body: I have a XML being parsed as string.. the basic structure is something as below <envelope> . . </tag 1> . . <entity 2> . . . . </entity2> I need to remove the tags lets say tag2 i.e. the whole .. block. I am doing this using a while loop, something like while(str.indexOf(" ")>=0) { strRepl=str.substring(str.indexOf(" "),str.indexOf(" ")+7); str=xmlString.replaceFirst(strRepl,""); } This is working but i wanted to understand if there is a better way to implement this using strings? Please suggest.
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/23865668
answer count: 1

http://stackoverflow.com/comment/36841296
type: Comment
comment on: http://stackoverflow.com/a/23922082
has text: You can get away without android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION will use the mobile network + wifi (if enabled on the device).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36804837
comment on: http://stackoverflow.com/q/23902575
has text: No, `read` is a member of `thirtythreeforty.Message` which *implements* the interface `XDRSerializable`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36785443
has text: @Claudinei I updated my answer based on my understanding of your requirements.
type: AnswerComment
comment on: http://stackoverflow.com/a/23837135
score: 0
type: Comment

pre-commit-hook
tag name: pre-commit-hook
type: Tag
tags question: http://stackoverflow.com/q/23852923

http://stackoverflow.com/comment/36800060
comment on: http://stackoverflow.com/q/23900288
has text: What kind of HTTP server are you using in Java?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23863660
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36730065
score: 0
has body: Suppose the unicode of A is \u9876. I want to get 7 characters after A. ie H. is there some way to get do (A's unicode ) + 7 and then cast it to a char.
favorite count: 0
has title: How to get a character from another character in java
answer count: 3
has answer: http://stackoverflow.com/a/23863737
has comment: http://stackoverflow.com/comment/36730104
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23863684
has answer: http://stackoverflow.com/a/23864060
accepted answer: http://stackoverflow.com/a/23863737
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/23863684
has comment: http://stackoverflow.com/comment/36730082
has comment: http://stackoverflow.com/comment/36730047

http://stackoverflow.com/a/23914852
has comment: http://stackoverflow.com/comment/36914525
has comment: http://stackoverflow.com/comment/36914894
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36911191
answers question: http://stackoverflow.com/q/23910607
has comment: http://stackoverflow.com/comment/36915326
has comment: http://stackoverflow.com/comment/36915132
has comment: http://stackoverflow.com/comment/36913136
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23910607
has body: Play automaticaly sets content type depending on type of returned data, so use valid JSON object, you don't need to use @BodyParser for that, badRequest additionally sets response status to 400 public static Result someAction() { ObjectNode answerObj = Json.newObject(); answerObj.put("message", "invalid json"); return badRequest(answerObj); }
score: 1

http://stackoverflow.com/q/23790736
score: -3
has comment: http://stackoverflow.com/comment/36590792
has comment: http://stackoverflow.com/comment/36590766
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/72000812
tagged with: java
downvote count: 3
type: Question
upvote count: 0
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/36590881
has answer: http://stackoverflow.com/a/23790945
answer count: 2
possible better answer: http://stackoverflow.com/a/42427839
has answer: http://stackoverflow.com/a/42427839
accepted answer: http://stackoverflow.com/a/23790945
linked to: http://stackoverflow.com/q/5580965
has body: I have this date that I seem to be unable to parse correctly. String text "Wed May 21 05:44:09 -0700 2014"; This is my date format public static final String DATE_FORMAT_PATTERN = "EEE MMM dd HH:mm:ss Z yyyy"; I am trying to use a SimpleDateFormat to parse it. Error string is unparsable. What am I doing wrong here. Note that this is not a duplicate. The solution with forcing locale is not described in the other question.
favorite count: 0
has title: Parsing SimpleDateFormat

http://stackoverflow.com/q/23811139
has body: In our code that is linked by a JButton in a previous frame, part of it that is inside of braces does not run. I can tell because the JFrame.EXIT_ON_CLOSE is not working because the program does not terminate. If the braces are taken away, other errors appear. How do we make it so that this code will run? public class PeopleCreator extends PeopleMove { public static final JFrame PeopleFrame = new JFrame("The Lovely Couple"); ImageIcon girl = new ImageIcon();// pic of girl ImageIcon boy = new ImageIcon();// pic of boy String name = JOptionPane.showInputDialog("What is your name?"); JButton girlDialogue1 = new JButton("Hey " + name + "! Hey can you get something to drink"); // This code below does not run. { PeopleMove.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); PeopleMove.add(girlDialogue1, BorderLayout.SOUTH); girlDialogue1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent z) { JButton boyDialogue1 = new JButton("");// girls first text { PeopleMove.add(boyDialogue1); boyDialogue1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent y) { JButton girlDialogue2 = new JButton("");// boys // first // text PeopleMove.add(girlDialogue2); girlDialogue2 .addActionListener(new ActionListener() { public void actionPerformed( ActionEvent x) { JButton boyDialogue2 = new JButton( ""); PeopleMove.add(boyDialogue2); boyDialogue2 .addActionListener(new ActionListener() { public void actionPerformed( ActionEvent v) { PeopleMove.pack(); PeopleMove .setVisible(true); } }); } }); } }); } } }); } }
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36629308
has title: Code in Braces is not running
tagged with: java
has comment: http://stackoverflow.com/comment/36629394
has answer: http://stackoverflow.com/a/23811262
type: Question
upvote count: 1
score: -2
has comment: http://stackoverflow.com/comment/36630604
answer count: 1
has comment: http://stackoverflow.com/comment/36629808
downvote count: 3

http://stackoverflow.com/q/23845878
has answer: http://stackoverflow.com/a/23846014
has title: How come this threadpool uses only one worker-thread
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23846024
has answer: http://stackoverflow.com/a/23846055
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36695409
type: Question
has body: I am a student trying hard to excel in Java programming. I came across thread pools in Java but I am really confused on how the following thread pool works. I have given it 5 work threads. My question is how come it's only one worker thread that does my work? Because in my output it only shows that it's only one worker thread that has executed the task. Which formula can I use to know the number of worker-threads to put in the fixed thread-pool? Also please explain to me clearly what is the meaning of a worker thread. I'm not able of explaining if somebody were to ask me. public class Executement implements Runnable{ Executement ec; private int taskId; public int men(int z,int x){ int y = this.taskId*z; int w = this.taskId+x; return(y &amp; w); } public void run(){ for(int i = 0; i &lt; 50; i++){ int z = i*2; int m = i; System.out.println("Task ID :" + z + " performed by " + Thread.currentThread().getName()); System.out.println("taskid: " + m + " performed by " + Thread.currentThread().getName()); } } public static void main(String[] args) { ExecutorService service=Executors.newFixedThreadPool(5); service.submit(new Executement()); service.shutdown(); } } here is part the output: Task ID :0 performed by pool-1-thread-1 taskid: 0 performed by pool-1-thread-1 Task ID :2 performed by pool-1-thread-1 taskid: 1 performed by pool-1-thread-1 Task ID :4 performed by pool-1-thread-1 taskid: 2 performed by pool-1-thread-1 Task ID :6 performed by pool-1-thread-1 taskid: 3 performed by pool-1-thread-1 Task ID :8 performed by pool-1-thread-1 taskid: 4 performed by pool-1-thread-1 Task ID :10 performed by pool-1-thread-1
has comment: http://stackoverflow.com/comment/36696234
score: 0
answer count: 3

http://stackoverflow.com/q/23922865
tagged with: android-bluetooth
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23923945
accepted answer: http://stackoverflow.com/a/23923945
tagged with: java
has body: I'm new to Android developing and I would like to make an app that sends and receive text using bluetooth. I got everything regarding the sending text logically working, but when I try to test it in my phone, I can't see the interface. Here's the Main Activity Code import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.TextView; import android.widget.EditText; import android.widget.Button; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import java.util.UUID; public class MainActivity extends ActionBarActivity { BluetoothAdapter mBluetoothAdapter; BluetoothSocket mmSocket; BluetoothDevice mmDevice; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; EditText myTextbox; TextView myLabel; byte[] readBuffer; int readBufferPosition; int counter; volatile boolean stopWorker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { Button sendButton = (Button) findViewById(R.id.send); Button openButton = (Button) findViewById(R.id.open); myTextbox = (EditText) findViewById(R.id.editText); myLabel = (TextView) findViewById(R.id.textView); openButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { findBT(); openBT(); } catch (IOException ex) { } } }); // send data typed by the user to be printed sendButton.s…
type: Question
tagged with: eclipse
tagged with: bluetooth
score: 0
answer count: 1
has title: Bluetooth Sending and Receiving Text Data

http://stackoverflow.com/comment/43974422
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23803180
has text: In case anyone else is having this issue, I am still facing it on Samsung devices, but not just with SIP calls, but with RTP streams initiated without the SIP stack too. So far I still have no idea what causes it, although it seems to be worse in larger applications. Taking the code out into a "Hello World" type application fixes it.
score: 0

http://stackoverflow.com/comment/48434327
type: AnswerComment
score: 0
type: Comment
has text: @user1169587 what do you mean by "I don't know groovy testStep"? I don't know if you're asking this, however you can add to your testCase a special testStep called `groovy` and inside this testStep you can add the code from the answer.
comment on: http://stackoverflow.com/a/23928584

http://stackoverflow.com/comment/36676090
type: Comment
has text: Yes exactly. I guess I would have to read up on the specification of png. Work > Reward
comment on: http://stackoverflow.com/a/23833129
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36784191
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23891508
type: AnswerComment
has text: It doesn't matter. The method returns the value of the local `x`, _which is then assigned to the instance variable `x` by the constructor._

http://stackoverflow.com/q/23896114
upvote count: 1
answer count: 1
has body: Its the method invokeBackend(String request, HashMap context) . Why does it have an object named java.security.PrivilegedAction createController = new java.security.PrivilegedAction() and it has an implementation ? I see it has a run() method which means its a thread. Does the run method returns "controller"? It returns "controller" to what? What kind of an implementation is this? An object having implementation code? 3.Whats the primary use of implmentation of the method invokeBackend Also the object java.security.PrivilegedAction processRequest = new java.security.PrivilegedAction() Thanks a lot! protected static String invokeBackend(String request, HashMap context) throws CommonModelException { if (request.equals("")) { return null; } if (logger.isDebugEnabled()) { logger.debug("request: \r\n" + request); } Properties clientAuthenticationEnv = CommonProperties .getClientAuthenticationProperties(); if (wccClientId == null) { wccClientId = clientAuthenticationEnv.getProperty(CLIENT_ID); } if (wccClientPassword == null) { wccClientPassword = clientAuthenticationEnv .getProperty(CLIENT_PASSWORD); } controllerHome = getControllerHome(); String response = null; try { if (controllerHome == null) { throw new CommonModelException(ResourceBundleHelper.resolve( CommonResourceBundleNames.COMMON_STRINGS, LOG_REMOTE_EXCEPTION)); } if (isWASImpl) { java.security.PrivilegedAction createController = new java.security.PrivilegedAction() { public Object run() { Object controller = null; try { controller = controllerHome.create(); } catch (RemoteException e) { logger.error(ResourceBundleHelper.resolve( CommonResourceBundleNames.COMMON_STRINGS, LOG_REMOTE_EXCEPTION), e); } catch (CreateException e) { logger.error(ResourceBundleHelper.resolve( CommonResourceBundleNames.COMMON_STRINGS, LOG_FAIL_GET_EJB_INSTANCE), e); } return controller; } }; // PrivilegedAction validateSecurityToken(); final DWLServiceController controller = (DWLServiceController) WSSubject .doAs(subject, createContro…
has comment: http://stackoverflow.com/comment/36791894
has comment: http://stackoverflow.com/comment/36792373
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23896371
tagged with: java
favorite count: 0
has title: Why does object inside a protected method has implementation?
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/36792212
has answer: http://stackoverflow.com/a/23896371
score: -1
has comment: http://stackoverflow.com/comment/36792016
downvote count: 2

http://stackoverflow.com/a/23787438
has body: Somewhere in your project there is a web.xml descriptor, and it declares version number for compliance with some edition of servlet-api. Your application tries to use JSF2 which requires web.xml to declare version 2.5 or newer. Apparently yours is too old. Find this file and check what's there in the root element &lt;web-app&gt;. There are examples of this descriptor for version 2.5 and 3 here on SO: link1, link2, link3.
downvote count: 0
score: 5
type: Answer
answers question: http://stackoverflow.com/q/23785946
upvote count: 5

http://stackoverflow.com/comment/36701272
type: AnswerComment
has text: @danm After the fix, did this solve your problem? Asking because I notice that you haven't yet voted on StackOverflow. If this answer or another answer solves your problem, please consider "accepting it" by clicking the checkmark on the left, as this is how the reputation system works (accepting an answer gives reputation to both the answerer and to you). Of course there is no obligation to do so. Later when you have more reputation you can also upvote questions. Thanks for listening to my 20-second SO rep tutorial. :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23840317

http://stackoverflow.com/comment/36777039
type: Comment
score: 0
has text: i edit my question i posted the image what i am getting currently in my frontend. here i want to display 2nd row availfrom ,availupto beside the first row
type: QuestionComment
comment on: http://stackoverflow.com/q/23888154

http://stackoverflow.com/comment/36579196
has text: Sure. See under == Edit ==
comment on: http://stackoverflow.com/q/23783593
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23852390
type: Answer
accepted answer of: http://stackoverflow.com/q/23852286
upvote count: 21
downvote count: 1
has comment: http://stackoverflow.com/comment/36708945
has comment: http://stackoverflow.com/comment/36711621
score: 20
has comment: http://stackoverflow.com/comment/36710181
type: AcceptedAnswer
has body: The reason that forEach does not mutate the list comes down to the specification: The javadoc for forEach says: default void forEach(Consumer&lt;? super T&gt; action) ..... The default implementation behaves as if: for (T t : this) action.accept(t); As you can see: The action is a Consumer; i.e. it doesn't generate a value. The semantics don't allow for the this collection to be updated.
answers question: http://stackoverflow.com/q/23852286

http://stackoverflow.com/comment/36821568
score: 0
has text: I guess it depends more on the running OS instead of which model. By default Android and iOS doesn't support java.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23911860

http://stackoverflow.com/comment/36663226
type: Comment
type: QuestionComment
has text: See [here](http://stackoverflow.com/questions/8289508/sorting-by-value-in-hadoop-from-a-file)
comment on: http://stackoverflow.com/q/23828393
score: 0

http://stackoverflow.com/comment/36734300
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23865758
type: Comment
has text: Depends on whether to work with the result of the method, or simply check for "not emptiness" or whatever.

http://stackoverflow.com/q/23808139
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36623279
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23808333
has body: I created a tictactoe android game, and when i try to link the strings.xml file to activity.java I receive an error. Here is my activity.java package com.tictactoeoyna.www; import android.R; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class TicTacToeOynaActivity extends Activity { private TicTacToeOyun mGame; private Button mBoardButtons[]; private TextView mInfoTextView; private TextView mHumanCount; private TextView mTieCount; private TextView mAndroidCount; private int mHumanCounter = 0; private int mTieCounter = 0; private int mAndroidCounter = 0; private boolean mHumanFirst = true; private boolean mGameOver = false; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mBoardButtons = new Button[TicTacToeOyun.getBOARD_SIZE()]; mBoardButtons[0] = (Button) findViewById(R.id.one);// it should be blue but not mBoardButtons[1] = (Button) findViewById(R.id.two);//same mBoardButtons[2] = (Button) findViewById(R.id.three); mBoardButtons[3] = (Button) findViewById(R.id.four); mBoardButtons[4] = (Button) findViewById(R.id.five); mBoardButtons[5] = (Button) findViewById(R.id.six); mBoardButtons[6] = (Button) findViewById(R.id.seven); mBoardButtons[7] = (Button) findViewById(R.id.eight); mBoardButtons[8] = (Button) findViewById(R.id.nine);//until here mInfoTextView = (TextView) findViewById(R.id.information); mHumanCount = (TextView) findViewById(R.id.humanCount); mTieCount = (TextView) findViewById(R.id.tiesCount); mAndroidCount = (TextView) findViewById(R.id.androidCount); mHumanCount.setText(Integer.toString(mHumanCounter)); mTieCount.setText(Integer.toString(mTieCounter)); mAndroidCount.setText(Integer.toString(mAndroidCounter)); mGame = new TicTacToeOyun(); startNewGame(); } private void startNewGame() { mGame.cl…
has comment: http://stackoverflow.com/comment/36623457
tagged with: java
has comment: http://stackoverflow.com/comment/36623227
type: Question
has answer: http://stackoverflow.com/a/23808498
answer count: 2
has comment: http://stackoverflow.com/comment/36623212
has comment: http://stackoverflow.com/comment/36623131
has title: android cannot be resolved or is not a field error

http://stackoverflow.com/a/24914716
score: 0
has comment: http://stackoverflow.com/comment/40012085
answers question: http://stackoverflow.com/q/23907806
type: Answer
upvote count: 1
downvote count: 1
has body: You need to use the Apache Maven Shade Plugin (or a similar plugin) to build your Uber Jar (a jar with all dependencies included). Then take this jar to your server and run with: java -jar bla.jar PATH_TO_POSSIBLE_CONFIG_FILE

http://stackoverflow.com/comment/36622363
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23807061
has text: This is the only line I found about that too, still I have never appended this argument anywhere...
score: 0

http://stackoverflow.com/comment/36614919
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23802098
has text: Obviously, NOT. mensage is a String. You could take a character out of it (say the first) and use it. Such as: `char character = mensage.toLowerCase().charAt(0);` But my best choice would be an int or an Enum. Since mensage could contain a key word that could make the difference between switching a case rather than another.

http://stackoverflow.com/comment/36863929
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23914582
has text: I edited my post so you can see my code . Plz check it @jcragun

http://stackoverflow.com/a/23858869
has body: Check this link you have to add the one-jar jar as excluded in Maven pom.xml file.
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23804379
type: Answer
accepted answer of: http://stackoverflow.com/q/23804379
downvote count: 0

http://stackoverflow.com/q/23819733
type: Question
has title: How to call custome URL action from Form action?
tagged with: java
tagged with: wildcard-mapping
has answer: http://stackoverflow.com/a/23821737
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/23821055
answer count: 3
linked to: http://stackoverflow.com/q/23780282
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23821055
favorite count: 0
has answer: http://stackoverflow.com/a/23822062
has body: I followed this post and created a custom URL application. The action is getting called but the url shows with session id like http://localhost:8080/CustomURL%7Busername%7D.action;jsessionid=9C1FB3EB633209C18625BBB40EA61000 I want simply like http://localhost:8080/CustomURL/rajesh See my struts.xml: <struts> <constant name="struts.mapper.alwaysSelectFullNamespace" value="false" /> <constant name="struts.enable.SlashesInActionNames" value="true" /> <constant name="struts.patternMatcher" value="namedVariable" /> home.jsp welcome.jsp See my JSP page: <%@ taglib prefix="s" uri="/struts-tags"%> Struts 2 Custom URL Struts 2 Custom URL Enter your name below <s:form action="{username}"> <s:textfield name="username" /> <s:submit /> </s:form> See java file below: public class CustomURL extends ActionSupport { private String username; public String getUsername() { System.out.println("Getter"); return username; } public void setUsername(String username) { System.out.println("Setter"); this.username = username; } private static final long serialVersionUID = -4337790298641431230L; public String customUrl() { return SUCCESS; } }
type: AnsweredQuestion
upvote count: 1
accepted answer: http://stackoverflow.com/a/23822062
downvote count: 1

http://stackoverflow.com/comment/36853904
score: 0
type: Comment
has text: Yes the error that you wrote here is making it pretty clear, moreover, if you had something wrong with your code than you would had a better log to show me, something like NullPointerException, ClassCastException, etc
type: AnswerComment
comment on: http://stackoverflow.com/a/23891025

http://stackoverflow.com/comment/36585130
comment on: http://stackoverflow.com/q/23787811
type: Comment
score: 1
type: QuestionComment
has text: if edtitext is in fragment why not initialize it there??

http://stackoverflow.com/comment/36691947
comment on: http://stackoverflow.com/a/23829657
has text: What is the methodparseheight and width?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23916538
score: 0
answers question: http://stackoverflow.com/q/23915154
has comment: http://stackoverflow.com/comment/36855607
type: Answer
has comment: http://stackoverflow.com/comment/36855187
has body: You could try using a routing datasource, where the datasource to be loaded can be configured using your custom implementation InstanceRoutingDataSource, and you can predefine any number of datasource and implement your logic to get the required connection. InstanceRoutingDataSource public class InstanceRoutingDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { if(oracle required){ return "oracle"; }else if(sql required){ return "sql"; }else{ return "default"; } } } Persistance context &lt;beans:bean id="routingDataSource" `&lt;beans:bean id="routingDataSource" class="com.july11.framework.entity.InstanceRoutingDataSource"&gt; &lt;beans:property name="targetDataSources"&gt; &lt;beans:map key-type="java.lang.String"&gt; &lt;beans:entry key="oracle" value-ref="oracleDataSource"/&gt; &lt;beans:entry key="sql" value-ref="oracle2DataSource"/&gt; &lt;beans:entry key="default" value-ref="oracle2DataSource"/&gt; &lt;/beans:map&gt; &lt;/beans:property&gt; &lt;/beans:bean&gt; &lt;beans:bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="routingDataSource"&gt; &lt;beans:property name="persistenceUnitName" value="persistanceUnit" /&gt; &lt;beans:property name="jpaPropertyMap"&gt; &lt;map&gt;&lt;entry key="hibernate.dialect" value="${hibernate.dialect}" /&gt; &lt;entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" /&gt; &lt;entry key="hibernate.format_sql" value="${hibernate.format_sql}" /&gt; &lt;entry key="javax.persistence.validation.factory" value-ref="validator" /&gt; &lt;/map&gt; &lt;/beans:property&gt; &lt;/beans:bean&gt; `

http://stackoverflow.com/q/23865374
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Hot deployment of class files in jboss
tagged with: jboss-4.2.x
has answer: http://stackoverflow.com/a/23865588
duplicate of: http://stackoverflow.com/q/2738342
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23865588
favorite count: 0
has comment: http://stackoverflow.com/comment/36736887
has body: Hot deployment of class files in jBoss. Can any please help me in hot deploying the java class files without restarting the server again and again? JBoss version 4.2.3 GA I'm a novice to this field, so basic help is appreciated.
linked to: http://stackoverflow.com/q/2738342
type: AnsweredQuestion
tagged with: hotdeploy

http://stackoverflow.com/a/23797956
score: 0
type: Answer
has body: Try using scroll to element and perform operation on it. Try following function.Pass your element to function,page will scrolled to that element and then perform any other operation- public void scrollToElement(WebElement element){ int elementPosition = element.getLocation().getY(); elementPosition = elementPosition-200; // You can change 200 to any value if your page have sticky header System.out.println(elementPosition); String js = String.format("window.scroll(0, %s)", elementPosition); ((JavascriptExecutor)driver).executeScript(js); } //other operation element.click(); //etc....
answers question: http://stackoverflow.com/q/23788738

http://stackoverflow.com/comment/36685612
comment on: http://stackoverflow.com/q/23840528
score: 0
type: Comment
has text: For future reference: don't name your sample methods `main_hooo` and `main_ho`. That's entirely non-descriptive.
type: QuestionComment

http://stackoverflow.com/comment/36806494
score: 0
has text: Sorry about that, I shortened it as best I could. I realize that was a lot to sift through for one little thing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23903556

http://stackoverflow.com/comment/36610332
has text: @chrylis Sure, I suppose you can put it that way... I was more thinking that all the information to create the objects was placed into the constant pool in the bytecode at compile time, but it'd make more sense to say the actual objects are created sometime during runtime... I'll correct my answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23801128

http://stackoverflow.com/a/23817573
score: 0
has body: If setCal is not called and so if cal is not set, why do you want to send other thing than null ? null is the best thing to return in this case. Null is also a value, which give an indication to the developper. And, because developpers don't know that your getCal can't return null, they will check for null even if you never return null (I assume that for getter and setter, developpers don't read javadoc). Maybe you can send a new instance of default Calendar. But default value is the current date, so I don't think it's a good idea since it does not represent the fact that the Calendar has not been set. Or you can throw an exception... but do not abuse of Exception. Exception are designed to defined error or bad behavior, not to simplify functionnal checks. However, to protect the setCal method of null value, here you can throw an IllegalArgumentException if user set null value.
answers question: http://stackoverflow.com/q/23817522
type: Answer

http://stackoverflow.com/a/23921129
answers question: http://stackoverflow.com/q/23918580
type: AcceptedAnswer
has body: Steps to follow: Convert the JSON String into Map&lt;String,Object&gt; using Gson#fromJson() Iterate the map and remove the entry from the map which are null or empty ArrayList. Form the JSON String back from the final map using Gson#toJson(). Note : Use GsonBuilder#setPrettyPrinting() that configures Gson to output Json that fits in a page for pretty printing. Find the sample code here Remove empty collections from a JSON with Gson
upvote count: 2
type: Answer
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23918580

http://stackoverflow.com/comment/36762262
score: 0
comment on: http://stackoverflow.com/q/23880718
type: Comment
type: QuestionComment
has text: @helderdarocha no exceptions but nodes(<PropertyDetails>) are repeating(duplicate nodes)

http://stackoverflow.com/comment/36653467
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23823386
has text: I would imagine taking out that $or would increase performance massively. Also what is your collection actually sharded on?

http://stackoverflow.com/comment/36570401
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23779252
has text: @BobbyDigital the code crashes at the setting of `lng`. However, I've come to realize that neither `lng` nor `lat` is `null`, as the `if` checks for empty string (`""`) which would have caused a NPE if either of the two had been `null`. So the culprit seems to be `location`.
type: Comment

http://stackoverflow.com/q/23785816
downvote count: 0
has comment: http://stackoverflow.com/comment/36583829
has comment: http://stackoverflow.com/comment/36581547
answer count: 1
tagged with: javabeans
favorite count: 0
tagged with: binding
has answer: http://stackoverflow.com/a/23788155
score: 13
tagged with: properties
upvote count: 13
type: AnsweredQuestion
has title: JavaFX Beans Binding suddenly stops working
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/133778968
has body: I use JavaFX NumberBindings in order to calculate certain values. Initially everything works as expected. After a rather small amount of time, however, the binding just stops working. I don't receive an Exception, either. I've tried several bindings, as well as high- and low-level approaches. Even the calculation itself (when overridden) just stops and isn't called anymore. I've also updated to the latest JDK (1.8.0_05) and rebuilt/restarted everything. The following Minimal Working Example illustrates the problem. It should System.out.println the current width of the main window to STDOUT. After resizing the window for about 10 seconds, the output simply stops. I've also tried to bind the resulting property to a JavaFX control, in order to ensure the Property's continued usage, but that was of no avail. I believe I'm missing some very basic behaviour of the Property/Bindings here, Google doesn't seem to know that behaviour at all. import javafx.application.Application; import javafx.beans.binding.NumberBinding; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class BindingsProblem extends Application { @Override public void start(Stage primaryStage) { // Initialization... StackPane root = new StackPane(); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); // Binding - The problem occurrs here! NumberBinding currentWidthPlusTen = primaryStage.widthProperty().add(10); IntegerProperty boundNumberProperty = new SimpleIntegerProperty(); boundNumberProperty.bind(currentWidthPlusTen); boundNumberProperty.addListener(new ChangeListener&lt;Number&gt;() { @Override public void changed(ObservableValue&lt;? extends Number&gt; observable, Number oldValue, Number newValue) { System.out.println(newValue.toStrin…
type: Question
accepted answer: http://stackoverflow.com/a/23788155

http://stackoverflow.com/comment/36810363
has text: Well, that's not how you do it. Instead of a Thread use an AsyncTask passing it the activity reference, do the work in doInBackground() and start the activity in onPostExecute(). The AsyncTask also has the onPreExecute() callback where you may want to initialize the ProgressDialog and show it(which you'll later dismiss in the same onPostExecute() method).
comment on: http://stackoverflow.com/q/23905215
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/23841127
score: -1
accepted answer: http://stackoverflow.com/a/23841162
type: Question
has comment: http://stackoverflow.com/comment/36687070
has answer: http://stackoverflow.com/a/23841162
has body: I am a beginner in Java an I have been looking on how to detect if the user pressed a key (such a the arrow keys). Apparently there are a lot of ways to do such a thing, and I found that this method should work for me: public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch( keyCode ) { case KeyEvent.VK_UP: // handle up break; case KeyEvent.VK_DOWN: // handle down break; case KeyEvent.VK_LEFT: // handle left break; case KeyEvent.VK_RIGHT : // handle right break; } } The problem is that I have no idea what a KeyEvent is. Can anyone tell me what to put in the parentheses when I call the method and show me an example please? PS: don't send me to an other site, I probably have already looked at it and they just confuse me more...
tagged with: keyboard
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36686916
favorite count: 0
has title: How to detect if a key was pressed in Java?
has comment: http://stackoverflow.com/comment/36686914
duplicate of: http://stackoverflow.com/q/18037576
tagged with: input
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18037576
tagged with: java

http://stackoverflow.com/comment/36843051
comment on: http://stackoverflow.com/q/23922885
has text: Please show the relevant code in your question. Don't just link to external sites.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23846474
tagged with: ognl
tagged with: jsp
has title: In Struts2, dynamically generate form element name using a member value
tagged with: struts2
has comment: http://stackoverflow.com/comment/36709487
answer count: 2
possible better answer: http://stackoverflow.com/a/23851547
downvote count: 0
has answer: http://stackoverflow.com/a/23851547
has comment: http://stackoverflow.com/comment/36698474
has comment: http://stackoverflow.com/comment/36709447
favorite count: 0
has comment: http://stackoverflow.com/comment/36696633
upvote count: 2
has answer: http://stackoverflow.com/a/23847348
has comment: http://stackoverflow.com/comment/36698358
has comment: http://stackoverflow.com/comment/36698487
score: 2
type: AnsweredQuestion
has body: My requirement: In Struts 2, dynamically generate form element name by using member value. I had tried with: <s:textarea name="employee_<s:property value='employeeNumber'/>"/> Resulting code in web browser: My expectation in web browser code: . 101 as an employeeNumber is only used for demonstration only. Please help, thanks!
tagged with: java
tagged with: forms
type: Question
accepted answer: http://stackoverflow.com/a/23847348

http://stackoverflow.com/a/23798889
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23798392
has comment: http://stackoverflow.com/comment/36606829
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23798392
has body: If you want to leave some package from compilation you can use excludes attribute of fileset ant tag. for example: <exclude name="**/dir_name_to_exclude/**" /> In order to include the specified class in compilation you can put the containing folder in your class-path using ant. <pathelement location="lib/"/> <pathelement path="${java.class.path}/"/> <pathelement path="path to your class file's base folder"/> ... put source files here.. And if you want to include that class-file in your jar then add it to fileset using include tag: <include name="your class file name"/> Hope this helps

http://stackoverflow.com/q/23930776
has answer: http://stackoverflow.com/a/23931232
tagged with: java
tagged with: hibernate
has title: spring transaction xml schema
has comment: http://stackoverflow.com/comment/36856808
type: Question
has comment: http://stackoverflow.com/comment/36857277
tagged with: jersey
score: 0
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36856875
accepted answer: http://stackoverflow.com/a/23931232
tagged with: spring
has comment: http://stackoverflow.com/comment/36857023
has body: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;context:annotation-config /&gt; &lt;tx:annotation-driven/&gt; . . . &lt;/beans&gt; I have that on my applicationContext on a Spring application and I am getting this error on Eclipse: Referenced file contains errors . For more information, right click on the message in the Problems View and select "Show Details..."
type: AnsweredQuestion

http://stackoverflow.com/comment/36786974
score: 0
type: Comment
type: QuestionComment
has text: Your views belong to the fragment layout while you initialize it in Activity
comment on: http://stackoverflow.com/q/23893568

http://stackoverflow.com/comment/36715046
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23855602
score: 0
has text: How do you want the data? in a byte[] or a byte buffer? or do you want it in some other form?

http://stackoverflow.com/q/23901065
answer count: 2
has comment: http://stackoverflow.com/comment/36807849
has comment: http://stackoverflow.com/comment/36802092
downvote count: 0
possible better answer: http://stackoverflow.com/a/23902803
favorite count: 0
has body: Is there a reliable way to sanitize database input in Java without using prepared statements? All the answers I have found suggest using PreparedStatement, but I am trying to avoid the extra round trip to the database server. -- Additional Info -- My queries will be very simple and very few will share the same format so there's little performance advantage of any query plan caching. The database server will be located on a separate physical location, though still in the same LAN, so there will be extra network bottleneck with the extra round trip required when using prepared statements. What I'm hoping to find is something like this, which exists in C, Python and PHP: http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html
has comment: http://stackoverflow.com/comment/36804201
has answer: http://stackoverflow.com/a/23902803
has comment: http://stackoverflow.com/comment/36802222
has answer: http://stackoverflow.com/a/23901184
has comment: http://stackoverflow.com/comment/36803911
has title: Sanitizing database input in Java without PreparedStatement
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/23901184
has comment: http://stackoverflow.com/comment/36802185
tagged with: database
tagged with: sanitization
has comment: http://stackoverflow.com/comment/36802023

http://stackoverflow.com/comment/36754811
has text: Yeah you have to update your view from the main thread. Consider using AsyncTask as Emmanuel suggested.
comment on: http://stackoverflow.com/a/23876793
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23874980
answers question: http://stackoverflow.com/q/23874642
score: 0
has body: So you want to call methods in subrecord objects to get the record values. This is not a good idea. The easiest way to use JAXB is to define your XSD first(If you don't want to define XSD by hand, use a tool that generate XSD from XML.) and use xjc to generate classes from XSD. Anything that deviates from this standard practice have to be done manually and you don't want to mix machine generated code with your written code. You should create a helper method or wrapper class that can figure out the subrecord's values but I personally think the XML Schema should be defined correctly in the first place.
type: Answer

http://stackoverflow.com/q/23923684
has answer: http://stackoverflow.com/a/23923717
tagged with: java
has comment: http://stackoverflow.com/comment/36844813
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23923697
accepted answer: http://stackoverflow.com/a/23923697
type: Question
score: 0
answer count: 2
has title: Addition with the help of varag and enhanced for loop
favorite count: 0
possible better answer: http://stackoverflow.com/a/23923717
has body: Hi i am trying to do the addition with the help of "varags" and" enhanced for loop".But i am getting this marker "This method must return a result of type int". class Hello1 { int pluss(int...v){ int plus=0; for(int x :v){ plus=plus+x; System.out.println(plus); return plus; } }} public class Addition{ public static void main(String args[]) { Hello1 h1=new Hello1(); h1.pluss(3,7,9,10); }}
type: AnsweredQuestion

http://stackoverflow.com/a/23875443
has comment: http://stackoverflow.com/comment/36761983
has comment: http://stackoverflow.com/comment/36762038
upvote count: 2
has comment: http://stackoverflow.com/comment/36762312
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36762330
type: Answer
accepted answer of: http://stackoverflow.com/q/23875386
downvote count: 0
answers question: http://stackoverflow.com/q/23875386
has body: I would bet that you are not using AsyncTask's onPostExecute(), which runs on the UI Thread after doInBackground() finishes. When doInBackground() finishes it returns the desired result to onPostExecute() which runs on the UI Thread. Here you can manipulate UI components as you please.
score: 2

http://stackoverflow.com/comment/36660087
comment on: http://stackoverflow.com/q/23827251
score: 0
type: Comment
type: QuestionComment
has text: I added to the List as a string because I thought I might be able to somehow concatenate with the class instance afterwards. Fairly new to Java so never done this before..

http://stackoverflow.com/q/23928775
duplicate of: http://stackoverflow.com/q/8911356
type: Question
score: 0
answer count: 3
has body: I am trying to display float variable upto two digits of precision. Suppose the variable is 50.35 then it is getting displayed. But when the variable is 50.30 it is displaying only 50.3. Unable to make it to display 50.30.
possible better answer: http://stackoverflow.com/a/23928804
has answer: http://stackoverflow.com/a/23928807
has answer: http://stackoverflow.com/a/23928804
accepted answer: http://stackoverflow.com/a/23928807
has title: Formating float variable in java upto 2 digits
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23928826
tagged with: java

http://stackoverflow.com/a/23934958
has comment: http://stackoverflow.com/comment/36866790
has body: Here's a suggestion. Don't make each ball extends JPanel. Just make it a class for holding/manipulating/drawing the state. Ball.java (notice Java naming convention) public class Ball { int x, y; // and whatever other state you need public Ball(int x, int y {} // or however you want to construct the ball public void draw(Graphics g) { // draw ball here } public void move() { // do calculations to move here } } Then just have one BallPanel class that extends JPanel and do the painting there. Just hold a List&lt;Ball&gt; in the class and you can call each Ball's draw() method in the paintComponent and each Ball's move() method in the Timer. You could even dynamically add balls to be animated by just adding a new Ball to the list. Something like public class BallPanel extends JPanel { private List&lt;Ball&gt; balls; // create the list public BallPanel() { Timer timer = new Timer(40, new ActionListener(){ public void actionPerformed(ActionEvent e) { for (Ball ball: balls) { ball.move(); } repaint(); } }); } protected void paintComponent(Graphics g) { super.paintComponent(g); for (Ball ball : balls) { ball.draw(g); } } } This way you don't have to worry above separate timers and layering panels. See a bunch of complete example, using this technique, here and here and here and here and here and here.
has comment: http://stackoverflow.com/comment/36921341
answers question: http://stackoverflow.com/q/23934675
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36867473
has comment: http://stackoverflow.com/comment/36867123
has comment: http://stackoverflow.com/comment/36865083
type: Answer
has comment: http://stackoverflow.com/comment/36867815

http://stackoverflow.com/a/23899166
answers question: http://stackoverflow.com/q/23810555
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/49757669
has comment: http://stackoverflow.com/comment/42600881
upvote count: 2
type: Answer
has body: First: Within cygwin, use bash. Also install java8, older versions lack key features. Second: Add the following lines to your .bashrc file: echo "javac :`which javac`" echo "jar :`which jar`" echo "java :`which java`" echo "ant :`which ant`" When you start a new bash shell, it will echo the versions of these four java essentials. Run each one with no arguments and you should get four appropriate complaints. If they don't run, then you need to install them. Then create a directory called src and create HelloWorld.java: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World from main!"); } } In the same directory, create HelloWorldAsPackage.java: package src; public class HelloWorldAsPackage { public static void main(String[] args) { System.out.println("Hello World In a Package (Directory) called 'src'!"); } } Then create the bash script runOneCase.bash: #!/bin/bash echo "Listing $1.java" echo "==================================================" cat $1.java echo "==================================================" echo "Compiling $1.java" echo "+ javac $1.java" javac $1.java echo "+ cd $2" cd $2 echo "Running $1.java" echo "+ java $3$1 $4" java $3$1 $4 echo "==================================================" Then create the bash script runThemAll.bash #!/bin/bash echo "CASE 1: HelloWorld" runOneCase.bash HelloWorld . "" "" echo "CASE 2: HelloWorld as a Package" runOneCase.bash HelloWorldAsPackage .. src. "" Now run the script: runThemAll.bash by typing it at the cygwin prompt. If you get the following output, you can consider java installed under cygwin. CASE 1: HelloWorld (Hit Return) Listing HelloWorld.java ================================================== public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World from main!"); } } ================================================== Compiling HelloWorld.java + javac HelloWorld.java + cd . Running HelloWorld.java + java HelloWorld He…

http://stackoverflow.com/a/23929538
answers question: http://stackoverflow.com/q/23929339
score: 0
type: Answer
has body: you can reference:Override logging in WildFly and Logging Configuration I hope this could help you ~!

http://stackoverflow.com/comment/36888624
type: QuestionComment
score: 0
has text: you need to convert JFrame to Applet first - please take a look at this - http://stackoverflow.com/questions/10059885/converting-a-jframe-to-a-japplet
type: Comment
comment on: http://stackoverflow.com/q/23931844

http://stackoverflow.com/q/23882518
has comment: http://stackoverflow.com/comment/36765408
favorite count: 0
has comment: http://stackoverflow.com/comment/36766404
has answer: http://stackoverflow.com/a/23883325
has comment: http://stackoverflow.com/comment/36765664
answer count: 1
has comment: http://stackoverflow.com/comment/36765615
has comment: http://stackoverflow.com/comment/36765539
accepted answer: http://stackoverflow.com/a/23883325
has comment: http://stackoverflow.com/comment/36766049
upvote count: 7
tagged with: internationalization
has comment: http://stackoverflow.com/comment/36765503
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36765528
tagged with: collation
score: 7
tagged with: java
type: Question
has title: Custom sorting list of strings (following Chamorro language collation rules)
has body: I am trying to sort a list of strings for a Pacific island language (Chamorro). In this language, Ng is considered one letter, and it comes after N in the alphabet. How can I sort a list of words such that Nai and Nunu both come before words that begin with Ng? Update The complete alphabet is: A, Å, B, Ch, D, E, F, G, H, I, K, L, M, N, Ñ, Ng, O, P, R, S, T, U, Y Besides Å, Ñ, and their lowercase versions, there are no accents over the other letters. Words can have apostrophes in them (such as o'mak), but they don't affect the sort order. There is no locale for Chamorro, so I need to manually implement a sort algorithm.
has comment: http://stackoverflow.com/comment/36765397
downvote count: 0
has comment: http://stackoverflow.com/comment/36765567

http://stackoverflow.com/comment/36735025
type: Comment
type: QuestionComment
has text: Can you, please, post somewhere your CPU snapshot? I would like to examine it.
comment on: http://stackoverflow.com/q/23850407
score: 0

http://stackoverflow.com/a/23821609
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Adding to the layout replaces the other content, you will probably want to add a Panel to the east and then append buttons to that, something like this: JPanel subPanel = new JPanel(new FlowLayout()); _panel.add(supPanel, BorderLayout.EAST); for(int i = 0; i &lt; buy.length; i++){ buy[i] = new JButton("Buy"); subPanel.add(buy[i]); }
answers question: http://stackoverflow.com/q/23821529

http://stackoverflow.com/comment/36745592
type: Comment
has text: in some cases can not be!
score: 0
comment on: http://stackoverflow.com/a/23869968
type: AnswerComment

http://stackoverflow.com/a/23835147
score: 1
answers question: http://stackoverflow.com/q/23833977
has body: you cannot return anydata in your getLink() method. Use your code as String shortenURL = ""; // activity global variable public void getLink() { JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { shortenURL = response.getString("url"); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub } }); queue.add(jsObjRequest); } You can also see more info at http://arnab.ch/blog/2013/08/asynchronous-http-requests-in-android-using-volley/
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36823966
comment on: http://stackoverflow.com/q/23824212
has text: What does your code look like? JMS constructs aren't thread safe, so you have to have a different session/consumer/producer per thread if you are using the same connection in all of them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23933833
has body: The double quotes on the command line are there to tell the shell interpreter not to split your string into multiple parameters. This is to ensure that the application receives title=We Can Make The World Stop as a single argument. Since ProcessBuilder handles multiple command line arguments explicitly, there's no need for escaping whitespace when calling it.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23933335
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23933335
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23914892
has title: Circle draw algorithm explanation
score: 0
has answer: http://stackoverflow.com/a/23917196
has comment: http://stackoverflow.com/comment/36832058
has comment: http://stackoverflow.com/comment/36827702
tagged with: geometry
has comment: http://stackoverflow.com/comment/36827640
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36833027
has body: Given the following circle drawing algorithm (variation of Bresenham) : public static void drawCircle(Graphics g, MyPoint center, MyPoint point) { // calculate radius of circle final int radius = (int)(Math.sqrt((point.x()-center.x())*(point.x()-center.x())+(point.y()-center.y())*(point.y()-center.y()))); int x = 0, y = radius, u = 0, v = 2 * radius - 1, E = 0; while (x &lt; y) { drawPixel(g, new MyPoint(center.x() + x, center.y() + y)); // NNE drawPixel(g, new MyPoint(center.x() + y, center.y() - x)); // ESE drawPixel(g, new MyPoint(center.x() - x, center.y() - y)); // SSW drawPixel(g, new MyPoint(center.x() - y, center.y() + x)); // WNW ++x; E += u; u += 2; if (v &lt; 2 * E){ y--; E -= v; v -= 2; } if (x &gt; y) break; drawPixel(g, new MyPoint(center.x() + y, center.y() + x)); // ENE drawPixel(g, new MyPoint(center.x() + x, center.y() - y)); // SSE drawPixel(g, new MyPoint(center.x() - y, center.y() - x)); // WSW drawPixel(g, new MyPoint(center.x() - x, center.y() + y)); // NNW } } I don't seem to understand why it works. I do understand that it draws a pixel at each octant because the circle is symmetric but I don't get what the variables u, v and e stand for..? e stands for the error I suppose but when does it change? and why? help will be appreciated! thanks
tagged with: java
has comment: http://stackoverflow.com/comment/36828147
type: Question
tagged with: graphics
answer count: 2
tagged with: algorithm
has answer: http://stackoverflow.com/a/23915276

foreground
type: Tag
tag name: foreground
tags question: http://stackoverflow.com/q/23940208

tomcat
tags question: http://stackoverflow.com/q/23799561
tags question: http://stackoverflow.com/q/23884755
tags question: http://stackoverflow.com/q/23891035
tags question: http://stackoverflow.com/q/23805402
tags question: http://stackoverflow.com/q/23902621
tags question: http://stackoverflow.com/q/23925968
tags question: http://stackoverflow.com/q/23804229
tags question: http://stackoverflow.com/q/23867230
tags question: http://stackoverflow.com/q/23865023
tags question: http://stackoverflow.com/q/23909170
tags question: http://stackoverflow.com/q/23929427
tags question: http://stackoverflow.com/q/23786556
tags question: http://stackoverflow.com/q/23856477
tags question: http://stackoverflow.com/q/23936162
tags question: http://stackoverflow.com/q/23883976
tags question: http://stackoverflow.com/q/23853027
tags question: http://stackoverflow.com/q/23788715
tags question: http://stackoverflow.com/q/23822445
tags question: http://stackoverflow.com/q/23802375
tags question: http://stackoverflow.com/q/23797850
tags question: http://stackoverflow.com/q/23926681
tags question: http://stackoverflow.com/q/23788026
tags question: http://stackoverflow.com/q/23797751
tags question: http://stackoverflow.com/q/23790725
tags question: http://stackoverflow.com/q/23813658
tags question: http://stackoverflow.com/q/23851328
tags question: http://stackoverflow.com/q/23800525
tags question: http://stackoverflow.com/q/23887641
tags question: http://stackoverflow.com/q/23833441
tag name: tomcat
tags question: http://stackoverflow.com/q/23799110
tags question: http://stackoverflow.com/q/23896717
tags question: http://stackoverflow.com/q/23901560
tags question: http://stackoverflow.com/q/23903837
tags question: http://stackoverflow.com/q/23872307
tags question: http://stackoverflow.com/q/23826220
tags question: http://stackoverflow.com/q/23932605
tags question: http://stackoverflow.com/q/23905265
tags question: http://stackoverflow.com/q/23873071
tags question: http://stackoverflow.com/q/23931862
tags question: http://stackoverflow.com/q/23892649
tags question: http://stackoverflow.com/q/23887631
tags question: http://stackoverflow.com/q/23912885
tags question: http://stackoverflow.com/q/23869475
tags question: http://stackoverflow.com/q/23797289
tags question: http://stackoverflow.com/q/23903180
tags question: http://stackoverflow.com/q/23844561
tags question: http://stackoverflow.com/q/23818465
tags question: http://stackoverflow.com/q/23828198
tags question: http://stackoverflow.com/q/23893793
tags question: http://stackoverflow.com/q/23780201
tags question: http://stackoverflow.com/q/23835483
tags question: http://stackoverflow.com/q/23875084
tags question: http://stackoverflow.com/q/23851416
tags question: http://stackoverflow.com/q/23917030
type: Tag
tags question: http://stackoverflow.com/q/23814045
tags question: http://stackoverflow.com/q/23787756
tags question: http://stackoverflow.com/q/23886719
tags question: http://stackoverflow.com/q/23895163
tags question: http://stackoverflow.com/q/23930776
tags question: http://stackoverflow.com/q/23858488
tags question: http://stackoverflow.com/q/23914128
tags question: http://stackoverflow.com/q/23878251
tags question: http://stackoverflow.com/q/23828063
tags question: http://stackoverflow.com/q/23906236
tags question: http://stackoverflow.com/q/23886479
tags question: http://stackoverflow.com/q/23856549
tags question: http://stackoverflow.com/q/23915922
tags question: http://stackoverflow.com/q/23784582
tags question: http://stackoverflow.com/q/23868933
tags question: http://stackoverflow.com/q/23825247
tags question: http://stackoverflow.com/q/23923534
tags question: http://stackoverflow.com/q/23865896
tags question: http://stackoverflow.com/q/23810166
tags question: http://stackoverflow.com/q/23808491
tags question: http://stackoverflow.com/q/23901070
tags question: http://stackoverflow.com/q/23899170
tags question: http://stackoverflow.com/q/23849471
tags question: http://stackoverflow.com/q/23823301

http://stackoverflow.com/comment/36580348
score: 1
has text: You mock a ResultSet and tell Mockito to return the desired result when you call getXXX() where XXX is whatever type you want, e.g. getInt(), getString() etc
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23780725

http://stackoverflow.com/a/23891025
has comment: http://stackoverflow.com/comment/36813029
downvote count: 0
has comment: http://stackoverflow.com/comment/36817848
has comment: http://stackoverflow.com/comment/36817246
has comment: http://stackoverflow.com/comment/36839141
answers question: http://stackoverflow.com/q/23887739
has comment: http://stackoverflow.com/comment/36812797
upvote count: 2
has comment: http://stackoverflow.com/comment/36788963
has comment: http://stackoverflow.com/comment/36812435
has comment: http://stackoverflow.com/comment/36811991
has comment: http://stackoverflow.com/comment/36853904
has body: You need to implement JSON parser and should consider implementing cache manager for better performance. For the implementation of the Json parser you have a lot of alternatives but according to my experience - Gson and JsonParser are the best. Gson provide you the ability to auto create json from java entity or java entity from the gson. Here you can find a good example for gson parsing, and from here you can download the library. A good open source cache manager you can find here - bitmapFun, volley, picasso If you don't want to add cache manager you can simply download the image and execute: ImageView imageView = (ImageView)findViewById(R.id.image_view); imageView.setBitmap(bitmap); you can find here code that streaming image into bitmap
type: Answer
has comment: http://stackoverflow.com/comment/36812753
has comment: http://stackoverflow.com/comment/36812567
score: 2

http://stackoverflow.com/comment/36664043
has text: The line is where the object is being allocated. Whether or not it will become garbage it is another story. In the case of `java.util.HashMap` it is released for the GC so it indeed becomes garbage. We use `-javaagent` to perform this instrumentation.
comment on: http://stackoverflow.com/a/23829047
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23895966
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23895163
has body: Yes, it is possible. You will need the sqljdbc_auth.dll. There's 3 places you can place it: in your WEB-INF/lib of the application In your Tomcat's lib folder In C:\windows\system32. Possible problems. The dll is distributed with the JDBC driver of Microsoft: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774 In your connection string, use integratedSecurity=true; (example: jdbc:sqlserver://MyServer;databaseName=MyDatabase;integratedSecurity=true;) Update 1: found this post on Stackoverflow for more info.
has comment: http://stackoverflow.com/comment/36819845
answers question: http://stackoverflow.com/q/23895163
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36802591
has comment: http://stackoverflow.com/comment/36806443
has comment: http://stackoverflow.com/comment/36796373
has comment: http://stackoverflow.com/comment/36795277
type: Answer
has comment: http://stackoverflow.com/comment/36800638
score: 3
has comment: http://stackoverflow.com/comment/36802694

http://stackoverflow.com/comment/36676341
type: AnswerComment
comment on: http://stackoverflow.com/a/23835854
type: Comment
has text: if you want powerful and safe multi-inheritance go with scala traits ;) (would run perfectly in the JVM too)
score: 1

http://stackoverflow.com/comment/36785285
comment on: http://stackoverflow.com/a/23892403
type: AnswerComment
score: 0
has text: Just pass the activity to the listener with `new OnClickListenerSelectPresetItem(this)` with `this` being an activity (or a Service since `getApplication()` is also available in the `Service`class). See the edited answer.
type: Comment

http://stackoverflow.com/a/23918334
answers question: http://stackoverflow.com/q/23917326
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has body: ArrayList&lt;User&gt; list=new ArrayList&lt;User&gt;(); will create an empty ArrayList. No objects of User are created or added to the ArrayList at this point, and will never be until you explicitly add to it. size() at this point will return 0 as there are no elements in the ArrayList. An ArrayList has a size and has a capacity. An ArrayList is backed by an array. The capacity is the size of the array at a point. Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size. As elements are added to an ArrayList, its capacity grows automatically. The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost. When an ArrayList is created via the default constructor, an ArrayList is created with capacity 10. So technically, the actual memory occupied by the list will be based on the capacity. But note that the array/list is empty. So increass in capacity will have only a marginal impact on the overall size occupied. You can use a tool like Java VisualVM (which is included with the JDK) to check the sizes occupied by objects.
accepted answer of: http://stackoverflow.com/q/23917326
score: 4

http://stackoverflow.com/q/23784616
type: AnsweredQuestion
has title: How to send post data (that contains 2 parameters) to https server via Socket Programming in Java
has comment: http://stackoverflow.com/comment/36580289
has comment: http://stackoverflow.com/comment/36579163
has comment: http://stackoverflow.com/comment/36579306
tagged with: java
type: Question
has body: I saw a form in web, if i give code(R),vehicle number , it will give some information , now i want to get that information via socket programming.I have written code but it hangs URL : https://aptransport.in/CFSTONLINE/Reports/VehicleRegistrationSearch.aspx import java.net.*; import java.io.*; import java.security.*; import javax.net.ssl.*; public class TestAP { public static void main(String[] args) { int port = 443; // default https port try{ URL url = new URL("https://aptransport.in/CFSTONLINE/Reports/VehicleRegistrationSearch.aspx"); String path=url.getFile(); // int port = url.getPort(); String host = url.getHost(); System.out.println("Step 0 : Connecting to Server"); Socket cliSocket = new Socket(host,port); System.out.println("Step 1 : Connection Established "); System.out.println("Step 2 : Creating Request"); String data1 = URLEncoder.encode("ctl00$OnlineContent$ddlInput", "UTF-8") + "=" + URLEncoder.encode("R", "UTF-8") +"&amp;"+URLEncoder.encode("ctl00$OnlineContent$txtInput", "UTF-8") + "=" + URLEncoder.encode("AP31BF2942", "UTF-8"); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(cliSocket.getOutputStream())); bw.write("POST " + path + " HTTPS/1.0\r\n"); bw.write("Host: " + host + "\r\n"); bw.write("Content-Length: " + data1.length() + "\r\n"); bw.write("Pragma: cache\r\n"); bw.write("Cache-Control: private, must-revalidate\r\n"); bw.write("Content-Type: application/x-www-form-urlencoded\r\n"); bw.write("\r\n"); bw.write(data1); bw.flush(); System.out.println("Step 3 : Request Sent "); BufferedReader rd = new BufferedReader(new InputStreamReader(cliSocket.getInputStream())); String line; System.out.println("Step 4 : Getting Input Stream"); StringBuffer serverData = new StringBuffer(""); while ((line = rd.readLine()) != null) { serverData.append(line); } System.out.println(" \r\n \r\n ******* Data From Server Start : ******* \r\n \r\n \r\n"+serverData+" \r\n \r\n ******* Data From Server End ********* \r\n \r\n "); String data = serverData.t…
answer count: 1
has answer: http://stackoverflow.com/a/23790782
has comment: http://stackoverflow.com/comment/36579642
has comment: http://stackoverflow.com/comment/36579238
score: 0
has comment: http://stackoverflow.com/comment/36581592
tagged with: sockets
has comment: http://stackoverflow.com/comment/36580994
accepted answer: http://stackoverflow.com/a/23790782

http://stackoverflow.com/comment/36833139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23917798
has text: what is a solution in your option. i have problem only facebook user image
score: 0

oracle-adf
tags question: http://stackoverflow.com/q/23907202
type: Tag
tag name: oracle-adf

http://stackoverflow.com/comment/36660022
has text: As u can say the docList[i] is unique for every row as a result of which each the same field present in different rows is treated as a new one..
comment on: http://stackoverflow.com/a/23804669
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23832092
accepted answer of: http://stackoverflow.com/q/23831886
score: 2
answers question: http://stackoverflow.com/q/23831886
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36672872
has comment: http://stackoverflow.com/comment/36670364
has body: This should be better, you forgot to change user to account, probably while copying from here ;) &lt;table&gt; &lt;#list accounts as account&gt; &lt;tr&gt; &lt;#list account?keys as prop&gt; &lt;td&gt;${account[prop]}&lt;/td&gt; &lt;/#list&gt; &lt;/tr&gt; &lt;/#list&gt; &lt;/table&gt;
has comment: http://stackoverflow.com/comment/36673359
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36672596
has comment: http://stackoverflow.com/comment/76986609
has comment: http://stackoverflow.com/comment/36671793

http://stackoverflow.com/a/23813700
answers question: http://stackoverflow.com/q/23813418
downvote count: 0
has body: Assuming that you want array like String[] arr = {"foo", "bar"}; to become [null, null] and do it in one line, then you can use Arrays.fill(arr, null); or create new array with same size as previous one arr = new String[arr.length];
type: Answer
score: 5
type: AcceptedAnswer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23813418

http://stackoverflow.com/comment/36706762
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23851328
score: 1
has text: As a note, hand-writing servlets is a Bad Idea, and even JSP is awfully clumsy compared to some more modern technologies like Thymeleaf. By all means learn about the plumbing of the system, but for real work I highly suggest a framework such as Spring MVC (and Spring Boot can even do most of the security setup for you).

http://stackoverflow.com/q/23902842
has comment: http://stackoverflow.com/comment/36867691
tagged with: greatest-common-divisor
has body: I wanted to Calculate num of Pairs of (m,n) where GCD(m,n)=x, say x=1 and 1&lt;=m&lt;=M=10^5 and 1&lt;=n&lt;=N=10^5. M and N will be given Note: I just want the number of possible pairs and not the pairs. TIME LIMIT : 5 Secs The below code works good for small numbers, but for larger ones it gives me StackOverflowError import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class TestClass{ static long M; static long N; static long totalCount = 1; public static void main(String[] args) throws Exception{ M = 100000; N = 2000; findCoPrimes(2, 1); findCoPrimes(3, 1); System.out.println(totalCount); } public static void findCoPrimes(int m, int n){ if ((n &gt; N) || (m &gt; M)){ return; } if (n != m &amp;&amp; m &lt;= N){ totalCount++; } totalCount++; findCoPrimes(2*m - n, m); findCoPrimes(2*m + n, m); findCoPrimes(m + 2*n, n); } } Can someone help me convert this recursive function to an iterative function to avoid the StackOverflow error. Please help me find a solution for this. Any other better approaches will also be considered. There is a hint with this question - Use smart ways to find the prime factors and then find the number of co prime pairs. Brute force wont work.
type: Question
has comment: http://stackoverflow.com/comment/36805013
has comment: http://stackoverflow.com/comment/36857857
has comment: http://stackoverflow.com/comment/36833871
has title: StackOverflowError for while finding co-prime pairs for 2 numbers using recursive function - Can we convert it to an iteration
score: 0
has comment: http://stackoverflow.com/comment/36898223
answer count: 1
tagged with: recursion
tagged with: algorithm
has answer: http://stackoverflow.com/a/23902876
has comment: http://stackoverflow.com/comment/36857787
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/159590
tagged with: java
tagged with: prime-factoring
linked to: http://stackoverflow.com/q/4734108

arrays
tags question: http://stackoverflow.com/q/23933643
tags question: http://stackoverflow.com/q/23849146
tags question: http://stackoverflow.com/q/23863133
tags question: http://stackoverflow.com/q/23884973
tags question: http://stackoverflow.com/q/23863128
tags question: http://stackoverflow.com/q/23784312
tags question: http://stackoverflow.com/q/23838642
tags question: http://stackoverflow.com/q/23860046
tags question: http://stackoverflow.com/q/23851152
tags question: http://stackoverflow.com/q/23876483
tags question: http://stackoverflow.com/q/23807333
tags question: http://stackoverflow.com/q/23876420
type: Tag
tags question: http://stackoverflow.com/q/23856703
tags question: http://stackoverflow.com/q/23834049
tags question: http://stackoverflow.com/q/23879970
tags question: http://stackoverflow.com/q/23846754
tags question: http://stackoverflow.com/q/23829989
tags question: http://stackoverflow.com/q/23863543
tags question: http://stackoverflow.com/q/23818325
tags question: http://stackoverflow.com/q/23807297
tags question: http://stackoverflow.com/q/23919803
tags question: http://stackoverflow.com/q/23934832
tags question: http://stackoverflow.com/q/23931816
tags question: http://stackoverflow.com/q/23878855
tags question: http://stackoverflow.com/q/23918901
tags question: http://stackoverflow.com/q/23849617
tags question: http://stackoverflow.com/q/23927618
tags question: http://stackoverflow.com/q/23799498
tags question: http://stackoverflow.com/q/23923730
tags question: http://stackoverflow.com/q/23880493
tags question: http://stackoverflow.com/q/23870371
tags question: http://stackoverflow.com/q/23871978
tags question: http://stackoverflow.com/q/23840065
tags question: http://stackoverflow.com/q/23842745
tags question: http://stackoverflow.com/q/23852516
tags question: http://stackoverflow.com/q/23837205
tags question: http://stackoverflow.com/q/23790396
tags question: http://stackoverflow.com/q/23813787
tags question: http://stackoverflow.com/q/23841550
tags question: http://stackoverflow.com/q/23912035
tags question: http://stackoverflow.com/q/23842117
tags question: http://stackoverflow.com/q/23911857
tags question: http://stackoverflow.com/q/23843971
tags question: http://stackoverflow.com/q/23786955
tags question: http://stackoverflow.com/q/23842810
tags question: http://stackoverflow.com/q/23929899
tags question: http://stackoverflow.com/q/23929496
tags question: http://stackoverflow.com/q/23792024
tags question: http://stackoverflow.com/q/23913284
tags question: http://stackoverflow.com/q/23801811
tags question: http://stackoverflow.com/q/23809957
tags question: http://stackoverflow.com/q/23885266
tags question: http://stackoverflow.com/q/23834744
tags question: http://stackoverflow.com/q/23834689
tags question: http://stackoverflow.com/q/23813626
tags question: http://stackoverflow.com/q/23827140
tags question: http://stackoverflow.com/q/23935364
tags question: http://stackoverflow.com/q/23922568
tags question: http://stackoverflow.com/q/23787381
tags question: http://stackoverflow.com/q/23806378
tags question: http://stackoverflow.com/q/23779450
tags question: http://stackoverflow.com/q/23909487
tags question: http://stackoverflow.com/q/23934191
tags question: http://stackoverflow.com/q/23853919
tags question: http://stackoverflow.com/q/23829118
tags question: http://stackoverflow.com/q/23860437
tags question: http://stackoverflow.com/q/23936605
tags question: http://stackoverflow.com/q/23876580
tags question: http://stackoverflow.com/q/23786426
tags question: http://stackoverflow.com/q/23897814
tags question: http://stackoverflow.com/q/23915723
tags question: http://stackoverflow.com/q/23843250
tags question: http://stackoverflow.com/q/23788496
tags question: http://stackoverflow.com/q/23802882
tag name: arrays
tags question: http://stackoverflow.com/q/23832922
tags question: http://stackoverflow.com/q/23876405
tags question: http://stackoverflow.com/q/23903403
tags question: http://stackoverflow.com/q/23857683

http://stackoverflow.com/a/23913661
type: Answer
downvote count: 2
score: -2
answers question: http://stackoverflow.com/q/23913381
upvote count: 0
has body: i think the problem in the HTTP request. use another library for network request like Volley or httpSync

http://stackoverflow.com/comment/36656643
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23821169
has text: sorry,is is my mistake.however there is another question about indexWriter2.updateDocument(term, document);.It seems not work.can you give me an example?

http://stackoverflow.com/q/23877560
has body: I try to change the way of a connector which connects two elements in an activity diagram. I use the Java API (eaapi.jar) from sparx. My function to connect two elements: public void connectTwoElements(Element source, Element target) { Connector con = source.GetConnectors().AddNew("","ControlFlow"); con.SetSupplierID(target.GetElementID()); con.Update(); source.GetConnectors().Refresh(); } My goal is to change the way of connector like in the below right scenario. The way of the connector to the target element should have an edge point to create a 90° angle. I didn't found any attribute of the class Connector to implement that. I expect that I can use a function like: myConnector.addBetweenPoint(int x, int y); Maybe anyone can help me:) Regards, Phil EDIT: After Nizam Mohamed and Uffe helps me below, I modified my method: public void connectTwoElements(Element source, Element target, String connectorLabel) { Connector con = source.GetConnectors().AddNew(connectorLabel,"ControlFlow"); con.SetSupplierID(target.GetElementID()); con.Update(); source.GetConnectors().Refresh(); diagram.GetDiagramLinks().Refresh(); //change style of diagram link Collection&lt;DiagramLink&gt; diagramLinks = diagram.GetDiagramLinks(); for(DiagramLink dl : diagramLinks){ if(dl.GetConnectorID()==con.GetConnectorID()){ dl.SetStyle("Mode=3;TREE=LV;"); dl.Update(); diagram.GetDiagramLinks().Refresh(); break; } } } It is important to Refresh() the Collection DiagramLinks of the Diagram after add a new Connector because otherwise the DiagramLink isn't available in the Collection DiagramLinks to change the style. Of course you must Refresh() it again after changing the style.
possible better answer: http://stackoverflow.com/a/23882446
type: Question
has answer: http://stackoverflow.com/a/23882446
has comment: http://stackoverflow.com/comment/36756258
tagged with: java
has answer: http://stackoverflow.com/a/23881880
score: 0
answer count: 2
has title: enterprise architect scripting in java: how to change the way of a connector?
accepted answer: http://stackoverflow.com/a/23881880
tagged with: enterprise-architect
type: AnsweredQuestion
tagged with: activity-diagram
tagged with: uml

http://stackoverflow.com/q/23858056
has body: I have noticed that the JTextArea does not scroll smoothly, like a UITextArea would. It appears that when I scroll down, it jumps to the next line, not smoothly scrolling over the text. I have created an animated GIF of the problem here: Example Code: JFrame frame = new JFrame(); BorderLayout bl = new BorderLayout(); frame.setLayout(bl); JTextArea textArea = new JTextArea(6, 30); textArea.setText(TEXT_FOR_TEXT_AREA); JScrollPane textScroll = new JScrollPane(textArea); frame.add(textScroll, BorderLayout.CENTER); Is there a way to make the scrolling more smooth (and not cut the text perfectly, line-by-line)? Thanks.
has comment: http://stackoverflow.com/comment/36719763
has title: JTextArea/JScrollPane Stutters When Scrolling
has comment: http://stackoverflow.com/comment/36722321
has comment: http://stackoverflow.com/comment/36719643
has comment: http://stackoverflow.com/comment/36722742
answer count: 0
has comment: http://stackoverflow.com/comment/36719676
has comment: http://stackoverflow.com/comment/36720980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36719564
tagged with: scroll
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36719421
has comment: http://stackoverflow.com/comment/36720058
has comment: http://stackoverflow.com/comment/36719724
score: 1
has comment: http://stackoverflow.com/comment/36719358
tagged with: java
has comment: http://stackoverflow.com/comment/36719645
type: Question
has comment: http://stackoverflow.com/comment/36719563
has comment: http://stackoverflow.com/comment/36720120
tagged with: jscrollpane
tagged with: jtextarea
downvote count: 0
has comment: http://stackoverflow.com/comment/36719614
favorite count: 0

http://stackoverflow.com/q/23859041
has title: Can HashMap contain custom class for key/value?
has body: In HashMap&lt;K,V>, can K or V be custom class object instead of wrapper class objects?? import java.util.HashMap; import java.util.Map; public class Test { public static void main(String[] args) { Test test=new Test(); HashMap&lt;String, test&gt; a= new HashMap&lt;String, test&gt;(); } } Error occurs: test cannot be resolved to a type. Thanks in advance. Regards.
score: -3
has comment: http://stackoverflow.com/comment/36721320
has comment: http://stackoverflow.com/comment/36721239
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36721245
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23859149
possible better answer: http://stackoverflow.com/a/23859223
type: Question
has answer: http://stackoverflow.com/a/23859223
tagged with: hashmap
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/36721435
has comment: http://stackoverflow.com/comment/36721275
has comment: http://stackoverflow.com/comment/36721307
favorite count: 0
has answer: http://stackoverflow.com/a/23859149

http://stackoverflow.com/comment/36755375
type: Comment
type: QuestionComment
has text: What version of JUnit are you running? Where's your test-case code?
comment on: http://stackoverflow.com/q/23877314
score: 0

http://stackoverflow.com/q/23929011
downvote count: 0
tagged with: java-web-start
favorite count: 0
tagged with: web
has title: Button on website for taking screenshot
answer count: 0
upvote count: 2
tagged with: screenshot
type: UnansweredQuestion
has body: Is there a way to take a screenshot/snip from a website? The screenshot isn't of a website/URL specifically (so other things I've found such as html2canvas wouldn't work). Basically, what would be ideal is pressing a button and having the user be able to use a sort-of Windows Snipping Tool, but instead of the user choosing whether to copy or save the snip afterwards, it would be automatically uploaded to the server as an image. One of the things I was looking at is Java Web Start -- I haven't ever used it, but it seems that the java app is downloaded each time the user wants to use the app. Is there a way to accomplish this without the user needing to download anything?
score: 2
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/4912092

http://stackoverflow.com/comment/36654291
type: Comment
comment on: http://stackoverflow.com/a/23811286
score: 1
has text: i saw today this is the best solution: as i have this ArrayList in a hibernate class, i have to define it as final static otherwise it's treated as a table column.. if i use the @Reimeus solution, everytime i reload the page, the value '22f' is added.. so if after 3 times i have 22f,22f,22f. your solution avoid this problem
type: AnswerComment

http://stackoverflow.com/q/23823347
score: -2
tagged with: properties
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23823410
answer count: 1
has title: how set path to property file in jave
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36655777
upvote count: 0
has comment: http://stackoverflow.com/comment/36652681
has body: I want use property file in my java project. I put this fie in src/main/resources/application.properties. Then in code I have: public static String loadProperty(String name) { Properties props = new Properties(); try { props.load(PropertyLoader.class.getResourceAsStream("/application.properties")); ... But got error: java.lang.NullPointerException at java.util.Properties$LineReader.readLine(Properties.java:434) at java.util.Properties.load0(Properties.java:353) at java.util.Properties.load(Properties.java:341) at com.tests.util.PropertyLoader.loadProperty(PropertyLoader.java:23) How can I fix this?
favorite count: 0
has comment: http://stackoverflow.com/comment/36652705
type: Question

http://stackoverflow.com/q/23911229
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36822565
type: Question
has body: I done example program to understand how volatile work. In the below example Even without volatile the program work fine. Could some one help me to understand how the program works fine without volatile? public class VolatileExp { private /*volatile*/ boolean statusFlag=false; private void changeState() { try { int counter=0; while (!statusFlag) { System.err.println("counter: "+counter++); //Thread.sleep(100); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String args[]) { final VolatileExp hello = new VolatileExp(); Thread t1 = new Thread(new Runnable() { @Override public void run() { hello.changeState(); } }); Thread t2 = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(2000); hello.statusFlag=true; System.err.println("setting the status flag "); } catch (Exception e) { e.printStackTrace(); } } }); t1.start(); t2.start(); } }
score: 3
accepted answer: http://stackoverflow.com/a/23913047
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/23913047
favorite count: 0
has comment: http://stackoverflow.com/comment/36820208
has comment: http://stackoverflow.com/comment/36822383
has comment: http://stackoverflow.com/comment/36821563
has title: Making Java Volatile to work

ognl
tags question: http://stackoverflow.com/q/23827729
tags question: http://stackoverflow.com/q/23893486
tags question: http://stackoverflow.com/q/23919226
tags question: http://stackoverflow.com/q/23929046
tags question: http://stackoverflow.com/q/23789198
tags question: http://stackoverflow.com/q/23934355
tags question: http://stackoverflow.com/q/23846474
tag name: ognl
type: Tag
tags question: http://stackoverflow.com/q/23936580

semaphore
type: Tag
tags question: http://stackoverflow.com/q/23783913
tag name: semaphore

http://stackoverflow.com/comment/36780813
score: 0
type: AnswerComment
type: Comment
has text: You can replace the Google.Base64 for Apache.Base64 without problem and your code changes a very little.
comment on: http://stackoverflow.com/a/23888299

http://stackoverflow.com/comment/36837364
has text: That's not timezone issue but presentation issue due to Locale.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23920090

http://stackoverflow.com/comment/36882079
comment on: http://stackoverflow.com/a/23940447
type: AnswerComment
has text: As I have specified the level of the handler to **Level.WARNING**, shouldn't the **Level.INFO** logs inside the LogFilter not be passed to my handler, therefore preventing a loop? Trying your suggestion produced a single **Level.INFO** LogRecord for the **Level.WARNING** "TEST" in the output file. Still not managing to produce output from the NPE.
type: Comment
score: 0

http://stackoverflow.com/q/23820583
type: Question
answer count: 2
tagged with: jpa
score: 0
has body: My model is import javax.annotation.Nonnull; import javax.persistence.Entity; import org.joda.time.DateTime; @Entity public class Network extends AbstractEntity { private long networkId; private String name; private boolean active; private DateTime createdAt; private String createdBy; private DateTime updatedAt; private String updatedBy; ... } AbstractEntity is @MappedSuperclass public class AbstractEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Long getId() { return id; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final AbstractEntity abstractEntity = (AbstractEntity) obj; return id.equals(abstractEntity.id); } @Override public int hashCode() { return id == null ? 0 : id.hashCode(); } } I have Repository where I want to add entity. I do @Repository public class NetworkRepositoryImpl implements NetworkRepository { @PersistenceContext private EntityManager entityManager; @Override @Nonnull public List&lt;Network&gt; findAll() { //noinspection JpaQlInspection final Query query = entityManager.createQuery("SELECT e FROM Network e"); return (List&lt;Network&gt;)query.getResultList(); } @Nonnull @Override @Transactional public Network save(@Nonnull final Network network) { if (network.getId() == null) { entityManager.persist(network); return network; } else { return entityManager.merge(network); } } } and I Test it as @Test public void testAllNetworks() { final Network network = new Network(1, "US", true, DateTime.now()); final Network networkInDb = networkRepository.save(network); assertNotNull(networkInDb.getId()); final List&lt;Network&gt; networks = networkRepository.findAll(); assertTrue(networks.isEmpty()); } my ApplicationConfig looks like @Configuration @ComponentScan @EnableJpaRepositories public class ApplicationConfig { @Bean public DataSource dataSource() { final EmbeddedDatabaseBuilder embeddedDatabaseBuilder = n…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23821615
tagged with: spring
has title: Spring Hibernate: Entity seems not persisted, no failures either
tagged with: entity-framework
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23820868

http://stackoverflow.com/comment/36696652
has text: This specific question was already answered in another thread: http://stackoverflow.com/questions/1844688/read-all-files-in-a-folder
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23823547

http://stackoverflow.com/q/23879970
upvote count: 0
answer count: 1
tagged with: arrays
has body: I am a noob to java, as well as programming, and I am having large difficulties picturing how to actually execute each method in order to create the Connect Four game. There are 4 methods, main, printBoard, checkWinner, and playerMove. I may add more methods if necessary. I am overwhelmed and need a ton of guidance. how to approach each method? Sorry if this is a mammoth question, I am throughly confused. import java.util.Scanner; public class ConnectFour{ // We will represent the game board using a 2 dimensional integer array. // Each entry of the array will contain a 0, 1, or -1. // A 0 entry in the array represents an empty slot. // A 1 entry represents Player 1's piece. // A -1 entry represents Player 2's piece. // Since most methods will need to access this board, we have decided to // make it a global class variable. import java.util.Scanner; public class ConnectFour{ public static int[][] board = new int[6][7]; public static void main(String[] args){ Scanner sc = new Scanner(System.in); // initializing board for(int i = 0; i &lt; 6; i++){ for(int j = 0; j &lt; 7; j++){ board[i][j] = 0; } } // WRITE CODE HERE if (j &lt; 7 &amp;&amp; j &gt;= 0) f[i][j] ="."; else f[i][j] = " "; return board; } } // This method prints the board on the screen. // To represent Player 1's pieces, print 'X'. // To represent Player 2's pieces, print 'O'. // To represent an empty slot, print '.'. public static void printBoard(){ // WRITE CODE HERE for (int i = 0; i &lt; 6; i++) { for (int j = 0;j &lt; 7; j++) { System.out.print(f[i][j]); } System.out.println(); } } // This method scans the current board and checks if there is a winner. // The method should return 1 if Player 1 has connected 4 pieces. // It should return -1 if Player 2 has connected 4 pieces. // It should return 0 if no player has connected 4 pieces. public static int checkWinner(){ // WRITE CODE HERE return;} // This method implements a player's move and updates the board accordingly. // The method has two integer inp…
has comment: http://stackoverflow.com/comment/36760739
has answer: http://stackoverflow.com/a/23880029
favorite count: 0
has comment: http://stackoverflow.com/comment/36760720
type: UnansweredQuestion
has title: connect 4 java issues: How do I do this?
tagged with: 2d-games
downvote count: 1
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/36683546
type: Comment
has text: Sorry I think I worded that wrong. I meant to say that the original string contains decimal values. I do not need to round them, as they are already rounded to 1 decimal place. All I need is for the regex to include the decimal and the number after it. How can I do that? Thanks again.
comment on: http://stackoverflow.com/a/23839154
score: 0
type: AnswerComment

http://stackoverflow.com/q/23780306
has body: Consider the following usage of liblinear (http://liblinear.bwaldvogel.de/): double C = 1.0; // cost of constraints violation double eps = 0.01; // stopping criteria Parameter param = new Parameter(SolverType.L2R_L2LOSS_SVC, C, eps); Problem problem = new Problem(); double[] GROUPS_ARRAY = {1, 0, 0, 0}; problem.y = GROUPS_ARRAY; int NUM_OF_TS_EXAMPLES = 4; problem.l = NUM_OF_TS_EXAMPLES; problem.n = 2; FeatureNode[] instance1 = { new FeatureNode(1, 1), new FeatureNode(2, 1) }; FeatureNode[] instance2 = { new FeatureNode(1, -1), new FeatureNode(2, 1) }; FeatureNode[] instance3 = { new FeatureNode(1, -1), new FeatureNode(2, -1) }; FeatureNode[] instance4 = { new FeatureNode(1, 1), new FeatureNode(2, -1) }; FeatureNode[] instance5 = { new FeatureNode(1, 1), new FeatureNode(2, -0.1) }; FeatureNode[] instance6 = { new FeatureNode(1, -0.1), new FeatureNode(2, 1) }; FeatureNode[] instance7 = { new FeatureNode(1, -0.1), new FeatureNode(2, -0.1) }; FeatureNode[][] testSetWithUnknown = { instance5, instance6, instance7 }; FeatureNode[][] trainingSetWithUnknown = { instance1, instance2, instance3, instance4 }; problem.x = trainingSetWithUnknown; Model m = Linear.train(problem, param); for( int i = 0; i &lt; trainingSetWithUnknown.length; i++) System.out.println(" Train.instance = " + i + " =&gt; " + Linear.predict(m, trainingSetWithUnknown[i]) ); System.out.println("---------------------"); for( int i = 0; i &lt; testSetWithUnknown.length; i++) System.out.println(" Test.instance = " + i + " =&gt; " + Linear.predict(m, testSetWithUnknown[i]) ); Here is the output : iter 1 act 1.778e+00 pre 1.778e+00 delta 6.285e-01 f 4.000e+00 |g| 5.657e+00 CG 1 Train.instance = 0 =&gt; 1.0 Train.instance = 1 =&gt; 0.0 Train.instance = 2 =&gt; 0.0 Train.instance = 3 =&gt; 0.0 --------------------- Test.instance = 0 =&gt; 1.0 Test.instance = 1 =&gt; 1.0 Test.instance = 2 =&gt; 0.0 Instead of the integer (hard) predictions, I need probablistic predictions. There is an option -b for command line, …
favorite count: 0
score: 2
type: AnsweredQuestion
has title: Probabilistic prediction with liblinear (java), with direct usage of the classifier inside the code
upvote count: 2
has answer: http://stackoverflow.com/a/23840652
tagged with: liblinear
tagged with: machine-learning
tagged with: logistic-regression
type: Question
tagged with: java
tagged with: svm
accepted answer: http://stackoverflow.com/a/23840652
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36686319
type: Comment
has text: The problem is not that `this` is not static: it's that `this` doesn't exist inside a static method. Although frowned upon, it's perfectly valid syntax to access a static method through `this` in a context in which `this` exists (like from inside an instance method)
type: AnswerComment
comment on: http://stackoverflow.com/a/23840570
score: 0

http://stackoverflow.com/q/23853705
has comment: http://stackoverflow.com/comment/36712077
has title: double checked locking in JAVA
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23853786
accepted answer: http://stackoverflow.com/a/23853786
favorite count: 0
tagged with: double-checked-locking
linked to: http://stackoverflow.com/q/7855700
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36711641
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36711102
score: 1
has comment: http://stackoverflow.com/comment/36711329
tagged with: java
tagged with: thread-safety
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36711012
has comment: http://stackoverflow.com/comment/36711666
has body: Reading about DCL in Wikipedia, I was wondering about the problem in DCL and the proposed solution, or in other words why is the volatile keyword needed? The problem, in short: using DCL may result in some cases in a partially constructed object being used by thread. The proposed solution (for JAVA 5+): // Works with acquire/release semantics for volatile // Broken under Java 1.4 and earlier semantics for volatile class Foo { private volatile Helper helper; public Helper getHelper() { Helper result = helper; if (result == null) { synchronized(this) { result = helper; if (result == null) { helper = result = new Helper(); } } } return result; } // other functions and members... } Now, my question is why not drop the volatile from helper? correct me if I'm wrong, but if you just break this line: helper = result = new Helper(); to: result = new Helper(); helper = result; In this scenario the helper will never get the reference until the object is complete. Isn't that so? How is the volatile doing better? EDIT: assume this code: class Foo { private volatile Helper helper; public Helper getHelper() { Helper result = helper; if (result == null) { synchronized(this) { result = helper; if (result == null) { result = new Helper(); result.someMethod(); helper = result; } } } return result; } } If the next line after initialization doesn't guaranty a fully initialized object, I can't call methods on it. Can I?
duplicate of: http://stackoverflow.com/q/7855700
has comment: http://stackoverflow.com/comment/36711347
has comment: http://stackoverflow.com/comment/36710956

http://stackoverflow.com/comment/36681997
type: Comment
has text: I also would use FocusListener, but ActionListener works too. I've tested. I don't know why, but at least for ComboBox as cell renderer ActionListener can be used.
comment on: http://stackoverflow.com/a/23833065
score: 0
type: AnswerComment

http://stackoverflow.com/a/23937107
type: Answer
accepted answer of: http://stackoverflow.com/q/23937066
upvote count: 3
downvote count: 0
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36869153
has comment: http://stackoverflow.com/comment/36869422
has body: insert.removeAllElements(); In Java, Objects are passed by reference. Since this is the same object you pass into the returner Vector, when you remove its elements, the returner Vector also loses those elements. Fix: Create a new Vector inside the loop. Vector&lt;Vector&lt;E&gt;&gt; returner = new Vector&lt;&gt;(); for (int i=1; i&lt;edges.size(); i++) { Vector&lt;E&gt; insert = new Vector&lt;&gt;(); insert.add(edges.firstElement()); insert.add(edges.elementAt(i)); returner.add(insert); } Your new answer looks ok, but I have a couple of suggestions. clone() is not a good method to use in general, it's usually better to create a new collection passing the old one into it's constructor. So you can replace: returner.add(castObj(insert.clone())); With: returner.add(new Vector&lt;E&gt;(insert); This also saves you the trouble of casting the object.
answers question: http://stackoverflow.com/q/23937066

http://stackoverflow.com/comment/36606133
type: AnswerComment
has text: @Evegeniy This shows only the thread created by JVM. For example, the above prints 5 threads, but the task manager shows 10 threads for the process. Are the remaining threads are native threads not created by JVM?
type: Comment
comment on: http://stackoverflow.com/a/23798342
score: 0

http://stackoverflow.com/q/23804379
has comment: http://stackoverflow.com/comment/36616187
tagged with: maven
has title: OneJar includes Dr Tuffs classes
has comment: http://stackoverflow.com/comment/36616438
type: AnsweredQuestion
tagged with: java
has body: I expect this is trivial, but I'm on a deadline, so I apologise if this is a stupid question. I'm using Dr Tuffs OneJar for Maven to build a fat jar including all my dependencies etc. However, when I use jar tf xxx.one-jar.jar it lists the things I'd expect, like my normal jar, but also all of Dr Tuffs code. The below is just an excerpt from the command: com/ com/simontuffs/ com/simontuffs/onejar/ .version OneJar.class com/simontuffs/onejar/Boot$1.class com/simontuffs/onejar/Boot$2.class com/simontuffs/onejar/Boot$3.class com/simontuffs/onejar/Boot.class com/simontuffs/onejar/Handler$1.class I'm hoping there's a property I can set in my pom file to stop it doing this.
type: Question
score: 0
has answer: http://stackoverflow.com/a/23858869
answer count: 1
accepted answer: http://stackoverflow.com/a/23858869
has comment: http://stackoverflow.com/comment/36711876
tagged with: onejar

http://stackoverflow.com/comment/36769541
type: QuestionComment
comment on: http://stackoverflow.com/q/23884486
score: 1
has text: Try to use `.jvmArgs("-Xms2048m", "-Xmx2048m", "-XX:MaxDirectMemorySize=512M")` (vararg with a single item per option instead of a single string that contains all options).
type: Comment

http://stackoverflow.com/comment/36829700
has text: Fixed! But now I have another problem. Inside Envelope, my Element shows "<" and ">" correctly, but when I send to Server, returns "&lt;" and "&gt;". Why? is this a bug from Log?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23886922
score: 0

http://stackoverflow.com/a/23900252
has body: This will check each interface and assign the MAC address if the display name is eth0. Replace eth0 with the name of the interface you want the MAC address of (can view interfaces on Linux with ifconfig - the loopback address (localhost) does not have a hardware address) import java.net.NetworkInterface var macAddress = Array.empty[Byte] val interfaces = NetworkInterface.getNetworkInterfaces while (interfaces.hasMoreElements) { val element = interfaces.nextElement if (element.getDisplayName.equalsIgnoreCase("eth0")) { macAddress = element.getHardwareAddress } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23900172
downvote count: 0

http://stackoverflow.com/q/23817968
score: 0
accepted answer: http://stackoverflow.com/a/24060369
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24060369
type: Question
has title: JSON with Jackson 2, i need XMLAdapter like functionality
answer count: 1
tagged with: jackson
has body: So I am struggling with this for a week or so. I previously have created a service with XML response from Database and I successfully loaded all the entities and used them with XMLAdapters. This worked for both read, write, create and delete. Especially fragile moment were collections, but the Adapters make them work really nice. So I am working with JSON now and I cant make the Hibernate Collections to work properly. I either get full-recursive eagerly loaded collections which implicts in sending the whole database in most cases, or in place of collections :(. What is the approach I should take? Thanks in advance! an example response, listing all the users: [ { "username":"bob", "password":"8ee3086749f7fa95ffe9c4588037cb10", "enabled":true, "email":null, "name":null, "version":1, "authorities":[ { "id":3, "version":0, "description":null, "comment":null, "authority":"ROLE_USER" }, { "id":2, "version":0, "description":null, "comment":null, "authority":"ROLE_ADMIN" } ], "messages":[ { "id":2, "version":0, "description":null, "comment":null, "message":"TEST BACK" } ], "meetings":[ { "id":1, "version":0, "description":null, "comment":null, "messages":[ 2, { "id":1, "version":0, "description":null, "comment":null, "message":"TEST" } ] } ] }, { "username":"rod", "password":"e97673c55fc4f2af8bf2122333df24ac", "enabled":true, "email":null, "name":null, "version":1, "authorities":[ { "id":1, "version":0, "description":null, "comment":null, "authority":"ROLE_USER" } ], "messages":[ 1 ], "meetings":[ 1 ] } ] So I do not understand... while f.e. authorities could be allright, but then f.e. meeting is being loaded with all of its collections and that all affects "rob" user later on because the entites are not doubled. I think its because I use @JsonManagedReference and @JsonBackReference but I do not know if correctly.

http://stackoverflow.com/a/23828311
score: 0
answers question: http://stackoverflow.com/q/23828068
has body: Even better approach if (preselectionDefined) { for ( MyData data : myDatas) { if (data.section.equalsIgnoreCase("HEAD")) { sectionId = "A"; } else if (data.section.equalsIgnoreCase("SENIOR")) { sectionId = "B"; } else if (data.section.equalsIgnoreCase("JUNIOR")) { sectionId = "C"; } } return sectionId; } In Java 7 if (preselectionDefined) { for ( MyData data : myDatas) { switch (data) { case "HEAD": sectionId = "A"; break; case "SENIOR": sectionId = "B"; break; case "JUNIOR": sectionId = "C"; break; } } return sectionId; }
type: Answer

http://stackoverflow.com/comment/36727600
score: 3
has text: Your algorithm should be a breadth-first-search. If you google that, you should find a good explanation. Probably on wikipedia :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23862207

http://stackoverflow.com/q/23842614
has answer: http://stackoverflow.com/a/23842704
has title: What is the equivalent of the applet getGraphics() in Android. And how can I "draw" outside the onDraw()
tagged with: java
has body: I need to get the graphics context in Android and I have read that it is not possible to draw outside the onDraw(), how can I handle the problem because I need the graphic context to draw outside the onDraw() I have posted the part of code I have problems with. The is Prof. David Eck’s code in the applet where I am getting the problem. synchronized void putSquare(int row, int col, int colorNum) { // draw one cell of the maze, to the graphics context "graphics" int w = totalWidth / columns; // width of each cell int h = totalHeight / rows; // height of each cell Graphics graphics = getGraphics();// This is the problem graphics.setColor(colorArray[colorNum]); graphics.fillRect( (col * w) + left, (row * h) + top, w, h ); } I have tried to convert it to Android synchronized void putSquare(int row, int col, int colorNum, Canvas canvas) { try { canvas = surfaceHolder.lockCanvas(null);// nullpointerexception synchronized (surfaceHolder) { Paint paint = new Paint(): // draw one cell of the maze, to the graphics context "graphics" int w = totalWidth / columns; // width of each cell int h = totalHeight / rows; // height of each cell apaint.drawColor(color[colorNum]); canvas.drawRect( (col * w) + left, (row * h) + top, w, h, paint); } } finally { if (aCanvas != null) { surfaceHolder.unlockCanvasAndPost(aCanvas); } } } putSquare() is called by makeMaze() makeMaze() { maze = new int[rows][columns]; putSquare(rows, columns, colorNumber, mainCanvas); } makeMaze() is called in the run() but not in onDraw() public void run() { makeMaze() } I get a NullPointerException In the onDraw() I call another method. onDraw(Canvas conv) { //it also also putSquare() redrawMaze(conv) }
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/36756194
comment on: http://stackoverflow.com/a/23877582
has text: Yes, recursion is a great idea. There are always multiple ways of doing things.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23895229
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23882251
has body: Solution 1 Solution in JsonObject as well using JsonParser to convert JSON string directly into JsonObject without using Gson. JsonParser parser = new JsonParser(); JsonObject jsonObject = (JsonObject) parser.parse(json); System.out.println(" JSON is " + jsonObject); System.out.println(" JSON is " + jsonObject.get("hybrid")); output: JSON is {"hybrid":"true","trimName":"act"} JSON is "true" Solution 2 You can convert JSON string into Map&lt;String, String&gt; using TypeToken and Type String json = "{\"hybrid\":\"true\",\"trimName\":\"act\"}"; Type type = new TypeToken&lt;Map&lt;String, String&gt;&gt;() {}.getType(); Map&lt;String, String&gt; data = new Gson().fromJson(json, type); System.out.println(" JSON is " + data); System.out.println(" JSON is " + data.get("hybrid")); output: JSON is {hybrid=true, trimName=act} JSON is true
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36720522
comment on: http://stackoverflow.com/q/23858490
score: 0
type: QuestionComment
has text: Done. Could you help me, please?
type: Comment

http://stackoverflow.com/q/23896256
has body: I'm trying to do some simple client side date manipulation in Java. It's stored in UTC down to the millisecond, but for client side display I would like to truncate it to the second and display it in PST. Currently, I'm getting the time from the db as a string like so: myDataSet.someDate = resultSet.getString("some_date")); I was thinking that I get some sort of Time object, manipulate it so it displays in the format I want and then wrap it in a string for display purposes. Here's what I have so far. myDataSet.someDate = String.valueOf(resultSet.getTimestamp("some_date")); This gets me the string, but the time is not in the correct form. I've found a few answers, but they all seem to want me to write another function. This seems like something I should be able to do in one line of code.
has answer: http://stackoverflow.com/a/23896495
has answer: http://stackoverflow.com/a/23917438
accepted answer: http://stackoverflow.com/a/23917438
score: 0
duplicate of: http://stackoverflow.com/q/4772425
answer count: 3
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23896444
linked to: http://stackoverflow.com/q/4772425
type: Question
has title: Simple manipulation of Java timestamp object?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36792154
tagged with: java
possible better answer: http://stackoverflow.com/a/23896444
linked to: http://stackoverflow.com/q/9872419
upvote count: 1

http://stackoverflow.com/comment/36813594
type: Comment
type: QuestionComment
has text: It sounds to me that the problem is in the mapper file - can you show it to us?
comment on: http://stackoverflow.com/q/23904705
score: 0

http://stackoverflow.com/comment/36752725
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23875215
has text: @BackSlash: uhm? do you mean it is a bug?

xstream
tags question: http://stackoverflow.com/q/23913606
type: Tag
tags question: http://stackoverflow.com/q/23832325
tags question: http://stackoverflow.com/q/23816525
tags question: http://stackoverflow.com/q/23779460
tag name: xstream

http://stackoverflow.com/q/23861345
has comment: http://stackoverflow.com/comment/36726351
has comment: http://stackoverflow.com/comment/36726939
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36726783
linked to: http://stackoverflow.com/q/19209650
has answer: http://stackoverflow.com/a/23862135
has comment: http://stackoverflow.com/comment/36726074
tagged with: java
tagged with: localization
has comment: http://stackoverflow.com/comment/36726326
upvote count: 1
has comment: http://stackoverflow.com/comment/36726136
tagged with: swing
has title: How to place JButton in custom location in JPanel?
downvote count: 1
tagged with: jbutton
type: Question
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/36726287
has answer: http://stackoverflow.com/a/23862148
has comment: http://stackoverflow.com/comment/36726170
linked to: http://stackoverflow.com/q/7143287
has comment: http://stackoverflow.com/comment/36726210
tagged with: jpanel
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36727108
has answer: http://stackoverflow.com/a/23862056
has comment: http://stackoverflow.com/comment/36726118
has body: I cant seem to set a custom position of a button to JPanel. It always adds the button at the top left, and continues right. I also have a background image in place, which makes matters a bit more difficult. The Frame looks like this: imageshack.com/a/img838/3240/ez6l.png My code is: private JFrame mainframe = new JFrame(); public void main() { mainframe.setLocation(400, 150); mainframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainframe.setVisible(true); mainframe.setSize(800, 600); JPanel menupanel2 = new JPanel(); JPanel MusicPanel = new JPanel(); mainframe.setResizable(false); mainframe.setContentPane(new JLabel(new ImageIcon("src/res/LED0.png"))); mainframe.setLayout(new FlowLayout()); menupanel2.setBackground(Color.black); JButton PlayButton = new JButton("Play"); PlayButton.setBackground(Color.green); JButton highscores = new JButton("Highscores"); highscores.setBackground(Color.MAGENTA); JButton CustomButton = new JButton("Custom Shapes"); CustomButton.setBackground(Color.orange); JButton HelpButton = new JButton("Help"); HelpButton.setBackground(Color.red); JButton AboutButton = new JButton("About"); AboutButton.setBackground(Color.yellow); final JButton MusicButton = new JButton("music"); MusicButton.setPreferredSize(new Dimension(50, 50)); CustomButton.setPreferredSize(new Dimension(140, 40)); PlayButton.setPreferredSize(new Dimension(140, 40)); HelpButton.setPreferredSize(new Dimension(140, 40)); AboutButton.setPreferredSize(new Dimension(140, 40)); highscores.setPreferredSize(new Dimension(140, 40)); mainframe.add(menupanel2, BorderLayout.NORTH); mainframe.add(MusicPanel, BorderLayout.SOUTH); menupanel2.add(PlayButton, BorderLayout.NORTH); menupanel2.add(CustomButton, BorderLayout.NORTH); menupanel2.add(HelpButton, BorderLayout.NORTH); menupanel2.add(highscores, BorderLayout.NORTH); menupanel2.add(AboutButton, BorderLayout.NORTH); MusicPanel.add(MusicButton, BorderLayout.SOUTH); I want to add the button "MusicButton " to the bottom right corn…
favorite count: 0

http://stackoverflow.com/comment/36842225
score: 0
comment on: http://stackoverflow.com/q/23922387
type: QuestionComment
type: Comment
has text: if you see the screenshot it shows unbound in the brackets after your jre. May be this might help you http://stackoverflow.com/questions/3542051/eclipse-frustration-with-java-1-7-unbound-library

vert.x
tags question: http://stackoverflow.com/q/23931208
tags question: http://stackoverflow.com/q/23925968
tag name: vert.x
tags question: http://stackoverflow.com/q/23788363
type: Tag

http://stackoverflow.com/comment/36874685
score: 3
comment on: http://stackoverflow.com/q/23940233
has text: Hint: use a better algorithm
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23916579
accepted answer: http://stackoverflow.com/a/23917020
tagged with: android
tagged with: client
has body: I have problem to connect my android client to my PC Server here there are the codes -->PC SERVER: public class Server { public static void main(String[] args) throws IOException, SQLException, ClassNotFoundException { ServerSocket server = new ServerSocket(4444); System.out.println("Waiting for clients to connect..."); while (true) { Socket s = server.accept(); InetAddress clientAddress = s.getInetAddress(); System.out.println("Incoming connection from: " + clientAddress.getHostName() + "[" + clientAddress.getHostAddress() + "]"); s.close(); } } } --->ANDROID CLIENT: public class Main extends Activity { Button b; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b = (Button)findViewById(R.id.connect); b.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View arg0) { try { Socket client = new Socket("10.0.2.2", 4444); //connect to server client.close(); //closing the connection } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); } When on my android device i click the button in my server program(PC) doesn't view device connect...why? i've tried to insert &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; into my AndroidManifest but when i click on button program crash Android device and PC are connected to same network(router DSL). Help me please
tagged with: sockets
has answer: http://stackoverflow.com/a/23916696
type: AnsweredQuestion
has title: Socket android client PC server
possible better answer: http://stackoverflow.com/a/23916696
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/47324751
has answer: http://stackoverflow.com/a/23917020
has comment: http://stackoverflow.com/comment/36830916
score: 0
answer count: 3

http://stackoverflow.com/a/23933061
answers question: http://stackoverflow.com/q/23930541
type: Answer
score: 2
upvote count: 2
has body: You could send a cookie with the remaining time (in milliseconds) on every request. Then you can use setTimeout as suggested but test the value again when the timeout-function is executed. If the value has changed you can reset the timeout. Since the cookie is set for the whole domain it will always be correct even for ajax or other tabs. var cookieName = 'sessionMsg'; var message = 'Your session is going to be end by 5 min, Please click OK to continue'; function getCookie(name) { var name = name + "="; var ca = document.cookie.split(';'); for(var i=0; i&lt;ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name)==0) return c.substring(name.length,c.length); } return ""; } function setSessionPrompt() { var timeout = getCookie(cookieName) - new Date().getTime(); setTimeout(function(){ if (new Date().getTime() &lt; getCookie(cookieName)) { setSessionPrompt(); } else { if(confirm(message)) { // do your action here } } }, timeout); } setSessionPrompt();
downvote count: 0

http://stackoverflow.com/a/23861567
upvote count: 2
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23861286
has body: Check the Common Intents listing in the documentation. It's a pretty comprehensive listing of the actions, URI formats and MIME types for building Intents for the standard Android applications.
score: 2

http://stackoverflow.com/comment/36822320
score: 0
comment on: http://stackoverflow.com/a/23911796
type: Comment
type: AnswerComment
has text: It's only an info log, and googling around seems to indicate it should not be an issue. Try to load your rest service.

http://stackoverflow.com/q/23840964
tagged with: jpanel
has body: In this program, I want to draw a series of lines that interact to form a web. Each time the timer ticks, a line is drawn. Therefore, I cannot have the super.paintComponent(g) call in the paintComponent() because I need the previous lines to appear. However, I would like to set the background colour and as far as I've found, the setBackground() method can be called only if the super call is first made. I am not sure if the fillRect method would work either because it would draw a rectangle over the old line each time. I tried having the setBackground() method in the constructor, and it did not work either. Here is my code: import java.awt.*; import javax.swing.*; import java.awt.event.*; public class prettyWebPanel extends JPanel implements ActionListener { Timer time = new Timer(100,this); private Color colour1 = Color.black; private Color colour2 = Color.white; JButton start = new JButton("Start"); int j = 0; public prettyWebPanel() { setPreferredSize(new Dimension (550,550)); this.add(start); start.addActionListener(this); setBackground(colour1); } public void paintComponent(Graphics g) { setBackground(colour1); setForeground(colour2); if (j&lt;490) g.drawLine(20, 20+j, 20+j, 500); } public void actionPerformed(ActionEvent e) { if (e.getSource() == start) time.start(); else if (e.getSource() == time) { j+=10; repaint(); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36785015
has answer: http://stackoverflow.com/a/23840994
has comment: http://stackoverflow.com/comment/36785863
has title: How to set the background in a JPanel without using the super call in paintComponent()
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/36686557
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/36686575
type: Question
downvote count: 2
upvote count: 1
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/36689265
tagged with: setbackground
tagged with: java

http://stackoverflow.com/comment/36683613
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23837424
type: QuestionComment
has text: @MadProgrammer they are in seprate folder `img` in project directory. http://scr.hu/15in/oig8m

http://stackoverflow.com/comment/36759394
type: AnswerComment
score: 0
has text: Layout managers aren't enough for what I wanted to do but thank you for the explanation on the swing timer. I don't need it for this panel but I'll need it for later when I put in actual graphics on a canvas.
type: Comment
comment on: http://stackoverflow.com/a/23879204

http://stackoverflow.com/q/23903403
has comment: http://stackoverflow.com/comment/36806024
has comment: http://stackoverflow.com/comment/36806028
tagged with: java
has comment: http://stackoverflow.com/comment/36805988
has comment: http://stackoverflow.com/comment/36806278
downvote count: 1
has comment: http://stackoverflow.com/comment/36807177
type: Question
tagged with: arrays
score: -1
has body: I have an array of person objects. In the below code, I am updating 3 fields of person object on a condition. Here What I need is, First set all these values to person object(person.setcheckId("20")) and set the person object to array instead of directly updating the array.... for (int personIndex = 0; personIndex &lt; personArray.length; personIndex++) { if(personArray[personIndex].getId==1) { PersonType person = personArray[personIndex]; personArray[personIndex].setMemberId("20"); personArray[personIndex].setName("Robert"); personArray[personIndex].setFName("Pole"); } }
answer count: 2
has title: How I can update an array of objects?
upvote count: 0
has comment: http://stackoverflow.com/comment/36806047
has comment: http://stackoverflow.com/comment/36806014
favorite count: 0
has answer: http://stackoverflow.com/a/23903466
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23903480
has comment: http://stackoverflow.com/comment/36806051

http://stackoverflow.com/a/23924532
has comment: http://stackoverflow.com/comment/36845926
has comment: http://stackoverflow.com/comment/36846636
accepted answer of: http://stackoverflow.com/q/23924363
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36845959
has body: There are a couple of problems... First, your actionPerformed method is doing exactly what you told it to for (int i = 0; i &lt; ops.length; i++) { if (text.endsWith(ops[i])) { field.setText(""); System.out.println("called"); break; } } /* Checks if number was pressed */ for (int i = 0; i &lt;= 9; i++) { if (e.getSource() == buttons[i]) { // Here, the field text is been rest to text + button.text... field.setText(text + buttons[i].getText()); // And nothing will be executed after it... return; } } So, even if the field is cleared, it will always be set back to the existing value plus the value of the button's text... What I "think" you want to do, is calculate the value of the field first, then process the button press... Updated based on edits // You assign the reference to the `String` maintained by the text field... String text = field.getText(); System.out.println(text); // prints "0+" like expected (after pressing number) /* Checks for operation chars */ for(int i = 0; i &lt; ops.length; i++) { if(text.endsWith(ops[i])) { // You assign a NEW reference to the text field, this // won't change the contents of text as they are different // references... field.setText(""); System.out.println("called"); //gets printed break; } } // text has not changed, this variable and the field contents are not // magically linked System.out.println(text); //even when "called" prints, text is not "" Also, remember, String in Java is nonmutable, meaning that once created, a Strings contents can't be changed, it can simply be reassigned...
has comment: http://stackoverflow.com/comment/36846705
answers question: http://stackoverflow.com/q/23924363
has comment: http://stackoverflow.com/comment/36846119
score: 3
has comment: http://stackoverflow.com/comment/36846164
has comment: http://stackoverflow.com/comment/36846087
has comment: http://stackoverflow.com/comment/36846099
has comment: http://stackoverflow.com/comment/36846299
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36841520
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23921697
has text: Correct. Basically i want to find any instance of 'tom' that appears on a line, whether by itself or as part of another word, except if it appears in that list of words.
type: QuestionComment

http://stackoverflow.com/q/23829753
has answer: http://stackoverflow.com/a/23829921
tagged with: api
type: AnsweredQuestion
has body: I want to call the url, Call Format: https://thepulseapi.earthnetworks.com/oauth20/token?grant_type=client_credentials&amp;client_id=(Consumer Key)&amp;client_secret=(Consumer Secret Key) which gives a json object like { "OAuth20": { "access_token": { "token": "YwLFnMnyGYoyGGkddWtsbTUR8IZA", "refresh_token": "YwLFnMnyGYoyGGkddWtsbTUR8IZA", "token_type": "bearer", "expires_in": 86399 } } } The token refreshes every session or when it expires, so i need to create a way to get this to pass through each time with out hard coding it. Any examples or suggestions on this weather bug api?
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23829921
tagged with: parsing
score: 0
upvote count: 1
downvote count: 1
answer count: 1
tagged with: c#
tagged with: java
has title: Get new access token from json object c# weatherbug api
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23844730
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36693159
tagged with: user-interface
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23848440
has title: Form that has either a Comic Book object or a Novel object
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36694082
has answer: http://stackoverflow.com/a/23846225
type: Question
has body: Sorry if I'm double positing but I totally suck at Java. I am trying to make my form have the ability to change dynamically if you select a radio button. The functions save, delete, new will remain the same but the contents of the body e.g. the UPC will change to ISBN of the novel and the other fields. Is there a way to when you press Novel to load the items from Novel to replace Comic book items? I tried to separate but I've hit a block and with my limited skills unsure what to do. I just want it to be able to change it so that it works. import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridLayout; import java.awt.MenuBar; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Scanner; public class FormFictionCatelogue extends JFrame implements ActionListener { // Constants // ========= private final String FORM_TITLE = "Fiction Adiction Catelogue"; private final int X_LOC = 400; private final int Y_LOC = 80; private final int WIDTH = 600; private final int HEIGHT = 450; private String gradeCode; //final static String filename = "data/comicBookData.txt"; private JButton firstPageButton; private JButton backPageButton; private JButton forwardPageButton; private JButton lastPageButton; private JRadioButton comicBookRadioButton; private JRadioButton novelRadioButton; private final String FIRSTPAGE_BUTTON_TEXT = "|&lt;"; private final String BACKPAGE_BUTTON_TEXT = "&lt;"; private final String FORWARDPAGE_BUTTON_TEX…
tagged with: java
has comment: http://stackoverflow.com/comment/36693113
score: 0

http://stackoverflow.com/a/23877939
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23873481
has body: i have put together a quick code example here: gist.github.com/VijayKrishna/1ca807c952187a7d8c4d, that shows how to use a method adaptor, via its corresponding class-visitor/class-adaptor. In summary, you first "invoke" the class adapter (say from within a main method) as follows: ClassReader cr = new ClassReader(in); ClassWriter cw = new ClassWriter(ClassReader.EXPAND_FRAMES); ReturnAdapter returnAdapter = new ReturnAdapter(cw, className); cr.accept(returnAdapter, 0); You then follow it up adapting the methods as follows in the class-adaptor's visitMethod method: public MethodVisitor visitMethod(int access ... ... ... ) { MethodVisitor mv; mv = cv.visitMethod(access, name, desc, signature, exceptions); mv = new MethodReturnAdapter(Opcodes.ASM4, className, access, name, desc, mv); return mv; } Here is the entire code snippet in case the gist is inaccessible: public class ReturnAdapter extends ClassVisitor { private String className; public ReturnAdapter(ClassVisitor cv, String className) { super(Opcodes.ASM4, cv); } @Override public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv; mv = cv.visitMethod(access, name, desc, signature, exceptions); mv = new MethodReturnAdapter(Opcodes.ASM4, className, access, name, desc, mv); return mv; } public static void main(String[] args) throws IOException { String classFile = args[0];//path of the class file String className = args[1];//name of the class File inFile = new File(classFile); FileInputStream in = new FileInputStream(inFile); // adapting the class. ClassReader cr = new ClassReader(in); ClassWriter cw = new ClassWriter(ClassReader.EXPAND_FRAMES); ReturnAdapter returnAdapter = new ReturnAdapter(cw, className); cr.accept(returnAdapter, 0); } } /** * Method Visitor that inserts code right before its return instruction(s), * using the onMethodExit(int opcode) method of the AdviceAdapter class, * from ASM(.ow2.org). * @author vijay * */ class MethodRe…
answers question: http://stackoverflow.com/q/23873481

junit
tags question: http://stackoverflow.com/q/23812999
type: Tag
tags question: http://stackoverflow.com/q/23911180
tags question: http://stackoverflow.com/q/23831283
tags question: http://stackoverflow.com/q/23859691
tags question: http://stackoverflow.com/q/23801281
tags question: http://stackoverflow.com/q/23814450
tags question: http://stackoverflow.com/q/23887983
tags question: http://stackoverflow.com/q/23807845
tags question: http://stackoverflow.com/q/23798942
tags question: http://stackoverflow.com/q/23828002
tags question: http://stackoverflow.com/q/23828865
tags question: http://stackoverflow.com/q/23823463
tags question: http://stackoverflow.com/q/23927380
tags question: http://stackoverflow.com/q/23831719
tags question: http://stackoverflow.com/q/23812919
tags question: http://stackoverflow.com/q/23932598
tags question: http://stackoverflow.com/q/23887178
tags question: http://stackoverflow.com/q/23804546
tag name: junit
tags question: http://stackoverflow.com/q/23869778
tags question: http://stackoverflow.com/q/23870993
tags question: http://stackoverflow.com/q/23850148
tags question: http://stackoverflow.com/q/23885589
tags question: http://stackoverflow.com/q/23861882
tags question: http://stackoverflow.com/q/23873860
tags question: http://stackoverflow.com/q/23881206
tags question: http://stackoverflow.com/q/23909213
tags question: http://stackoverflow.com/q/23910743
tags question: http://stackoverflow.com/q/23904221
tags question: http://stackoverflow.com/q/23830740
tags question: http://stackoverflow.com/q/23892020
tags question: http://stackoverflow.com/q/23868294
tags question: http://stackoverflow.com/q/23874913
tags question: http://stackoverflow.com/q/23877314
tags question: http://stackoverflow.com/q/23828337
tags question: http://stackoverflow.com/q/23915658
tags question: http://stackoverflow.com/q/23821335
tags question: http://stackoverflow.com/q/23845588
tags question: http://stackoverflow.com/q/23912358
tags question: http://stackoverflow.com/q/23916843
tags question: http://stackoverflow.com/q/23893080
tags question: http://stackoverflow.com/q/23892806
tags question: http://stackoverflow.com/q/23907976
tags question: http://stackoverflow.com/q/23792958
tags question: http://stackoverflow.com/q/23789271
tags question: http://stackoverflow.com/q/23836144
tags question: http://stackoverflow.com/q/23881722
tags question: http://stackoverflow.com/q/23874271

http://stackoverflow.com/q/23924827
tagged with: admob
type: Question
has body: I'm a total newbie when it comes to programing. I'm trying to ad AdMob ads to this listview tutorial app using the Google Play Services library. I followed the instructions from Google but the app keeps crashing when I try to run it and I don't know why... 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:orientation="vertical"&gt; &lt;com.google.ads.AdView xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adUnitId="123456789" ads:adSize="BANNER" ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" ads:loadAdOnCreate="true"/&gt; &lt;ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="#b5b5b5" android:dividerHeight="1dp" android:listSelector="@drawable/list_selector"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; Main Activity Java import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; import android.widget.SimpleAdapter; public class WeatherActivity extends Activity { // XML node keys static final String KEY_TAG = "weatherdata"; // parent node static final String KEY_ID = "id"; static final String KEY_CITY = "city"; static final String KE…
answer count: 1
accepted answer: http://stackoverflow.com/a/23924999
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23924999
tagged with: java
has title: Android AdMob XML code with ListView

http://stackoverflow.com/q/23829726
has comment: http://stackoverflow.com/comment/36666923
has body: I have been using Java for quite some time and am still puzzled by this naming of API. Why is it like that? For example when you have one instance of ArrayList it has a property of how much objects are added to the list. To get this property you call .size() and not getSize() which would be more along the line of what you are actually trying to do. You are trying to read a value of the property of this list, not do some operation on it. I guess internally "sizing" this list is probably much more complicated then just reading a single variable but that is implantation detail and the user of the object should not care about that.
has answer: http://stackoverflow.com/a/23829864
tagged with: collections
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36668103
has comment: http://stackoverflow.com/comment/36664369
type: Question
has comment: http://stackoverflow.com/comment/36664564
answer count: 2
has comment: http://stackoverflow.com/comment/36664387
tagged with: api
accepted answer: http://stackoverflow.com/a/23829864
downvote count: 0
has answer: http://stackoverflow.com/a/23829809
linked to: http://stackoverflow.com/q/8772204
has comment: http://stackoverflow.com/comment/36664351
has comment: http://stackoverflow.com/comment/36664542
possible better answer: http://stackoverflow.com/a/23829809
favorite count: 0
has comment: http://stackoverflow.com/comment/36664477
has title: why .size() is not getSize() on collections
upvote count: 2

http://stackoverflow.com/q/23887888
tagged with: syntax-highlighting
type: Question
has title: ANTLR4-based lexer loses syntax hightlighting during typing on NetBeans
answer count: 2
accepted answer: http://stackoverflow.com/a/23888392
downvote count: 0
has body: I've coded a simple lexer and parser using ANTLR4 grammars to make a language plugin for NetBeans 7.3 to help team write more quickly our layout files (a mix of XHTML and widgets definitions also in form of XHTML tags but with custom properties, characteristics, and with some differencies against XHTML syntax). Template file example: &lt;div style="dyn_layout_panel"&gt; @symbol@ &lt;w_label=label, text="Try to close this window" /&gt; &lt;w_buttonclose=button, text = "CLOSE", on_press=press_close /&gt; &lt;w_buttonterminate=button, text="TERMINATE", on_press=press_terminate /&gt; &lt;w_mydatepicker=datepicker, parent=tab0, ary=[10, "str", /regex/i], start_date=2013-10-05, on_selected=datepicker_selected /&gt; &lt;w_myeditbox=editbox, parent=tab0, validation=USER_REGEX, validation_regex=/^[0-9]+[a-z]*$/i, validation_msg="User regex don't match editbox contents.", on_keyreturn=tab0_editbox_keyreturn /&gt; &lt;div style="dyn_layout_panel"&gt; $SYMBOL_2$ Some text that make a text node. &lt;/div&gt; &lt;/div&gt; I use AnltrWorks 2 to write and debug lexer and parser and all seem to be fine, in NetBeans also I don't get any exception and the parser work properly but during editing/typing I lose token colors near the cursor. Screenshot of problem: Adding a debug console output for each keystroke I see that the lexer enter in IN_TAG or IN_WIDGET mode correctly, but after a WHITESPACE it returns to the default mode and match te rest of text inside a tag as a TEXT_NODE token. I know that a lexer can have only one active mode at a time, so because it matches the TEXT_NODE rule when in IN_TAG or IN_WIDGET modes? Lexer grammar file: lexer grammar LayoutLexer; COMMENT : '/*' .*? '*/' -&gt; channel(HIDDEN) ; WS : ( ' ' | '\t' | EOL )+? -&gt; channel(HIDDEN) ; WDG_START_OPEN : '&lt;w_' PROPERTY -&gt; pushMode(IN_WIDGET) ; WDG_END_OPEN : '&lt;/w_' PROPERTY -&gt; pushMode(IN_WIDGET) ; TAG_START_OPEN : '&lt;' ATTRIBUTE -&gt; pushMode(IN_TAG) ; TAG_END_OPEN : '&lt;/' ATTRIBUTE -&gt; p…
tagged with: antlr4
possible better answer: http://stackoverflow.com/a/23931101
has answer: http://stackoverflow.com/a/23931101
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/23888392
upvote count: 1
type: AnsweredQuestion
tagged with: lexer
score: 1
tagged with: java

http://stackoverflow.com/comment/36809021
comment on: http://stackoverflow.com/q/23904236
score: 0
type: Comment
type: QuestionComment
has text: I suppose you are not copying your database but creating just file of that database .Check database size and compare to which in assets folder.

http://stackoverflow.com/comment/36821405
score: 0
type: Comment
type: AnswerComment
has text: Opps! I left the `toString()` part out. I've edited my answer.
comment on: http://stackoverflow.com/a/23902374

nutiteq
tag name: nutiteq
tags question: http://stackoverflow.com/q/23835817
type: Tag

http://stackoverflow.com/comment/36723952
score: 0
type: Comment
type: QuestionComment
has text: Without any further context, I'd suggest taking a look at [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/) and [Painting in AWT and Swing](http://www.oracle.com/technetwork/java/painting-140037.html) to understand how painting in Swing works
comment on: http://stackoverflow.com/q/23860287

http://stackoverflow.com/comment/36751861
has text: Do you need to create your own Fonts or to create your own Locale? Very different things.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23875626

http://stackoverflow.com/comment/36836832
type: Comment
score: 1
type: AnswerComment
has text: @membersound Assuming you are using subversion... In your subversion repo you will have this structure defined under trunk and as you branch it will be replicated under branches/<branch-name> as well. When you (or any developer) wants to work on trunk or a branch, they will check out the appropriate path to whatever directory they want to work in - they may or may not name it using the branch name or trunk. Maven doesn't know or care about any of the subversion stuff (although some plugins might, such as the maven-release-plugin).
comment on: http://stackoverflow.com/a/23919491

http://stackoverflow.com/comment/36838233
type: AnswerComment
type: Comment
has text: Here's the deal. If you run into problems, come back and tell us and we can help you optimize your program better. Unless it doesn't face bottlenecks, we won't ever know if it is good or bad. With a positive mindset, give it a go.
comment on: http://stackoverflow.com/a/23920467
score: 0

http://stackoverflow.com/comment/36664678
type: QuestionComment
has text: I'm doing exactly that - just as the Spring Boot docs suggest. I just need to initialize Spring Security from `main()`.
comment on: http://stackoverflow.com/q/23828229
score: 0
type: Comment

http://stackoverflow.com/a/23893780
has body: If you're making a Java game, you should use a Canvas to draw all components. You can override the Canvas' paint(Graphics) method, and loop over all components you want to draw there. Then you can easily draw two components on top of each other (the top component is the one drawn later in the loop). See the JavaDoc for Canvas
type: Answer
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/23893623
upvote count: 0
has comment: http://stackoverflow.com/comment/36791127

http://stackoverflow.com/q/23809129
has comment: http://stackoverflow.com/comment/36625567
answer count: 3
has title: What are the not thread-Safe cases when using HashMap in Java?
has body: In the API documents, we can see: If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) I'm thinking if the "put" method should be synchronized ? It said only the structural modification. Can you give some unsafe cases for the HashMap. And when I view the source code of "HashTable", the "get" method is also been synchronized, why not only the write operations be synchronized?
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23809456
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36625301
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23809356
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23809397
has answer: http://stackoverflow.com/a/23809456
possible better answer: http://stackoverflow.com/a/23809356
has comment: http://stackoverflow.com/comment/36625291

http://stackoverflow.com/comment/36783479
score: 0
comment on: http://stackoverflow.com/q/23891624
type: Comment
has text: http://stackoverflow.com/questions/4485875/why-myclass-class-exists-in-java-and-myfield-field-isnt and other similar questions.
type: QuestionComment

http://stackoverflow.com/q/23789437
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36588291
has title: Spring Jersey Corrupts Binary Data
tagged with: spring
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36590261
tagged with: jersey
linked to: http://stackoverflow.com/q/2958497
has comment: http://stackoverflow.com/comment/36774423
has comment: http://stackoverflow.com/comment/36774984
upvote count: 1
has body: I have a controller like that: @POST @Path("/{mon}/update") public Response update(@PathParam("mon") String mon, @QueryParam("er") String er, @Context HttpServletRequest httpServletRequest, String data) { ... } When I send XML or JSON data there is not a problem. However when I send binary data I see that data is corrupted. I had a character encoding chain for UTF-8 and I removed it but problem did not resolved. Any ideas? EDIT: I've detect the problem. I've changed my controller as like that and converted my variable into String if needed: @POST @Path("/{mon}/update") public Response update(@PathParam("mon") String mon, @QueryParam("er") String er, @Context HttpServletRequest httpServletRequest, byte[] data) { ... } How can I solve this problem?

http://stackoverflow.com/comment/36859151
type: Comment
has text: I test your suggestion but It don't solve the issue. In odata4j class TypeConverter find out the value of id-class of entity submission which is submissionId. Odata4j don't know that type and that's why it throws exception. If we use a custom id-class then the problem is same.
comment on: http://stackoverflow.com/a/23929389
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36683211
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23839267
has text: Lesson learned - If eclipse is being weird, always test with javac.
score: 0

pass-by-reference
tags question: http://stackoverflow.com/q/23781419
type: Tag
tag name: pass-by-reference
tags question: http://stackoverflow.com/q/23850798

http://stackoverflow.com/q/23875442
tagged with: android
has comment: http://stackoverflow.com/comment/37452366
answer count: 0
has comment: http://stackoverflow.com/comment/36943738
has body: my app is about turning phone on ringer mode via sms received but it crashes after its work is completed showing "Unfortunately, your app has stopped responding..". Here is my manifest and receiver.java file My manifest file <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.hide" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.RECEIVE_SMS"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.example.hide.Info" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.example.hide.Help" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.example.hide.Next" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.provider.Telephony.SMS_RECEIVED"/> <action android:name="android.media.RINGER_MODE_CHANGED"/> MYReceiver.java public class MyReceiver extends BroadcastReceiver{ LocationManager lm; LocationListener locationListener; String sender; @Override public void onReceive(Context context, Intent intent) { SmsMessage[] sms = null; Bundle b = intent.getExtras(); String str = " SMS From "; if (b != null) { Object[] pdus = (Object[]) b.get("pdus"); sms = new SmsMessage[pdus.length]; for (int i = 0; i < sms.length; i++) { sms[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); if (i == 0) { sender += sms[i].getOriginatingAddress(); str += ":"+sms[i].getMessageBody().toString(); if (sms[i].getMessageBody().equals("Ring")) { AudioManager am = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); int maxVolume = am.getStreamMaxVolume(AudioManager.STREAM_RING); am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); am.setStreamVolume(AudioManager.STREA…
tagged with: java
type: Question
tagged with: crash
has comment: http://stackoverflow.com/comment/36752008
has comment: http://stackoverflow.com/comment/36751687
score: 0
has comment: http://stackoverflow.com/comment/36751724
has comment: http://stackoverflow.com/comment/36751391
has comment: http://stackoverflow.com/comment/36751651
has comment: http://stackoverflow.com/comment/36751825
has comment: http://stackoverflow.com/comment/36850070
has title: android application working but crash after work done
type: UnansweredQuestion

http://stackoverflow.com/comment/36650170
type: QuestionComment
has text: Then you have something wrong in your setup.
comment on: http://stackoverflow.com/q/23789444
score: 0
type: Comment

dynamic-class-creation
type: Tag
tag name: dynamic-class-creation
tags question: http://stackoverflow.com/q/23823551

http://stackoverflow.com/q/23919921
score: 6
tagged with: dependency-management
has comment: http://stackoverflow.com/comment/36839374
has comment: http://stackoverflow.com/comment/36841497
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: ivy
has comment: http://stackoverflow.com/comment/36840657
type: Question
has body: Our project is like an adapter/facade interface for a huge amount of different other libraries. The dependencies are somehow overlapped, sometimes in conflict or sometimes even make project breaks in silence for wrong version of dependencies provide wrong behavior of same interface. We are using Ivy and Ant to do basic dependencies management. What's the best practice to manage dependencies and detect wrong behavior early on?
upvote count: 6
has comment: http://stackoverflow.com/comment/36837381
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36840150
has answer: http://stackoverflow.com/a/23922505
accepted answer: http://stackoverflow.com/a/23922505
has title: Best practice for dependency management in a project with a huge number of dependencies

http://stackoverflow.com/comment/36696448
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23846411
has text: Post here your checkbalance and withdrawal methods

http://stackoverflow.com/a/38155930
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23810846
upvote count: 4
has body: You need set a authenticationManagerBean for your extended filter and config it corr @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Bean public ExUsernamePasswordAuthenticationFilter exUsernamePasswordAuthenticationFilter() throws Exception { ExUsernamePasswordAuthenticationFilter exUsernamePasswordAuthenticationFilter = new ExUsernamePasswordAuthenticationFilter(); exUsernamePasswordAuthenticationFilter .setAuthenticationManager(authenticationManagerBean()); return exUsernamePasswordAuthenticationFilter; } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(HttpSecurity http) throws Exception { RequestMatcher requestMatcher = new RequestMatcher() { @Override public boolean matches(HttpServletRequest httpServletRequest) { if (httpServletRequest.getRequestURI().indexOf("/api", 0) &gt;= 0) { return true; } return false; } }; http .addFilterBefore(exUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class) ... } }
downvote count: 0

http://stackoverflow.com/comment/36829018
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23915542
has text: You want to get an image bytes in your controller, from a service. So your service method should be declared as `byte[] CapchaString()`. It should return the bytes instead of writing them to a file. Use a MemoryCacheImageOutputStream writing to a ByteArrayOutputStream rather than a FileImageOutputStream, then return the ByteArrayOutputStream's bytes.
score: 0

http://stackoverflow.com/q/23900697
has title: How to get the list of all apps on android device using terminal
tagged with: terminal
has body: there is a command line to get package name:- adb shell pm list packages But how to get the list of all applications on the device
has answer: http://stackoverflow.com/a/26876505
type: UnansweredQuestion
tagged with: android
tagged with: adb
score: 16
upvote count: 16
linked to: http://stackoverflow.com/q/2695746
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/70735100
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/43361335
linked to: http://stackoverflow.com/q/12698814
favorite count: 0

http://stackoverflow.com/a/23874441
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36754701
upvote count: 1
has comment: http://stackoverflow.com/comment/36757293
answers question: http://stackoverflow.com/q/23874328
has comment: http://stackoverflow.com/comment/36767502
has comment: http://stackoverflow.com/comment/36750851
has body: You need to run it like this: mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ... Read more in the usage page
score: 1

http://stackoverflow.com/comment/36735716
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23866308
has text: Are you seeing any relevant DEBUG or INFO messages when Jetty is starting up?

http://stackoverflow.com/a/23823410
downvote count: 1
has body: Check the file name. Is it proj.properties or application.properties
score: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23823347

http://stackoverflow.com/comment/36728018
type: QuestionComment
type: Comment
score: 1
has text: I'm assuming that you're running on Linux here, but it could be that while Java is allocating the memory, Linux hasn't given you the memory yet. See: [C program on Linux to exhaust memory](http://stackoverflow.com/questions/1865501/c-program-on-linux-to-exhaust-memory) and [Allocating more memory then there exists](http://stackoverflow.com/questions/19750796/allocating-more-memory-than-there-exists-using-malloc)
comment on: http://stackoverflow.com/q/23860364

http://stackoverflow.com/comment/36793725
type: Comment
comment on: http://stackoverflow.com/a/23896419
has text: OK, now when I select my new branch, the push menu button is disabled in Versioning -> Git -> Push
type: AnswerComment
score: 0

http://stackoverflow.com/q/23936675
has answer: http://stackoverflow.com/a/23937041
tagged with: inputstream
tagged with: properties-file
answer count: 2
has answer: http://stackoverflow.com/a/23936903
tagged with: string
score: 0
accepted answer: http://stackoverflow.com/a/23937041
possible better answer: http://stackoverflow.com/a/23936903
has title: Assigning a destination for properties file in a java program
type: Question
has body: Sorry if this seems like a newbie question and im sure its just a little thing i need to change but it seems like my program cannot locate the destination for a properties file i coded in. here is my code public String metrics() throws IOException { String result = ""; Properties prop = new Properties(); String propFileName = "C:\\Users\\JChoi\\Desktop\\config.properties"; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName); prop.load(inputStream); if (inputStream == null) { throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath"); } // get the property value and print it out String Metrics = prop.getProperty("Metrics"); result = Metrics; System.out.println(result); return result; } I get a nullpointerexception error everytime i run the code but however, when i put the properties file in the resources folder and edit the string name to... String propFileName = "config.properties"; works fine...any suggestions? EDIT: String result = ""; Properties prop = new Properties(); String propFileName = "C:\\Users\\JChoi\\Desktop\\config.properties"; FileInputStream fileInputStream = getClass().getClassLoader().getResourceAsStream(propFileName); prop.load(fileInputStream); SOLVED! String propFileName = "C:\\Users\\JChoi\\Desktop\\googlebatchfile\\config.properties"; BufferedInputStream inputStream; FileInputStream fileInputStream = new FileInputStream(propFileName); inputStream = new BufferedInputStream(fileInputStream);
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36745292
score: 2
type: Comment
type: QuestionComment
has text: this looks like homework..
comment on: http://stackoverflow.com/q/23872099

http://stackoverflow.com/comment/36829256
score: 0
type: Comment
type: QuestionComment
has text: What about Thread.currentThread().sleep(millis);?
comment on: http://stackoverflow.com/q/23915838

http://stackoverflow.com/q/23823076
upvote count: 0
has title: How to read data from a generic list List<T> in java
tagged with: java
possible better answer: http://stackoverflow.com/a/23823920
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/23823166
has body: I have a generic list as shown below. protected List&lt;T&gt; mItems; public ArrayAdapter(final List&lt;T&gt; objects, final boolean copyList) { if (objects != null) { if (copyList) { mItems = new ArrayList&lt;T&gt;(objects); } else { mItems = objects; } } else { mItems = new ArrayList&lt;T&gt;(); } } I want get an integer value at a specific location from mItems. Where mItems contains a objects of a model class. --EDIT-- I don't have access to model class, that's why it is List&lt;T&gt; otherwise I could use List&lt;MyModelClass&gt;
score: -1
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/23823978
downvote count: 1
has answer: http://stackoverflow.com/a/23823920
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23823166
type: AnsweredQuestion

http://stackoverflow.com/comment/36824933
comment on: http://stackoverflow.com/q/23912709
score: 0
type: Comment
type: QuestionComment
has text: Does spring batch provide clustering ?

http://stackoverflow.com/q/23895174
downvote count: 1
type: Question
has body: I have written the Java code to read from one file and write to a new file. The file from which I am reading has 5000 lines of records, but when I am writing to a new file I am able to write only between 4700-4900 records. I think may be I am simultaneously reading from a file and writing to a file, which might be creating a problem. My code is as follows: Reading from a file: public String readFile(){ String fileName = "/home/anand/Desktop/index.txt"; FileReader file = null; try { file = new FileReader(fileName); BufferedReader reader = new BufferedReader(file); String line = ""; while ((line = reader.readLine()) != null) { line.replaceAll("ids", ""); System.out.println(line); returnValue += line + "\n"; } return returnValue; } catch (Exception e) { throw new RuntimeException(e); } finally { if (file != null) { try { file.close(); } catch (IOException e) { // Ignore issues during closing } } } } Writing to a file: public void writeFile(String returnValue){ String newreturnValue = returnValue.replaceAll("[^0-9,]", ""); String delimiter = ","; String newtext =""; String[] temp; temp = newreturnValue.split(delimiter); FileWriter output = null; try { output = new FileWriter("/home/anand/Desktop/newinput.txt"); BufferedWriter writer = new BufferedWriter(output); for(int i =0; i &lt; temp.length ; i++){ writer.write("["+i+"] "+temp[i]); writer.newLine(); } } catch (Exception e) { throw new RuntimeException(e); } finally { if (output != null) { try { output.close(); } catch (IOException e) { // Ignore issues during closing } } } } I need the suggestion to how to simultaneously read and write to a file.
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/23895392
answer count: 2
tagged with: file-io
favorite count: 0
has title: I am not able to write all data to a file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36790021
has comment: http://stackoverflow.com/comment/36790043
has comment: http://stackoverflow.com/comment/36790221
has answer: http://stackoverflow.com/a/23895288
tagged with: java

http://stackoverflow.com/comment/36789699
has text: Okay, I managed to solve the issue by changing the layout_height of the listview to wrap_content although that sparked another problem. My ad now has about 5 pixels of margin space on the right and left and about 15 pixels of margin space from the bottom. How do I fix that?
comment on: http://stackoverflow.com/q/23894986
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23913198
accepted answer of: http://stackoverflow.com/q/23913101
has comment: http://stackoverflow.com/comment/36829354
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36826756
answers question: http://stackoverflow.com/q/23913101
has body: Create a getter and setter for the string url, so you could access it publicly: public String getUrl() { return this.url; } Oh and setter: public void setUrl(String url) { this.url = url; } This follows Java Beans conventions by tightly encapsulating fields to the class, but allowing for the data to be unchangeable, OR changeable in allowing only wanted data. For example you can say that the url can't be longer than 16 characters if you wanted (just as an example): public void setUrl(String url) { if (url.length() &lt;= 16) this.url = url; } which would then prevent a change to the url for anything longer than 16 characters in length. Then you can call it in your test class: @Test public void getUrl_worksWithUrlLessThan16Length() { A test1 = new A(driver); String url = "www.google.com"; A.setUrl(url); assertTrue(A.getUrl().equals(url)); } EDIT: There was a request to show further implementation. As follows: You have two classes, class A and class B. Let's say they're both in their own source code files. So now you have two files that look like this: A.java: public class A { private String url; public A(WebDriver driver){ url = driver.getCurrentUrl(); System.out.println("The current URL is:"+url); Util.wait(5); } public void setUrl(String url) { //THIS IS A SETTER this.url = url; } public String getUrl() { //THIS IS A GETTER return this.url; } } B.java: package com.secondClasses.A; import com.classes.B; public class B { A test1; Webdriver driver; String url2; @BeforeClass public static void Log(){ //some code here to check if log is ok } @Before public void setUp() { driver = new WebDriver(); test1 = new A(driver); } @After public void cleanUp() { driver = null; test1 = null; url2 = null; System.gc(); } @Test public void A(){ url2 = test1.getUrl(); assertTrue(url2.equals(url)); } } There's a few things going on here: You import the class A into class B so you could use it. Create an instance of class A to use. 2a. **(very important point): **Initialize an object refe…
type: AcceptedAnswer

http://stackoverflow.com/q/23809553
has comment: http://stackoverflow.com/comment/36644854
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/36626380
type: AnsweredQuestion
score: 1
tagged with: java
has title: unreachable char array not gc'ed in full gc
has answer: http://stackoverflow.com/a/23810008
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36661561
has comment: http://stackoverflow.com/comment/36661682
accepted answer: http://stackoverflow.com/a/23810008
answer count: 1
has body: In one of our java applications, we are seeing frequent Full GCs. 2 per second. Majority of heap space >90% attributed to char array allocations. On heap dump analysis, all are found to be unreachable under the GC roots but don't seem to be collected by the garbage collector. char arrays are only used in one place in our code in a method scope for IO. We have the default young to tenured ratio (1:3) and default GC algo. I did not alter this, as this application was running fine with 1G heap for a long time and now suddenly even 4G is not sufficing. My biggest pain point is the 90% tenured memory allocated to the char arrays, which should have been ZERO. Does anyone have any clue as to what could be wrong here or leads on how I can debug it further? I seem to be blank at it UPDATE 1: During heap analysis, I could see the largest char arrays, and hence point out exactly in the code where those arrays are being allocated. We are trying to read clobs fron DB, around 100K in size, while in the heap dump, the same arrays are found to be around 100MB in size[I am still delving around this. Will update if I find anything] The reason I am saying these arrays are not reachable beacuse I can see them under the GC roots, under the unreachable heads. Please correct me if there is anything wrong in assuming this. This is the code which is used to read clobs from DB. String readFromRSClobStream(Reader reader, int buffersize) throws Exception { String result=""; char[] buffer=new char[buffersize]; int count=0; while((count=reader.read(buffer))!=-1) { String buffer_str=new String(buffer); result+=buffer_str.substring(0,count); } return result; } The leak suspect view however gives me this The char[] and the String both pertaining to the one's in the above code. P.S. Wish I could share the complete hprof
downvote count: 0
favorite count: 0
tagged with: memory-management
has comment: http://stackoverflow.com/comment/36670338

http://stackoverflow.com/comment/36643781
type: Comment
type: QuestionComment
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)
comment on: http://stackoverflow.com/q/23818526
score: 0

http://stackoverflow.com/a/23863192
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23863133
has comment: http://stackoverflow.com/comment/36748800
answers question: http://stackoverflow.com/q/23863133
has comment: http://stackoverflow.com/comment/36749298
has body: The following will concatenate arrays of same types: String[] both = ArrayUtils.addAll(first, second); Its similar to something like this: ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"] Further details: doc link There are multiple ways of concatenating java arrays efficiently, check this stackoverflow post too to find the best example: stackoverflow post link

http://stackoverflow.com/comment/36649218
comment on: http://stackoverflow.com/a/23820997
type: AnswerComment
score: 0
has text: `I have read the tutorial, but they drive me crazy, because none may put just simple example.` - it is simple and does almost exactly what I described. All you need to do is modify the example to create and publish your TableModel instead of the "FlipPair". Then you add a Thread.sleep() to the loop. In the process() method you then set the model to the table. I really don't know how it gets any easier than that. Of course you actually have to download and run the code first.
type: Comment

http://stackoverflow.com/comment/36684876
has text: You are right. As I said I haven't found a clean solution for getting a unique id. Another thing I haven't looked into yet but may provide some solution is the Google Play licencing.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23839639
type: AnswerComment

http://stackoverflow.com/q/23882128
type: Question
has title: Update ear in web sphere from command line
has comment: http://stackoverflow.com/comment/36775866
answer count: 2
tagged with: websphere
downvote count: 0
favorite count: 0
has body: I have developed an java ear that i deploy from my local eclipse to my local websphere 8.5 by using the publish button in eclipse. When I try to deploy my ear from command line I get an error after I try to access the webpage. I update my ear from common line like this: ${was.dir}/profiles/${was.profile}/bin/wsadmin.sh -lang jython -username ${was.username} -password ${was.password} -c AdminApplication.updateApplicationUsingDefaultMerge('${was.app.name}', '${build.dir}/${ear.name}') The deployment is successful but when I access my application thru my web browser I get the following message instead of seeing my application: Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /wwww/index.html I have verified that the ear is ok by updating it thru the web admin interface of websphere without any configuration. What am I doing wrong or what additional steps do I need to do to successfully update my ear?
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36784979
has answer: http://stackoverflow.com/a/32211341
score: 3
has answer: http://stackoverflow.com/a/31871502
tagged with: java
tagged with: websphere-8
tagged with: eclipse

http://stackoverflow.com/q/23940233
possible better answer: http://stackoverflow.com/a/23940363
has comment: http://stackoverflow.com/comment/36874685
answer count: 3
has answer: http://stackoverflow.com/a/23940363
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36875515
has answer: http://stackoverflow.com/a/23940556
score: 2
type: AnsweredQuestion
upvote count: 2
has title: Why is this program running so slowly?
type: Question
has answer: http://stackoverflow.com/a/23941105
tagged with: performance
has comment: http://stackoverflow.com/comment/36874716
tagged with: java
accepted answer: http://stackoverflow.com/a/23940556
has comment: http://stackoverflow.com/comment/36875273
has body: This is for project euler problem 14. When a number is even, you're supposed to divide the number by two, but when it is odd you multiply it by three and add one. Eventually it should reach one. My task is to find the number that takes the largest amount of steps to get to 1. Here's my code: int currentNum = 0; int iterator = 0; int[] largestChain = new int[]{0,0}; for(int i = 10;i&lt;=1000000;i++) { currentNum = i; iterator = 0; while(currentNum!=1) { iterator++; if(currentNum%2==0) { currentNum/=2; } else { currentNum = (currentNum*3)+1; } } if(iterator&gt;largestChain[1]) { largestChain[0] = i; largestChain[1] = iterator; } } System.out.println("largest iterator:"+largestChain[1]+"for num:"+largestChain[0]); Can you please help me out by telling me what's slowing it down? (It's taking >30 minutes right now and it still hasn't come up with the answer).

http://stackoverflow.com/q/23852922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36709878
score: -2
has comment: http://stackoverflow.com/comment/36710479
has answer: http://stackoverflow.com/a/23853000
has body: I am unable to terminate my java program which takes some strings as input, below is the code I used to process the input import java.util.Scanner; public class EPALIN { public static void main(String[]args) { Scanner sc = new Scanner(System.in); String p = null; while((p=sc.nextLine())!=null) { System.out.println(getPalin(p)); } sc.close(); } public static String getPalin(String st) { int i =0; int j = st.length()-1; String res = ""; while(i&lt;=j) { if(st.substring(i, i+1).equals(st.substring(j, j+1))) { res+=st.substring(i, i+1); i++; j--; } else { res+=st.substring(i,i+1); i++; } } if(res.length()%2==0) return res+(new StringBuffer(res).reverse().toString()); else return res+(new StringBuffer(res).reverse().toString().substring(1)); } } Even using while((p=sc.nextLine())!="") didn't work, its a problem from SPOJ problemId EPALIN
has comment: http://stackoverflow.com/comment/36709441
has comment: http://stackoverflow.com/comment/36709807
tagged with: java.util.scanner
has title: Java program not terminating when using scanner with System.in
has answer: http://stackoverflow.com/a/23853367
tagged with: java
downvote count: 3
upvote count: 1
type: Question
tagged with: eof
has comment: http://stackoverflow.com/comment/36709482
has comment: http://stackoverflow.com/comment/36709424
has comment: http://stackoverflow.com/comment/36709525
answer count: 3
has answer: http://stackoverflow.com/a/23852973
has comment: http://stackoverflow.com/comment/36709949
favorite count: 0

http://stackoverflow.com/comment/36799515
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23888827
has text: I put them in other package and changed the value of basePackages. There wasn't any error displayed on the console, but sessionFactory was null. Don't worry, I have solved it in a different way that I have commented in other answer. Thanks anyway

http://stackoverflow.com/comment/36784138
comment on: http://stackoverflow.com/a/23888993
type: AnswerComment
has text: @Frankcool The question was generic about tool/s and to my point couldn't be answered in just a few lines, this is why I suggested tools as asked and provided a related article describing the usage of one of these tools. A detailed suggested solution would be too big to be included in the answer of such a generic question though...
score: 0
type: Comment

http://stackoverflow.com/q/23815134
has comment: http://stackoverflow.com/comment/36637062
has title: Unable to make an applet work in IntelliJ
score: 0
type: UnansweredQuestion
tagged with: java
has body: I am a complete noob. I am just learning to program using java. I followed a tutorial and created the following applet in IntelliJ Idea in my brother's computer: import javax.swing.JApplet; import java.awt.Graphics; public class MyFirstApplet extends JApplet { public void paint(Graphics g) { g.drawString("To climb a ladder, start at the bottom rung.", 20, 90); } } When i try to run this , the IDE shows: "Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\Abhirup_2\AppData\Local\Temp\AppletPage6525114136327939228.html" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.File.isDirectory(File.java:838) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:82) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at sun.applet.AppletViewer.parse(AppletViewer.java:1103) at sun.applet.AppletViewer.parse(AppletViewer.java:1074) at sun.applet.Main.run(Main.java:156) at sun.applet.Main.main(Main.java:98) at sun.applet.AppletViewer.main(AppletViewer.java:1257) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Process finished with exit code 1 However it runs well in my friend's computer in eclipse. Please help. UPDATE: There is a single account and that is my brother's acoount. I am using that and being the only account it should have admiistrator rights if I am not wrong.
type: Question
tagged with: intellij-idea
tagged with: applet
has answer: http://stackoverflow.com/a/27007038
answer count: 1

http://stackoverflow.com/comment/36825045
score: 1
comment on: http://stackoverflow.com/q/23911857
has text: What is the purpose of this extremely nested set of lists and maps? I feel like there must be a better way to do this.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36758797
score: 0
type: Comment
type: QuestionComment
has text: The file is definitely there, like I said above the command works in windows with the same directory paths nothing has changed.
comment on: http://stackoverflow.com/q/23878861

http://stackoverflow.com/q/23826149
answer count: 3
has comment: http://stackoverflow.com/comment/36658099
has answer: http://stackoverflow.com/a/23826507
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/8957990
linked to: http://stackoverflow.com/q/2721390
tagged with: abstract-class
tagged with: abstract
has answer: http://stackoverflow.com/a/23826378
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23826446
has answer: http://stackoverflow.com/a/23826446
upvote count: 17
type: Question
has body: I am trying to define a abstract Range class which will serve as the base implementation of a number of range classes. The intended use is irrelevant for this question, but so far I have: /** * Abstract generic utility class for handling ranges */ public abstract class Range&lt;T extends Number&gt; { // Variables to hold the range configuration private T start; private T stop; private T step; /** * Constructs a range by defining it's limits and step size. * * @param start The beginning of the range. * @param stop The end of the range. * @param step The stepping */ public Range(T start, T stop, T step) { this.start = start; this.stop = stop; this.step = step; } } Now I want to add a constructor with that only takes start and stop, and sets a default step value of 1, no matter what implementation of Number T is (e.g. if T is Integer [one] would have the value 1, and if T is Long [one] would have the value 1L, and so on). I would like something like: protected Range(T start, T stop) { this(start, stop, [one]); } but I can't figure out how so set the value of [one]. Since Java is still fairly new to me, I have tried with: private static final T one = 1; which doesn't work because T is obviously defined in the instantiation of Range.this. Also I have tried: protected static abstract T getOne(); which also doesn't work because T is defined in the instantiation of Range.this plus static and abstract don't work together. I need some way for extending classes to be forced to define the value of [one] no matter what implementation of Number Range is implemented for. Ultimately I would also like to set a zero value as default start, such that I get a constructor that looks like this: protected Range(T stop) { this([zero], stop, [one]); }
accepted answer: http://stackoverflow.com/a/23826378
tagged with: java
tagged with: default-value
score: 17
has comment: http://stackoverflow.com/comment/36657998
has title: Abstract class with default value

http://stackoverflow.com/comment/36790025
has text: I did the same way as u told but still facing the same issue. "App Engine requires Java 1.7 or later."
type: Comment
comment on: http://stackoverflow.com/a/23867415
score: 0
type: AnswerComment

http://stackoverflow.com/a/23851110
upvote count: 1
has comment: http://stackoverflow.com/comment/36706311
has comment: http://stackoverflow.com/comment/36706318
downvote count: 0
answers question: http://stackoverflow.com/q/23851097
type: Answer
score: 1
has body: Change System.out.println(" (^_^) "); to System.out.print(" (^_^) ");

http://stackoverflow.com/comment/36649590
has text: i think most of you guys misunderstood my question so i decided to provide my whole class
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23821406

calibration
tag name: calibration
tags question: http://stackoverflow.com/q/23795090
type: Tag

http://stackoverflow.com/a/23923435
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36844307
accepted answer of: http://stackoverflow.com/q/23923386
answers question: http://stackoverflow.com/q/23923386
type: AcceptedAnswer
has body: Edit (Removed StringTokenizer example) - Since StringTokenizer is apparently "legacy", I would use a Scanner like this - String message = "BOT.command USER_X THIS_IS_A_TIME THIS_IS_A_DATE"; String user = null; String time = null; String date = null; // Use toLowerCase - assuming it's case insensitive. if (message.toLowerCase() .startsWith("bot.command")) { Scanner st = new Scanner(message); if (st.hasNext()) { st.next(); } if (st.hasNext()) { user = st.next(); } if (st.hasNext()) { time = st.next(); } if (st.hasNext()) { date = st.next(); } } System.out.printf( "User = %s, Time = %s, Date = %s\n", user, time, date); Output is User = USER_X, Time = THIS_IS_A_TIME, Date = THIS_IS_A_DATE

http://stackoverflow.com/a/23848394
downvote count: 0
has body: Try this solution, it works fine: IntegerArray class: public class IntegerArray { public final Integer[] array; public IntegerArray(Integer... array) { this.array = array; } @Override public boolean equals(Object o) { if (o instanceof IntegerArray) { return Arrays.equals(this.array, ((IntegerArray) o).array); } return false; } } Test class: public class Test { public static void main(String args[]){ List&lt;IntegerArray&gt; subSet = new ArrayList&lt;IntegerArray&gt;(); subSet.add(new IntegerArray(0,1,2,3,4)); subSet.add(new IntegerArray(0,1,2,3,5)); subSet.add(new IntegerArray(0,0,0,0,0)); //prune this collection by removing an Integer[] IntegerArray elementToRemove = new IntegerArray(0,0,0,0,0); System.out.println( "Before " + subSet.size()); subSet.remove(elementToRemove); System.out.println( "After " + subSet.size()); } }
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36927214
answers question: http://stackoverflow.com/q/23848271

http://stackoverflow.com/comment/36619833
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23806026
has text: try ps.close() after sending data, and then wait response.

http://stackoverflow.com/comment/36730574
has text: We wrap that inline class (or lambda) to some `MethodInvoker` with `converter` ability and call the method using reflection. That's why I need to know actual types to do conversion for provided object before method call
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23863716

http://stackoverflow.com/comment/36603205
score: 0
type: Comment
type: QuestionComment
has text: Can you please verify that you are running with suggested changes on GF and also can you step through the code in a debugger? and post the result.
comment on: http://stackoverflow.com/q/23796268

http://stackoverflow.com/comment/36867854
has text: `Matrix M = new Matrix();` not from static context which is `main` method. In this case we need explicit outer object to create instance of inner class. We could also move `Matrix` outside of `Algorithm` class or make it static.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23936612
type: AnswerComment

http://stackoverflow.com/comment/36796788
type: AnswerComment
has text: @SvelterEagle No, an import is not usually necessary. However, you need to make sure that your classes have a reference to your `AreaDeRectangulo`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23898509

http://stackoverflow.com/comment/36587251
type: AnswerComment
has text: when i used <c:if> instead of <c:choose> it worked properly but when i try <c:choose> it throws exception.y?
type: Comment
comment on: http://stackoverflow.com/a/23788955
score: 0

http://stackoverflow.com/comment/36624764
type: AnswerComment
comment on: http://stackoverflow.com/a/23803267
type: Comment
score: 0
has text: Thanks. Sorry but i need another little explanation. You said that i have to create an interface "PlayerController" with "makeTurn" method. This interface must be implemented by "HumanPlayerController" and "ComputerPlayerController", but human actions are simply clicks on the buttons, there's no logic. So, the "makeTurn" method of the "HumanPlayerController",and the same "HumanPlayerController" what they should do?

http://stackoverflow.com/comment/36758809
comment on: http://stackoverflow.com/a/23878923
score: 0
type: Comment
type: AnswerComment
has text: Add that js myMethodThatCallsTheJsFile() method to your html and there you can happily call your js library function myMethodThatCallsTheJsFile() { var d2OpenAjaxHub = new D2OpenAjaxHub(); }

http://stackoverflow.com/q/23875215
accepted answer: http://stackoverflow.com/a/23875405
has title: java: generic exception does not catch java.net.UnknownHostException
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36751071
has comment: http://stackoverflow.com/comment/36752725
has comment: http://stackoverflow.com/comment/36751258
has comment: http://stackoverflow.com/comment/36755203
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36751041
has comment: http://stackoverflow.com/comment/36788674
tagged with: http
has comment: http://stackoverflow.com/comment/36751556
type: Question
has comment: http://stackoverflow.com/comment/36792570
upvote count: 0
has comment: http://stackoverflow.com/comment/36751163
answer count: 1
score: -3
favorite count: 0
has answer: http://stackoverflow.com/a/23875405
tagged with: exception
has comment: http://stackoverflow.com/comment/36753047
has comment: http://stackoverflow.com/comment/36751228
has body: I have the following code. It's called repeatedly to crawl the web public GetWebPageResult(String htmlCode) //CONSTRUCTORS FOR GetWebPageResults { if(htmlCode!=null) { this.htmlCode=htmlCode; htmlErrorCode=-1; excCode=0; } else { this.htmlCode=null; htmlErrorCode=-1; excCode=UNKNOWN_ERROR; } } public GetWebPageResult(int excCode, int htmlErrorCode) { this.htmlCode=null; this.excCode=excCode; this.htmlErrorCode=htmlErrorCode; } //END CONSTRUCTORS FOR GetWebPageResults static private GetWebPageResult getWebPage(PageNode pagenode) { String result; String inputLine; URI url; int cicliLettura=0; long startTime=0, endTime, openConnTime=0,connTime=0, readTime=0; try { startTime=System.nanoTime(); result=""; url=pagenode.getUri(); //fare qualcosa se getURI è null if(Core.logGetWebPage()) openConnTime=System.nanoTime(); if(url!=null) { HttpURLConnection yc = (HttpURLConnection) url.toURL().openConnection(); //controllare yc if(url.toURL().getProtocol().equalsIgnoreCase("https")) yc=(HttpsURLConnection)yc; yc.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)"); yc.connect(); //controllare il risultato di .connect =&gt; non c'è! al max lancia IOEXC if(checkResponseCode(yc.getResponseCode())==false) return new GetWebPageResult(GetWebPageResult.ERR_BAD_RESPONSE_CODE,yc.getResponseCode()); if(Core.logGetWebPage()) connTime=System.nanoTime(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));//può lanciare IOEXC StringBuffer buffer = new StringBuffer(); while ((inputLine = in.readLine()) != null) { buffer.append(inputLine).append('\n'); cicliLettura++; } result = buffer.toString(); if(Core.logGetWebPage()) readTime=System.nanoTime(); in.close(); yc.disconnect(); if(Core.logGetWebPage()) { endTime=System.nanoTime(); //url.toURL() non è null, controllato prima System.out.println(/*result+*/"getWebPage eseguito in "+(endTime-startTime)/1000000+" ms. Size: "…
has comment: http://stackoverflow.com/comment/36751422
has comment: http://stackoverflow.com/comment/36753181

http://stackoverflow.com/q/23812142
score: -2
has title: Return value from method (in order to use that value in other methods inside the same Class)
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36631061
tagged with: return-value
type: UnansweredQuestion
downvote count: 2
has body: public void run() { moveTest(); } private int moveTest() { while (frontIsClear()) { move(); for (int i = 0; i &lt; 0; i++); } } There is the code, I want to basically count the loop (in order to find the middle point of an straight line, and then store the count into an ' int ' and than use that int (value) in another private method (or public if it needs to). Thanks in advance hope you guys can understand my point ^^
has answer: http://stackoverflow.com/a/23812451
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/36631078
type: Question
has comment: http://stackoverflow.com/comment/36631138
upvote count: 0

http://stackoverflow.com/a/23790780
has comment: http://stackoverflow.com/comment/36592316
has comment: http://stackoverflow.com/comment/36592002
has comment: http://stackoverflow.com/comment/36591087
type: Answer
has comment: http://stackoverflow.com/comment/36591351
has comment: http://stackoverflow.com/comment/36592091
answers question: http://stackoverflow.com/q/23790589
has comment: http://stackoverflow.com/comment/36591845
has body: You have to read the date as a String and then convert it to Date. There are 2 ways you can it (more than 2 but these 2 are the most common ones): Save the number of milliseconds in the properties file, then read the property as a Long and convert it to Date: Date date = new Date(long_value); Save the date formatted: 2014/05/21 and then parse it in your file: How to parse a date? For example: String company1 = prop.getProperty("startDate"); // suppose that compan1 has the value 2014-05-21 DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date result = df.parse(company1); System.out.println(result);
has comment: http://stackoverflow.com/comment/36590987
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23790589
has comment: http://stackoverflow.com/comment/36591320
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36591809

http://stackoverflow.com/q/23830657
has answer: http://stackoverflow.com/a/23830977
has comment: http://stackoverflow.com/comment/36666918
has comment: http://stackoverflow.com/comment/36666668
tagged with: android
has comment: http://stackoverflow.com/comment/36666423
accepted answer: http://stackoverflow.com/a/23830977
has comment: http://stackoverflow.com/comment/36666892
has comment: http://stackoverflow.com/comment/36666269
has comment: http://stackoverflow.com/comment/36667478
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36666750
has comment: http://stackoverflow.com/comment/36666765
type: Question
has comment: http://stackoverflow.com/comment/36666591
has comment: http://stackoverflow.com/comment/36667277
tagged with: java
tagged with: database
has body: I am having problem displaying and inserting data into the android database. I have read through the stackoverflow threads but still cannot correct my errors. Any nice soul here can help me? record.java import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; public class Record extends Activity{ private ListView uGraduateNamesListView; private Button addNewUndergraduateButton; // We need some kind of Adapter to made the connection between ListView UI component and SQLite data set. private ListAdapter uGraduateListAdapter; // We need this while we read the query using Cursor and pass data private ArrayList<Mile> mile; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_record); // Initialize UI components uGraduateNamesListView = (ListView) findViewById(R.id.list); mile = new ArrayList<Mile>(); // For the third argument, we need a List that contains Strings. //We decided to display undergraduates names on the ListView. //Therefore we need to create List that contains undergraduates names uGraduateListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, populateList()); uGraduateNamesListView.setAdapter(uGraduateListAdapter); } public void showAddForm(View v) { Intent addNewUndergraduateIntent = new Intent(this, Add.class); startActivity(addNewUndergraduateIntent); } //We are going to do it in the separate method public List<String> populateList(){ // We have to return a List which contains only String values. Lets create a List first List<Str…
tagged with: runtimeexception
score: 0
has comment: http://stackoverflow.com/comment/36666566
has comment: http://stackoverflow.com/comment/36666911
has title: Error displaying and inserting data from and into android database
answer count: 1

http://stackoverflow.com/q/23838253
tagged with: swing
has title: Problems using images in Java
tagged with: filepath
type: AnsweredQuestion
tagged with: java
tagged with: file
type: Question
possible better answer: http://stackoverflow.com/a/23838285
has answer: http://stackoverflow.com/a/23838296
has answer: http://stackoverflow.com/a/23838285
score: 0
answer count: 3
tagged with: file-io
has body: I'm getting weird path problems even after I've checked them, any clue whats up with this? I checked my error online and apparently its path problem, even though I check the path just before... java.net.URL imgURL = getClass().getResource("/resources/image.gif"); if (imgURL != null) { System.out.println("Working!!"); } else { System.out.println("Couldn't find file: " + "/resources/image.gif"); } JButton submitButton = new JButton(new ImageIcon(getClass().getClassLoader().getResource("/resources/image.gif"))); Output is: Working!! Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(ImageIcon.java:205) at javaapplication17.JavaApplication17.initUI(JavaApplication17.java:38) at javaapplication17.JavaApplication17.&lt;init&gt;(JavaApplication17.java:22) at javaapplication17.JavaApplication17$1.run(JavaApplication17.java:53) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
has answer: http://stackoverflow.com/a/23838301
accepted answer: http://stackoverflow.com/a/23838296

pca
tag name: pca
type: Tag
tags question: http://stackoverflow.com/q/23815084

http://stackoverflow.com/comment/36686662
comment on: http://stackoverflow.com/q/23840977
score: 0
type: Comment
has text: `I need a fully constructed object` - then add the code at the end of the constructor. The actionPerformed() method has nothing to do with constructing an object. You need to first create the object before you can invoke its actionPerformed() method.
type: QuestionComment

http://stackoverflow.com/comment/36791021
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23895693
has text: Your buttons are a part of your fragments layout. You should be finding and setting the click listeners within the fragment

http://stackoverflow.com/a/23802616
type: Answer
answers question: http://stackoverflow.com/q/23802591
downvote count: 0
score: 4
has body: You need String.lastIndexOf(): String imagePath = "/path/to/file/here/file.jpg"; String path = imagePath.substring(imagePath.lastIndexOf('/') + 1);
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23802591
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36613052

http://stackoverflow.com/comment/36697491
comment on: http://stackoverflow.com/q/23842810
score: 0
type: Comment
type: QuestionComment
has text: Those errors are like Old Teutonic to me :). Try passing an uninitialized `String[]` as an argument and giving it the value of `IMAGES`, maybe that will work. Otherwise, wait for someone more expert than me to answer :). Sorry :).

http://stackoverflow.com/a/23899198
has comment: http://stackoverflow.com/comment/36813393
answers question: http://stackoverflow.com/q/23899170
type: Answer
has comment: http://stackoverflow.com/comment/36798052
has comment: http://stackoverflow.com/comment/36797929
has comment: http://stackoverflow.com/comment/36799723
has body: It'll be the account that the Tomcat service is running under. Or, if you're running Tomcat from the command-line or a scheduled task, it's the account running the command-line, or configured in the scheduled task.
score: 0
has comment: http://stackoverflow.com/comment/36798140
has comment: http://stackoverflow.com/comment/36799340

http://stackoverflow.com/comment/36605252
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23798030
has text: java.io.IOException: Cannot run program "i" (in directory "/home/linux/src"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042) at my.mainmenu.MainMenuUI.jButton1ActionPerformed(MainMenuUI.java:171) at my.mainmenu.MainMenuUI.access$000(MainMenuUI.java:18) at my.mainmenu.MainMenuUI$1.actionPerformed(MainMenuUI.java:64)
type: AnswerComment

http://stackoverflow.com/q/23912709
type: Question
has comment: http://stackoverflow.com/comment/36824933
tagged with: java
has comment: http://stackoverflow.com/comment/37089265
has comment: http://stackoverflow.com/comment/36825243
score: 0
has comment: http://stackoverflow.com/comment/36824827
has body: I need to create a Clustered, load balanced batch application which is supposed to run several processes for work format conversions etc. We chose to use Spring, Hibernate and Quartz for implementing this as our team had the knowledge of using Spring and Quartz in RAM Job store earlier. This application has to be load balanced also, so we have to create one parent Quartz job which pulls the information from database about the records that needs to be processed and creates one child job for each record that needs to be processed and stores the information in the database. Then the jobs are triggered to all the instances of the application running and connecting to that database, and so load is also balanced. Every thing looks colorful till this point. When we start using Spring on top of this for Dependency Injection, we are not sure on how to inject the required objects when the jobs are triggered from the database across several machines in the cluster. what are the solutions for this problem ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36825444
tagged with: spring
answer count: 0
tagged with: quartz-scheduler
has title: Dependency Injection when using Spring Quartz and JDBC Store

http://stackoverflow.com/q/23856058
tagged with: hibernate-mapping
has title: how to map one to many mapping within the same table in Hibernate
has answer: http://stackoverflow.com/a/23856865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36716739
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
has comment: http://stackoverflow.com/comment/36716639
answer count: 1
score: 0
has body: I have a table like this: Id int Source VARCHAR Target VARCHAR And I want to query like this: select * from `TestTable` t1 left join `TestTable` t2 on t1.`Target` = t2.`Target` and t1.`Id` &lt;&gt; t2.`Id` So how to code the mapping with java annotation? And how to query with hibernate?

http://stackoverflow.com/a/23926274
type: Answer
answers question: http://stackoverflow.com/q/23925951
has body: Collections have 2 get methods that accept int and Integer with Integer collections, autoboxing is doing some internal magic to use the wrong method (Effective Java) Use explicit boxing or unbox as necessary.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/51150444
type: QuestionComment
has text: Take a look Dave Syer's answer to, "How to add a filter class in Spring Boot?" at http://stackoverflow.com/a/19830906/266531
comment on: http://stackoverflow.com/q/23910489
score: 0
type: Comment

http://stackoverflow.com/comment/36718107
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23857505
type: Comment
has text: unable to find C://user. - Try `System.getProperty("user.home")` to get the use home directory.

http://stackoverflow.com/q/23795218
has title: A good way to manage JLists in Java?
tagged with: jlist
accepted answer: http://stackoverflow.com/a/26366153
answer count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36600022
has comment: http://stackoverflow.com/comment/36599574
has answer: http://stackoverflow.com/a/26366153
type: Question
has body: I have been using this framework for quite some time now, and I figured I should check and make sure that this is a good idea before implementing it into the large-scale Swing application I am working on now. I have two interfaces that are at the root of my system: public interface Colorable { Color getColor(); } public interface Listable { String getListDisplay(); } Then whenever I create a new JList, I create a new ListRenderer: private class ListRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!(value instanceof Listable)) { return this; } if (value instanceof Colorable) { Color c = ((Colorable) value).getColor(); if (c != null) { setForeground(c); } } Listable listable = (Listable) value; setText(listable.getListDisplay()); return this; } } Is this a good way to manage JLists?
score: 0

http://stackoverflow.com/comment/47412154
type: Comment
type: QuestionComment
has text: @merlin2011 That's a totally reasonable thing to do in Java; enums are effectively a static set of instances of a particular class assigned to some helpful name, not just simple numeric values as in other languages. Of course you can abuse this, but it can also make your code much simpler and easier to read.
comment on: http://stackoverflow.com/q/23921860
score: 0

http://stackoverflow.com/comment/36719735
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23858238
has text: What is the purpose of using a `Map` for this? Why not just use an `ArrayList`?

concurrency
tags question: http://stackoverflow.com/q/23824212
tag name: concurrency
tags question: http://stackoverflow.com/q/23906808
tags question: http://stackoverflow.com/q/23830234
tags question: http://stackoverflow.com/q/23888166
tags question: http://stackoverflow.com/q/23893656
tags question: http://stackoverflow.com/q/23800114
tags question: http://stackoverflow.com/q/23837847
tags question: http://stackoverflow.com/q/23906727
tags question: http://stackoverflow.com/q/23897699
tags question: http://stackoverflow.com/q/23889764
tags question: http://stackoverflow.com/q/23786574
tags question: http://stackoverflow.com/q/23818101
tags question: http://stackoverflow.com/q/23881328
type: Tag
tags question: http://stackoverflow.com/q/23783513
tags question: http://stackoverflow.com/q/23786130
tags question: http://stackoverflow.com/q/23812828
tags question: http://stackoverflow.com/q/23889480
tags question: http://stackoverflow.com/q/23888671

completion-service
tags question: http://stackoverflow.com/q/23796960
tags question: http://stackoverflow.com/q/23925424
type: Tag
tag name: completion-service

http://stackoverflow.com/comment/36782928
comment on: http://stackoverflow.com/q/23891382
score: 1
has text: `[{"code":1}][{"Picture_ID":"74","0":"74"}]` is not valid json
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23940588
downvote count: 0
has comment: http://stackoverflow.com/comment/36907744
accepted answer of: http://stackoverflow.com/q/23938276
has body: i suspect data is not available in DB or its failing to retrieve from DB. but any way check this condition before you go for while loop boolean isEmpty = ! rs.first(); and print isEmpty for debugging. so use something like this if(!isEmpty) { while(rs2.next()){ ps.setInt(1, rs2.getInt("NUM_DOSSIER")); ps.setString(2, rs2.getString("INDICE")); ps.setString(3, constitues.getString("OBSERVATIONS")); ps.setInt(4, constitues.getInt("TYPE_CONSISTANCE")); } }
score: 1
answers question: http://stackoverflow.com/q/23938276
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36909572
type: Answer

http://stackoverflow.com/q/23918918
has body: Below is what I tried with ApplicationCOntext and it works fine: ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml"); Employee empl = (Employee)context.getBean("employee"); System.out.println(empl.getName()); The same thing I tried with XMLBeanFactory and it did not worked: XmlBeanFactory factory = new XmlBeanFactory (new ClassPathResource("spring-context.xml")); Employee obj = (Employee) factory.getBean("employee"); System.out.println(obj.getName()); Employee.java @Component public class Employee { @Value(value="XXX") private String name; public String getName() { return name; } } Below is the xml file entry: &lt;context:component-scan base-package="com.XXX" /&gt; Please advise why does XMLBeanFactory approach does not work.
has answer: http://stackoverflow.com/a/23919095
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23919095
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: working with ApplicationContext but not with XmlBeanFactory
type: Question

http://stackoverflow.com/comment/36710920
comment on: http://stackoverflow.com/q/23853691
score: 0
type: Comment
type: QuestionComment
has text: HashMap doesn't maintain the insertion order.

http://stackoverflow.com/a/23859423
answers question: http://stackoverflow.com/q/23859391
has body: No, since you're binding the value to a parameterized query, your code will not cause an SQL injection opportunity. An SQL injection is usually caused by not parameterizing the query but building it and adding parameters using string concatenation.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23859391

http://stackoverflow.com/q/23799110
tagged with: tomcat
answer count: 1
downvote count: 0
favorite count: 0
has body: My system suffers from OOM (presumably due to a DOS attack). I'm using Tomcat 7, NIO. I'm looking for ways to make my system more robust to these attacks (although I don't expect to make Tomcat completely immune - I want to improve robustness as much as possible). My logs show: Exception in thread "http-nio-8080-exec-285" Exception in thread "http-nio-8080-exec-82" SEVERE:Memory usage is low, parachute is non existent, your system may start failing. Exception in thread "PoolCleaner[216942577:1400676008859]" SEVERE:Memory usage is low, parachute is non existent, your system may start failing. So I started investigating the oomParachute. The documentation (http://tomcat.apache.org/tomcat-7.0-doc/config/http.html) says very little: (int)The NIO connector implements an OutOfMemoryError strategy called parachute. It holds a chunk of data as a byte array. In case of an OOM, this chunk of data is released and the error is reported. This will give the VM enough room to clean up. The oomParachute represents the size in bytes of the parachute(the byte array). The default value is 1024*1024(1MB). Please note, this only works for OOM errors regarding the Java Heap space, and there is absolutely no guarantee that you will be able to recover at all. If you have an OOM outside of the Java Heap, then this parachute trick will not help. So I'm trying to figure out: Is there really a default like the doc says? If so, why am I getting "parachute is non existent" ? Should I define a parachute? What value should I put there? What parameters play a role in determining the value of this parameter? (number of concurrent connections? expected size of request? total heap?) What does this parachute really do? Thanks!
tagged with: out-of-memory
has answer: http://stackoverflow.com/a/25834148
type: UnansweredQuestion
score: 13
upvote count: 13
has title: Tomcat oomParachute: how to configure correctly
tagged with: java
type: Question
tagged with: configuration

http://stackoverflow.com/comment/36652253
comment on: http://stackoverflow.com/a/23823152
type: Comment
has text: This should be the accepted answer. @user3593948: you can solve this (for example) by passing an instance of your class to the actionlistener and calling some method on this instance so that you enforce the check to be made again
score: 0
type: AnswerComment

http://stackoverflow.com/a/23888872
answers question: http://stackoverflow.com/q/23888499
score: 0
has body: i think the error saty on line: myListOverlay = new ListOverlay(); myOverlayItems = myListOverlay.getOverlayItems(); Why you need to recreate the overlay? Advice: write on GoogleMaps V2 is easier!
type: Answer
has comment: http://stackoverflow.com/comment/36777955

http://stackoverflow.com/a/23935801
score: 1
answers question: http://stackoverflow.com/q/23935276
upvote count: 1
has body: If you read MVC wiki - http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller - you will see there is no concept of MVC Model 1 OR MVC1 pattern OR MVC Model 2 OR MVC2, only the concept of the MVC pattern. When you develop JSP application. For simple applications, you can use way 1 (Article call Model 1) that JSP page not only contains the display elements to output HTML, but is also responsible for extracting HTTP request parameters, call the business logic (implemented in JavaBeans, if not directly in the JSP), and handle the HTTP session. Way 1 is not implement MVC pattern because all in JSP page, no decouping. For complex application, you can use way 2 that IMPLEMENT MVC pattern ( Article call MVC - Model 2 - This name has word is MVC because Model 2 implement MVC pattern). Way 2 ( MVC implementation) help us decouping between View and business logic processing (Controller), between view and model.
type: Answer
downvote count: 0

http://stackoverflow.com/a/23821787
score: 0
has comment: http://stackoverflow.com/comment/36650519
has body: Just add this in your public void actionPerformed(ActionEvent e) method st = con.createStatement(); full code: public class ListModelExample extends JPanel { JList list; DefaultListModel model; Connection con; public ListModelExample() { setLayout(new BorderLayout()); model = new DefaultListModel(); list = new JList(model); JScrollPane pane = new JScrollPane(list); JButton addButton = new JButton("View Definition"); ResultSet rs; Statement st = null; try { File dbFile = new File("executive_db.accdb"); String path = dbFile.getAbsolutePath(); con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ= " + path); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); st = con.createStatement(); } catch (Exception e) { JOptionPane.showMessageDialog(null,"Failed to Connect to Database","Error Connection", JOptionPane.WARNING_MESSAGE); System.exit(0); } try { model.clear(); rs=st.executeQuery("select Metric_Name from Metrics"); while (rs.next()) { model.addElement(rs.getString("Metric_Name")); } } catch (Exception e) { System.out.println("Error in fetching data"); } addButton.addActionListener(new ActionListener() { Statement st; public void actionPerformed(ActionEvent e) { String def = ""; st = null; try { model.clear(); st = con.createStatement(); System.out.println("came here"); ResultSet rs=st.executeQuery("select Metric_Name from Metrics where Metrics.Metric_Name='NAA'"); System.out.println("came here too"); while (rs.next()) { def = rs.getString("Metric_Name"); System.out.println(def); // model.addElement(rs.getString("Metric_Name")); } } catch (Exception e1) { System.out.println("Error in fetching data"+e1); } System.out.println(def); JOptionPane.showMessageDialog(null, def, "Error", JOptionPane.ERROR_MESSAGE); /* model.addElement("Element " + counter); counter++;*/ } }); add(pane, BorderLayout.NORTH); add(addButton, BorderLayout.WEST); } public static void main(String s[]) { JFrame frame = new JFrame("List of Metrics used"); frame.…
has comment: http://stackoverflow.com/comment/36650578
type: Answer
answers question: http://stackoverflow.com/q/23821442
has comment: http://stackoverflow.com/comment/36650201

http://stackoverflow.com/a/23801161
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23795458
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23795458
has body: I have resolved such a problem using Hibernate Result Transformer functionality. You just need to extend SQL query in the next way: select RES1 as PROP1, RES2 as PROP2 from Table (select sp_MyProcedure(?) from dual) And then create result POJO: class MyProcRes { public String getPROP1() {} public void setPROP1(String prop1) {} // same for PROP2 + constructors default and one with props } And finally you can apply result transformation to the results of the query: List&lt;MyProcRes&gt; res = session.createSQLQuery(query).setResultTransformer( Transformers.aliasToBean(MyProcRes.class) ).list(); And you will get all fields initialized in MyProcRes objects.

http://stackoverflow.com/comment/36803936
has text: *"8 spaces instead of 4"* Aha! *"(after) don't skip a line* Got it. Thank you. :)
type: Comment
comment on: http://stackoverflow.com/a/23901620
score: 0
type: AnswerComment

http://stackoverflow.com/a/23913738
answers question: http://stackoverflow.com/q/23913410
type: Answer
has body: Use the parse method of SimpleDateFormat: SimpleDateFormat format = SimpleDateFormat("YYYYMMddkm"); format.parse(string, pos);
score: 0

http://stackoverflow.com/comment/51193761
type: Comment
comment on: http://stackoverflow.com/a/23814989
has text: How is PDFbox used? I'm new to this concept but have no idea where to begin. I've downloaded the jar file but double clicking it doesnt work.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36868678
comment on: http://stackoverflow.com/q/23936945
has text: "*It beats all the cases apart from one*" > What does this mean?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23850157
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23855997
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23855997
tagged with: parse-platform
has body: I am trying to implement a system where users can store objects in Parse. I am also trying to add ACLs to said objects to ensure that they are only readable/writable by a particular user. My problem is that when I do a query, while logged in as a user, none of their ACL-restricted objects are returned. ParseQuery&lt;MyObject&gt; query = ParseQuery.getQuery("MyObject"); query.whereEqualTo("owner", ParseUser.getCurrentUser()); query.findInBackground(new FindCallback&lt;MyObject&gt;() { @Override public void done(List&lt;MyObject&gt; objects, ParseException e) { if (e == null) { //Yay! } else { //Aww... } } }); The list of objects does not contain any ACL objects. The ACL for each object looks like this: { "&lt;user&gt;": { "write":true, "read":true } } I have verified that the logged in user is the same as the ACL user. What am I missing here?
tagged with: android
tagged with: acl
tagged with: java
has title: Parse.com: ParseQuery not finding ACL'd objects (Android)
type: Question

http://stackoverflow.com/a/25961951
type: Answer
has comment: http://stackoverflow.com/comment/53095315
has comment: http://stackoverflow.com/comment/70322501
has body: We've implemented a duplicate() method for streams in jOOλ, an Open Source library that we created to improve integration testing for jOOQ. Essentially, you can just write: Tuple2&lt;Seq&lt;A&gt;, Seq&lt;A&gt;&gt; duplicates = Seq.seq(doSomething()).duplicate(); Internally, there is a buffer storing all values that have been consumed from one stream but not from the other. That's probably as efficient as it gets if your two streams are consumed about at the same rate, and if you can live with the lack of thread-safety. Here's how the algorithm works: static &lt;T&gt; Tuple2&lt;Seq&lt;T&gt;, Seq&lt;T&gt;&gt; duplicate(Stream&lt;T&gt; stream) { final List&lt;T&gt; gap = new LinkedList&lt;&gt;(); final Iterator&lt;T&gt; it = stream.iterator(); @SuppressWarnings("unchecked") final Iterator&lt;T&gt;[] ahead = new Iterator[] { null }; class Duplicate implements Iterator&lt;T&gt; { @Override public boolean hasNext() { if (ahead[0] == null || ahead[0] == this) return it.hasNext(); return !gap.isEmpty(); } @Override public T next() { if (ahead[0] == null) ahead[0] = this; if (ahead[0] == this) { T value = it.next(); gap.offer(value); return value; } return gap.poll(); } } return tuple(seq(new Duplicate()), seq(new Duplicate())); } More source code here Tuple2 is probably like your Pair type, whereas Seq is Stream with some enhancements.
has comment: http://stackoverflow.com/comment/53100514
upvote count: 9
answers question: http://stackoverflow.com/q/23860533
has comment: http://stackoverflow.com/comment/53102115
has comment: http://stackoverflow.com/comment/53100092
has comment: http://stackoverflow.com/comment/53099558
downvote count: 0
has comment: http://stackoverflow.com/comment/70334918
score: 9

http://stackoverflow.com/a/23913730
score: 0
type: Answer
has body: The Problem is, that you are trying to update the UI-Thread from a Non-UI-Thread. You could try as following (not tested): public void onClick(View v) { new Thread(new Runnable() { public void run() { msgTextField.post(new Runnable() { //&lt;-- This instead of your setText(); public void run() { mImageView.setText(""); } }); } }).start(); } References: Android Developers Developers.Android.com Update UI from Thread How to set text of text view in another thread
answers question: http://stackoverflow.com/q/23913381

http://stackoverflow.com/comment/36648690
score: 0
type: QuestionComment
type: Comment
has text: are you mixing a question on ThreadPools? http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html
comment on: http://stackoverflow.com/q/23820480

http://stackoverflow.com/a/43930775
answers question: http://stackoverflow.com/q/23849364
has body: Contours of this image will be double lines due to the thickness of the outline and text. For example to get the contours (outline) of the green box, use convert HetI7.jpg -fuzz 20% -fill white +opaque green1 -morphology edgeout diamond:1 -negate green_outline.png But perhaps you just want the green box and not its outline. convert HetI7.jpg -fuzz 40% -fill white +opaque green1 green_region.png
score: 0
type: Answer

http://stackoverflow.com/q/23817966
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/23817988
has comment: http://stackoverflow.com/comment/36642428
has title: Update a Java Class so that a List can Accept Any Type
has body: I have the following class: public class MyList { private List&lt;X&gt; list = new ArrayList&lt;X&gt;(); public List&lt;X&gt; getList() { return list; } public void setList(List&lt;X&gt; list) { this.list = list; } } I want this class to be able to handle lists of types other than "X". For example, what if I wanted it to be able work with Lists of Y? I don't currently know all the types that I may need to handle, so it should be able to handle any types.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36642444
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23817988
has comment: http://stackoverflow.com/comment/36644281

http://stackoverflow.com/q/23916926
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: FileSystemResource as ResponseBody in spring rest controller gives ClassCastException
type: Question
has body: I have defined a controller which serves local content like this: @RequestMapping(value = PATH_CONTENT, method = RequestMethod.GET) @ResponseBody public ResponseEntity&lt;FileSystemResource&gt; getContent( @PathVariable(URI_PATH_PARAM_CONTAINER_UID) String containerUid, @PathVariable(URI_PATH_PARAM_DOC_UID) String docUid) { ... } In the client side: I am adding ResourceHttpMessageConverter to RestTemplate messageConverters. When I finally make the following call: ResponseEntity&lt;FileSystemResource&gt; response = getMyRestClient() .getContent(url, null, FileSystemResource.class); FileSystemResourcecontent = response.getBody(); This produces a ClassCastException saying it cant cast ByteArrayResource to FileSystemResource. I can do some modification to my code to return a Resource instead of FileSystemResource and things will work. But I am really wondering why is this exception? I also don't want to take the path of writing to HttpServletResponse directly as I want to use Spring's HttpMessageConverter framework.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36964449
has comment: http://stackoverflow.com/comment/36964490
tagged with: rest
type: UnansweredQuestion
tagged with: spring-mvc

http://stackoverflow.com/a/30419437
score: 0
type: Answer
has body: public int maxBlock(String str) { int max = 0; for(int i = 0 ; i &lt; str.length() ; i ++ ) { char compareChar = str.charAt(i); int count = 0; while (i + 1 &lt; str.length() &amp;&amp; compareChar == str.charAt(i+1)) { i++; count ++; } if (max &lt; count + 1) { max = count + 1; } } return max; }
answers question: http://stackoverflow.com/q/23936945

http://stackoverflow.com/comment/36800989
has text: @OldCurmudgeon I understand that. But there are some circumstances when a good Thread's sleep is exactly what is required. I'd say that this kind of arbitrary throttling is one such case, but I'm open to being educated. This time, of course, I was mostly trying to ascertain whether this was a homework assignment in which the teacher had said "don't use sleep".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23900494
score: 0

http://stackoverflow.com/q/23871707
type: UnansweredQuestion
has body: I am developping an application with Struts2, Spring, Spring security and Hibernate. I need to use session, I try to define my session with this code: Map session = ActionContext.getContext().getSession();//line 1 session.put("objet",objet);// line2 But it returns an java.lang.NullPointerException (line1) Do you have any idea about this problem? LoginAction.java public class LoginAction extends ActionSupport implements SessionAware, Preparable, AuthenticationSuccessHandler { private UserDetails userDetails; private User userConnecte; private Map session; @Autowired private UserBO userBO; // DI via spring public void setUserBO(UserBO userBO) { this.userBO = userBO; } /** * Getters and setters * @return */ public User getUserConnecte() { return userConnecte; } public void setUserConnecte(User userConnecte) { this.userConnecte = userConnecte; } public User getSession() { return session; } public void setSession(Map session) { this.session = session; } public void prepare() throws Exception { // TODO Auto-generated method stub } public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (!(auth instanceof AnonymousAuthenticationToken)) { this.userDetails = (UserDetails) auth.getPrincipal(); } this.userConnecte = this.userBO.retournerUserByEmail(this.userDetails.getUsername()); this.session = ActionContext.getContext().getSession(); session.put("userConnecte", this.userConnecte); } }
has title: ActionContext.getContext().getSession() and NullPointerException
tagged with: spring
has comment: http://stackoverflow.com/comment/36745135
has comment: http://stackoverflow.com/comment/36744804
tagged with: java
has comment: http://stackoverflow.com/comment/36751491
type: Question
tagged with: session
has comment: http://stackoverflow.com/comment/36744841
tagged with: struts2
score: 0
answer count: 2
tagged with: httpsession
has answer: http://stackoverflow.com/a/23872355
has comment: http://stackoverflow.com/comment/36744753
has answer: http://stackoverflow.com/a/23881451

http://stackoverflow.com/comment/36810109
type: AnswerComment
comment on: http://stackoverflow.com/a/23902431
type: Comment
score: 0
has text: @Vlad-Mihalcea Cascading deletes from the many side is undefined in the JPA spec and is strongly discouraged. Is it not the case for pure hibernate?

encoding
tags question: http://stackoverflow.com/q/23900328
tags question: http://stackoverflow.com/q/23815195
type: Tag
tags question: http://stackoverflow.com/q/23779497
tags question: http://stackoverflow.com/q/23801935
tag name: encoding
tags question: http://stackoverflow.com/q/23852974
tags question: http://stackoverflow.com/q/23798137

http://stackoverflow.com/comment/36898835
comment on: http://stackoverflow.com/a/23937334
has text: Jenkins is better? Ok, I guess I have to continue this installation ([URL](https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins)). So I only need know how to implement it with Artifactory and i finish, not? Thank you very much for your help. https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23925151
has body: All stream and bufferedReader need to be closed my question is what if the stream and bufferedReader is inside a method arguments/parameters need to be closed also? example normal code: InputStream i = entity.getContent(); i.close(); Q: What if its inside an arguments of a method that has been pass only public void doDownload(InputStream i, BufferedReader b) { i.close(); b.close(); } should i also close it even that inputstream and bufferedreader is only an arguments and don't have an Object?
tagged with: java-io
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23925742
has title: Does argument/parameters InputStream need to be closed in android?
favorite count: 0
type: Question
score: 5
tagged with: android
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23925742
upvote count: 5

http://stackoverflow.com/q/23914801
linked to: http://stackoverflow.com/q/14467325
type: AnsweredQuestion
has title: Modules packaging in maven
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23914939
has body: I am using Apache Maven 3.0.4 to build a web service and since I am splitting my web application in different libraries using an Aggregator project I would like to have for all of them a different jar file. I don't know if it is possible but what I would like to do is to package a war that contains all my jars, so I created a parent maven project with his pom.xml and I am including several modules that are generating the jars of my libraries. The normal parent pom.xml is something like this: parent pom Parent child_1 child_2 If I try to have a different packaging I get an error saying: Aggregator projects require 'pom' as packaging There is a clean way to generate a war package including the jar packages of all my modules or a better approach to deploy my war?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23914939
tagged with: maven
tagged with: war

http://stackoverflow.com/comment/36776543
type: Comment
type: AnswerComment
has text: @Peter Lawrey: Tried setting -XX:NewSize=1GB and -XX:NewRatio=3, but it didn't help. See update to original, above. Anything else you can suggest? Tnx.
score: 0
comment on: http://stackoverflow.com/a/23875209

http://stackoverflow.com/comment/36680698
type: Comment
has text: I (AspectJ project lead) just fixed up the bug 435446 and at least for the test case that was included it all works now. The size of an invokedynamic instruction was not set correctly which damaged the local variable table. If you want to try it use the latest dev build from http://eclipse.org/aspectj/downloads.php or the 1.8.1.BUILD-SNAPSHOT from our snapshot maven repo: http://maven.springframework.org/snapshot
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23789393

http://stackoverflow.com/comment/36669477
has text: @OldCurmudgeon Since enum instance constructors are called from the enum class static initializer, your answer does the same thing (albeit indirectly).
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23832081
type: Comment

http://stackoverflow.com/q/23804675
has comment: http://stackoverflow.com/comment/36616850
score: 3
tagged with: jtree
linked to: http://stackoverflow.com/q/14831901
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36618263
has answer: http://stackoverflow.com/a/25511740
has comment: http://stackoverflow.com/comment/36617341
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/23808238
type: UnansweredQuestion
has body: I want to create a very very simple file manager with JTree, but I only saw a very hard code and I want to create this script very clean and simple. Can you help me? How do I List the directories of my computer in JTree?
tagged with: file-management
has comment: http://stackoverflow.com/comment/36617870
tagged with: java
has comment: http://stackoverflow.com/comment/36617811
has title: List files and directories with Jtree and File in Java
has comment: http://stackoverflow.com/comment/36617376
type: Question

http://stackoverflow.com/comment/36805021
has text: @PeterNiederwieser just verified that it does not. Only does the java version.
comment on: http://stackoverflow.com/q/23901666
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23857683
score: 0
has comment: http://stackoverflow.com/comment/36718932
answer count: 1
has title: Playing an Integer/Double Array in Java
has comment: http://stackoverflow.com/comment/36718817
has answer: http://stackoverflow.com/a/23860103
accepted answer: http://stackoverflow.com/a/23860103
tagged with: audio
has body: I'm trying to play an array in a Java program. So far I was able to play byte arrays with the following code: AudioFormat audioFormat = new AudioFormat(samplingFreq, bps, 1, true, true); SourceDataLine sdline = AudioSystem.getSourceDataLine(audioFormat); line.open(audioFormat); sdline.start(); sdline.write(playArray, 0, playArray.length); sdline.drain(); sdline.close(); However, with this I'm only able to play byte arrays since the write method only accepts byte arrays as argument. I want to be able to play 16/32 bits per sample arrays as well. Are there any ways to play integer arrays or even doubles using AudioSystem(or any other class).
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36720288
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36718905
tagged with: arrays

layout
tags question: http://stackoverflow.com/q/23820057
tags question: http://stackoverflow.com/q/23902248
tag name: layout
tags question: http://stackoverflow.com/q/23891814
tags question: http://stackoverflow.com/q/23807567
tags question: http://stackoverflow.com/q/23850680
tags question: http://stackoverflow.com/q/23914170
tags question: http://stackoverflow.com/q/23922110
tags question: http://stackoverflow.com/q/23892716
type: Tag
tags question: http://stackoverflow.com/q/23852151
tags question: http://stackoverflow.com/q/23852107
tags question: http://stackoverflow.com/q/23891952
tags question: http://stackoverflow.com/q/23821529
tags question: http://stackoverflow.com/q/23881651
tags question: http://stackoverflow.com/q/23916134
tags question: http://stackoverflow.com/q/23805885

http://stackoverflow.com/comment/36980220
score: 0
type: Comment
has text: shall we continue in chat ?
comment on: http://stackoverflow.com/a/23900559
type: AnswerComment

http://stackoverflow.com/comment/38070751
has text: Sorry, but flying saucer while supporting HTML 5 does not support automatic table layout which I hoped. I now use a fixed table layout and use JasperReports to create the report, which even looks very nice when exported to Excel.
type: Comment
comment on: http://stackoverflow.com/a/23826153
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36621313
score: 0
type: Comment
type: QuestionComment
has text: What's the output you see and what is expected?
comment on: http://stackoverflow.com/q/23806825

http://stackoverflow.com/q/23893275
answer count: 3
has comment: http://stackoverflow.com/comment/36786330
has answer: http://stackoverflow.com/a/23893341
has answer: http://stackoverflow.com/a/23893617
accepted answer: http://stackoverflow.com/a/23893536
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36786477
has title: The object initialization process
tagged with: java
has body: Here is my class looks like. public class MyFirstClass { private FirstInterface firstInterface; public FirstInterface getFirstInterface() { return firstInterface; } public void setFirstInterface(FirstInterface firstInterface) { this.firstInterface = firstInterface; aMethod() { firstInterface.getMyFunction(); System.out.println(firstInterface); // prints some object value here. { } The interface: public abstract interface FirstInterface { public abstract getMyFunction(); } And the implementation class: public class MyImplClass implements MyFirstClass { } I cannot find a constructor or any other initialization here. Somebody please tell me the different ways, how firstInterface get initialized?
has comment: http://stackoverflow.com/comment/36786294
type: Question
has comment: http://stackoverflow.com/comment/36786596
has comment: http://stackoverflow.com/comment/36786371
upvote count: 0
score: -5
downvote count: 5
has comment: http://stackoverflow.com/comment/36786567
has answer: http://stackoverflow.com/a/23893536
favorite count: 0
possible better answer: http://stackoverflow.com/a/23893617

http://stackoverflow.com/a/35552133
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23915319
has body: In your project folder create or edit proguard.cfg Add this to proguard.cfg -dontoptimize -dontshrink -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose Add to project.properties this: proguard.config=proguard.cfg form console run: ant clean ant release
has comment: http://stackoverflow.com/comment/79275820
score: 2

http://stackoverflow.com/q/23918821
tagged with: gemfire
has body: We already have a cache cluster which uses Gemfire Locking to conflicting work in Synchronous manner but now we need a third cache client/cache peer which will have data but should not participate in Gemfire Locking but have all the latest data which will be used by a external UI application to show data on UI. New Gemfire Client/Peer will reside in UI application.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/31170780
has title: Is there anyway I can have backup peer of Gemfire which can have only read only access to all data?
has answer: http://stackoverflow.com/a/31170780
tagged with: spring-data-gemfire
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/36865807
type: Comment
comment on: http://stackoverflow.com/a/23933660
type: AnswerComment
score: 0
has text: you don't have any suggestions ? plz

http://stackoverflow.com/a/23870193
has body: My suggestion is to use your Entity to pass the parameters. You mentioned you already have Entity classes for the forms, then you should be able to use @ModelAttribute(value=" ")Entity entity to get all the form parameters, and then you pass this entity to your service method as a parameter?
type: Answer
answers question: http://stackoverflow.com/q/23868547
accepted answer of: http://stackoverflow.com/q/23868547
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36784800

http://stackoverflow.com/comment/36869163
comment on: http://stackoverflow.com/q/23932925
has text: I check and I don't get inside while `while(in.hasNextLine())`. But why?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36763229
has text: See also http://stackoverflow.com/questions/23653778/nullpointerexception-accessing-views-in-oncreate
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23872008

http://stackoverflow.com/a/23801669
accepted answer of: http://stackoverflow.com/q/23791921
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23791921
has body: Please use the Java plugin version 2.2.1 that was released to fix this very issue. In version 2.2 if no report is present JaCoCo sets coverage to 0 which provoke the issue you face. Whereas in 2.2.1 if no report is present, coverage is not set.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36766115
comment on: http://stackoverflow.com/a/23882874
type: AnswerComment
has text: nope in that case it will ask the java file to change whole fragment switch statement. I guess its not the prblem
score: 0
type: Comment

http://stackoverflow.com/q/23798167
has title: How to open the camera with more than one button click in Android?
possible better answer: http://stackoverflow.com/a/23798268
tagged with: android
has body: I created camera application in Android. I have created one activity and 3 buttons and 3 image view are included in the same activity. When I have to take snap click on first button that snap will display in first image view, then when I take snap on click second button that snap will display in second image view and same as to third button. When I run my app camera open success fully and take the snap also done but it can't display in image view same as to another buttons also. Here is my code. Here is my Activity Code public class Take_Snap_Page extends Activity { ImageView imgPersonalSnap; ImageView imgAddressProofSnap; ImageView imgPanCardProofSnap; ImageView imgHideBitmap; Button btnPersonal ; Button btnAddress; Button btnPanCard; Button btnSubmitSnap; Bitmap bp; Bitmap bitmap ; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.take_snap); imgPersonalSnap = (ImageView)findViewById(R.id.imagesPersonnalSnap); imgAddressProofSnap = (ImageView)findViewById(R.id.imageAddressProofSnap); imgPanCardProofSnap = (ImageView)findViewById(R.id.imagePanCardproofSnap); imgHideBitmap = (ImageView)findViewById(R.id.imgHide); btnPersonal = (Button)findViewById(R.id.buttonCapture_Personal_Snap); btnPersonal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub open(); imgPersonalSnap.setImageBitmap(bitmap); } }); btnAddress = (Button)findViewById(R.id.buttonCapture_AddressSnap); btnAddress.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub open(); } }); btnPanCard = (Button)findViewById(R.id.buttonCapture_PanCardSnap); btnPanCard.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub open(); } }); } public void open() { Intent intent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 0)…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23798316
accepted answer: http://stackoverflow.com/a/23798316
has answer: http://stackoverflow.com/a/23798268
tagged with: java
type: Question
answer count: 2
score: 0

http://stackoverflow.com/a/23819006
answers question: http://stackoverflow.com/q/23818604
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: C# and Java are both hybrids of interpreted and compiled languages. Java is compiled to Java bytecode, and the JVM runtime interprets it into native instructions. C# is compiled in MSIL (Microsoft Intermediate Language), and the .NET runtime interprets the MSIL into native instructions. Both C# and Java have means of interacting directly with native binaries. Java has the Java Native Interface (JNI), and while .NET doesn't have a particular name for it, .NET applications can interact with native assemblies as well. Since C and C++ compile to native assemblies, it's possible to interface Java or .NET code with the binaries generated from C and C++ code. When you hear about an interpreted language using a native binary, it's usually for one of two reasons, in my experience. The first is because what the native binary does is complex enough that the interpreter's inefficiencies actually make a large difference in performance. Less performance critical code can still be written in interpreted languages without noticeable impacts on overall performance, and the things the interpreted language gives you speed up development and improve quality. (For example, most interpreted languages do memory management automatically.) The other reason is reuse. Many tools (such as database drivers) are provided in native format; providing a wrapper around the native binaries is a simpler, cheaper (and probably more reliable) option than trying to re implement all that code in the interpreted language. Most interpreted languages provide a native interface because these practices are so widely used. There is no officially supported means of interfacing .NET and Java code. They are both interpreted languages, and it's rare to find languages interfacing with any kind of library besides native. Whether it's "too hard" to learn C# is an entirely subjective question and heavily dependent on your current knowledge and experience as well as the scope of the other application and the timeline. A…

http://stackoverflow.com/comment/117143075
comment on: http://stackoverflow.com/a/23921456
score: 0
type: Comment
has text: answered here (related to Android) https://stackoverflow.com/a/66259102/7767664
type: AnswerComment

http://stackoverflow.com/comment/111361984
score: 0
type: Comment
comment on: http://stackoverflow.com/a/62973328
has text: Welcome to Stack Overflow. When adding an answer to a six year old question with an accepted answer it is very important to point out what new aspect of the question your answer addresses. Also code only answers can generally be improved by adding some explanation of how and why they work.
type: AnswerComment

http://stackoverflow.com/a/23808858
has body: I´m trying to email an image using javamail. But I get a FileNotFoundException That is because what you have is not a file. It is an entry in a ContentProvider. Get an InputStream on the content using openInputStream() on ContentResolver. Then, use that with a ByteArrayDataSource instead of a FileDataSource. In theory, that should work, and at least should get you closer to something that works.
answers question: http://stackoverflow.com/q/23808440
accepted answer of: http://stackoverflow.com/q/23808440
score: 2
has comment: http://stackoverflow.com/comment/36627402
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36626681
type: Answer

http://stackoverflow.com/a/23931568
has comment: http://stackoverflow.com/comment/37552015
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37484655
has comment: http://stackoverflow.com/comment/36860497
has comment: http://stackoverflow.com/comment/37004689
has comment: http://stackoverflow.com/comment/37509137
answers question: http://stackoverflow.com/q/23930905
type: Answer
has body: You need to close each file before overwriting out, to ensure its data gets written completely. As currently coded, only the last one gets closed.
accepted answer of: http://stackoverflow.com/q/23930905
has comment: http://stackoverflow.com/comment/37004976
has comment: http://stackoverflow.com/comment/37478951
has comment: http://stackoverflow.com/comment/37004143
downvote count: 0
has comment: http://stackoverflow.com/comment/37515983
score: 1
has comment: http://stackoverflow.com/comment/37001341

http://stackoverflow.com/a/23793346
upvote count: 4
has comment: http://stackoverflow.com/comment/36596414
downvote count: 0
has comment: http://stackoverflow.com/comment/36596014
has comment: http://stackoverflow.com/comment/36596455
has body: Well, you can do something like this (because an array is an Object) - public static int getArrayLength(Object array) { return Array.getLength(array); } public static void main(String[] args) { int[] intArray = { 1, 2, 3 }; String[] stringArray = { "1", "2", "c", "d" }; System.out.println(getArrayLength(intArray)); System.out.println(getArrayLength(stringArray)); } Output is 3 4
has comment: http://stackoverflow.com/comment/36595810
score: 4
answers question: http://stackoverflow.com/q/23793224
has comment: http://stackoverflow.com/comment/36596378
has comment: http://stackoverflow.com/comment/36595871
has comment: http://stackoverflow.com/comment/36596071
has comment: http://stackoverflow.com/comment/85076998
type: Answer

http://stackoverflow.com/comment/125461177
score: 0
type: Comment
has text: @WimDeblauwe Man, I had the same issue, I thought I can use if `bean.equals(referencedAutowiredBean)` and BeanPostProcessor won't work, once I removed the referencedAutowiredBean and used if `beanName.equals(nameOfTheBean)` it started to WORK!
comment on: http://stackoverflow.com/a/23912464
type: AnswerComment

http://stackoverflow.com/comment/36577423
comment on: http://stackoverflow.com/q/23783513
has text: This looks like it could be a bad install; the JVM is complaining that it couldn't read a `.class` file for one of he jdk classes. Have you done anything tricky with regard to installing different JVMs?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23786813
type: Question
tagged with: java
score: -1
has body: I am currently learning JSP. I have a list of fruits with check boxes next to each fruit. I want to show a message or a link once a user select one or more fruit and submits. How could I achieve it? Here is my code.By the way my code is not working... <%@ page language="java" contentType="text/html; charset=US-ASCII" pageEncoding="US-ASCII"%> Insert title here JSP Multiple Checkbox Select your favorite Fruits Mango Apple Grapes Papaya Lychee Pineapple <% String select[] = request.getParameterValues("id"); if (select != null && select.length != 0) { out.println("You have selected: "); for (int i = 0; i < select.length; i++) { out.println(select[i]); } //show message or a link instead of printing } %>
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23787171
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/23786977
has title: Present or show message or a link once a desired operation is done[like checkbox checked] in JSP[Java]
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/q/23863615
has body: Log4j perfectly works in conjunction with my application, but my question is that is there any other ever efficient approach to implementing it rather than having the following "logger" instance in all classes of my application? public Class myClassName{ private static Logger logger = Logger.getLogger("myClassName"); public String myMethod(){ try{ .... }catch (Exception e) { logger.error("Location:MyMethod:" + e.getMessage()); return "failed"; } } }
has answer: http://stackoverflow.com/a/23867208
tagged with: java
has comment: http://stackoverflow.com/comment/36730173
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36730164
has answer: http://stackoverflow.com/a/23869184
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/36730025
has comment: http://stackoverflow.com/comment/36730004
has title: Do I need to have a static instance of Logger in all my classes to implement log4j?
has comment: http://stackoverflow.com/comment/36758715
answer count: 4
has answer: http://stackoverflow.com/a/23863655
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23863667
tagged with: logging

http://stackoverflow.com/comment/36832072
type: Comment
has text: "There is only one row" -- The code you have posted in your question uses `SQLiteDatabase.insert`, so you are doing an INSERT and not an UPDATE. Every call to `waterAmountEnty` or `bucketExpEntry` will create a new row. Use `SQLiteDatabase.update` if that's not what you intended. The `where` string is supposed to have the question mark. The question marks will be replaced by the arguments in `whereArgs`, in order. In this case I've set it up to take a known row ID and use that for the WHERE clause because I assumed (based on your post) that you had multiple rows.
type: AnswerComment
comment on: http://stackoverflow.com/a/23915361
score: 0

http://stackoverflow.com/q/23917280
has comment: http://stackoverflow.com/comment/36831867
answer count: 0
type: UnansweredQuestion
has body: I am using creating a barcode analyzer for android using eclipse and am breaking down the barcode string. However, the following block of code keeps crashing the app appID = istring.substring(0, 4); nep = 4; if (appID != "8110") { couponERROR = 1; } else { if (istring.length() &lt; nep + 1) { couponERROR = 1; couponERROR); } else { coprefixVLI1stString = istring.substring(nep, nep + 1); coprefixVLI1st = Integer.parseInt(coprefixVLI1stString); nep++; I'm fairly new to Java but have experience in objective c. Any help would be greatly appreciated. Thanks
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36831789
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36834391
has title: Parsing Method in Android Crashes
has comment: http://stackoverflow.com/comment/36831872
linked to: http://stackoverflow.com/q/513832
tagged with: android
has comment: http://stackoverflow.com/comment/36832149

http://stackoverflow.com/comment/36705443
type: Comment
type: QuestionComment
has text: I figured it out. I had to add the connector in the library under run, set project configuration, customize, library, add library and then select the driver.
comment on: http://stackoverflow.com/q/23850538
score: 0

http://stackoverflow.com/q/23851737
answer count: 1
has comment: http://stackoverflow.com/comment/36819490
has comment: http://stackoverflow.com/comment/36843391
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/36842891
tagged with: jgrapht
has title: Computing nearest vertex neighbors in a DAG completed by transitive-closure
downvote count: 0
has comment: http://stackoverflow.com/comment/36843415
has comment: http://stackoverflow.com/comment/36843563
has comment: http://stackoverflow.com/comment/36844537
type: Question
has answer: http://stackoverflow.com/a/23923484
accepted answer: http://stackoverflow.com/a/23923484
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36816109
tagged with: java
has comment: http://stackoverflow.com/comment/36821412
tagged with: directed-graph
tagged with: graph-theory
score: 5
has body: Consider a directed graph, like this: Where, (A) initially, the solid black edges are asserted: 0 &rightarrow; {1,3} 1 &rightarrow; {2} 3 &rightarrow; {4} 4 &rightarrow; {2} Then (B) the transitive closure has then been computed to add the following (dashed) edges: 0 &rightarrow; {2,4} 3 &rightarrow; {2} For any vertex in this final graph, how can I efficiently compute the 'immediate' neighbors accessible by some edge which aren't accessible by a different, longer path? The output I want is shown in (A). I am not distinguishing between edges which were asserted (bold) or inferred (dashed). Is there a well-known name to this problem, and is there a straightforward way of achieving this with JGraphT? Thoughts: Perhaps this is possible by using a topological sort of the vertices, e.g. TS = [0,1,3,4,2]. for(i=0, i&lt;TS.len; i++) { var v0 = TS[i] for (j=i+1; i&lt;TS.len; j++) { var v1 = TS[j] if (edge exists v0 -&gt; v1) { var otherPath = false for (k=i+1; k&lt;j; k++) { var v2 = TS[k] if (path exists v0 -&gt; v2 &amp;&amp; path exists v2 -&gt; v1) { otherPath = true break } } if (!otherPath) { record (v0 -&gt; v1) } } } } Basically, I'm thinking that (v0 &rightarrow; v1) is a solution when no other longer path (v0 &rightarrow; ... v2 ... &rightarrow; v1) exists where v0 > v2 > v1 in the topological sort. Does this look correct, and/or is there a more efficient way?

http://stackoverflow.com/comment/88728395
comment on: http://stackoverflow.com/a/29525021
type: Comment
score: 0
has text: If that Unix host has Samba I don't see why not, but I couldn't answer that directly. Our setup was for a Unix host to get information on Windows disks. We used a SSH connection with a special minimal access user and just parsed the output of the "df -Pk" command for disk usage information. For SSH connections, we used JSch ( http://www.jcraft.com/jsch/ ).
type: AnswerComment

http://stackoverflow.com/comment/36584246
type: AnswerComment
comment on: http://stackoverflow.com/a/23787147
score: 0
type: Comment
has text: Thank you, that was indeed part of the problem. To fix it and turn it into an int I parsed the int from the string value of the char. But now, I have another problem - look at the edit.

http://stackoverflow.com/comment/36591805
has text: @ArnaudPotier It is assumed that all items in a commit-interval belong to the same directory. This is 100% sure.
comment on: http://stackoverflow.com/q/23787227
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36665218
comment on: http://stackoverflow.com/q/23829989
score: 0
type: Comment
type: QuestionComment
has text: You already asked a really similar question here: http://stackoverflow.com/questions/23044000/print-all-numbers-in-between-a-set-value-in-an-array I'd vote on closing this question.

http://stackoverflow.com/comment/36803064
score: 0
type: Comment
has text: As i said, i cannot access the list after the the query that is bound to it is CLOSED. Surely when implementing, no one thought that the collection would be accessed after the query is closed, but i found it very useful, if not vital for certain tasks (ex: reports can't use several of these query-lists at the same time if the query is opened, and cannot access ANY of them if the query is closed!). Thanks for all your help.
type: QuestionComment
comment on: http://stackoverflow.com/q/23842571

http://stackoverflow.com/comment/36673745
score: 0
type: Comment
type: QuestionComment
has text: what is your problem here?
comment on: http://stackoverflow.com/q/23834258

http://stackoverflow.com/q/23876775
has answer: http://stackoverflow.com/a/23876809
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23876851
has body: I have this code: MyClass tmp = new MyClass(); tmp.setParam1(1); tmp.SetParam2("Test"); tmp.setParam3("Test"); ... Then I have tmp.heavyCalc(); During this heavy calc operation I have to update progress bar in UI and show user that it's working with update in progress bar and some text to display. Now it doesn't work, because I'm not using thread, app becomes stuck and hanged, then suddenly returns that progressbar is 100% and all text all together appears suddenly. So I decided to make my function to run as new Thread. Inside definition of my class, I added implements Runnable So public class MyClass implements Runnable{ Then I put that heavyCalc() function to be called new Run() function I created: @Override public void Run() { heavyCalc(); } Now I do this: Thread thread = new Thread(tmp); tmp.run(); It works, but still no change at all in UI, app becomes stuck, then suddenly progressbar 100% and app returns. What I'm missing?
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23877467
has answer: http://stackoverflow.com/a/23876806
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/23877467
favorite count: 0
has answer: http://stackoverflow.com/a/23876793
upvote count: 5
answer count: 5
tagged with: multithreading
tagged with: android
has title: Android Run A Function In a Class In New Thread
accepted answer: http://stackoverflow.com/a/23876806

http://stackoverflow.com/comment/36867370
has text: Which import is Lists coming from? Based on this line: return Lists.newArrayList(recordRepository.findAll());
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23936222
type: AnswerComment

http://stackoverflow.com/a/41220585
type: Answer
has body: add or remove fragment in viewpager dynamically. To load different fragment call setupViewPagerCustom(viewPager). e.g. on button click call: setupViewPagerCustom(viewPager); private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new fragmnet1(), "HOME"); adapter.addFrag(new fragmnet2(), "SERVICES"); viewPager.setAdapter(adapter); } private void setupViewPagerCustom(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new fragmnet3(), "Contact us"); adapter.addFrag(new fragmnet4(), "ABOUT US"); viewPager.setAdapter(adapter); } //Viewpageradapter, handles the views static class ViewPagerAdapter extends FragmentStatePagerAdapter { private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;(); private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;(); public ViewPagerAdapter(FragmentManager manager){ super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } @Override public int getItemPosition(Object object){ return PagerAdapter.POSITION_NONE; } public void addFrag(Fragment fragment, String title){ mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position){ return mFragmentTitleList.get(position); } }
answers question: http://stackoverflow.com/q/23888941
score: 0

http://stackoverflow.com/comment/38155851
score: 1
comment on: http://stackoverflow.com/a/24616088
type: AnswerComment
has text: @mvreijn Don't worry, server/port combination is managed. Unfortunately, it's not that clear from documentation. Have a look [here](http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/com/sun/jndi/ldap/pool/Pool.java#l152) and [here](http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/com/sun/jndi/ldap/ClientId.java#l126). `ClientId` takes care of these things in `equals`. Instances of `ClientId` are used as keys in `Pool`'s `Map`.
type: Comment

http://stackoverflow.com/comment/36667156
type: Comment
type: QuestionComment
has text: Have you tried adding an ObjectInputStream instead of ObjectInput into the chain?
comment on: http://stackoverflow.com/q/23830650
score: 0

http://stackoverflow.com/q/23780400
has comment: http://stackoverflow.com/comment/36571472
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36571509
type: Question
has body: I have two objects A &amp; B(which are interrelated) First A is inserted in DB and we get an output result. The result contains a ID which will be then set in Object B and then it will be passed to DB. This is the simple scenario which we can do by getter and setter. But the problem is that if there are five objects of A type and corresponding five objects of B type. So how we can manage them by using java programming. A1 is related to B1 similarly A2-> B2 and so on. And we get an array of Object A and array of object B at same time. How we can combine the objects in java so that there is no confusion such that when we save A2 in DB and the generated ID is being set in B3, which is actually supposed to be set in B2.
score: -1
has comment: http://stackoverflow.com/comment/36571475
has title: Handling of two objects at same time
tagged with: java
has answer: http://stackoverflow.com/a/23780607
answer count: 1
downvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/23825732
has comment: http://stackoverflow.com/comment/55364689
has body: I'm almost sure that this is caused when the thread finish its work but the activity is no longer visible. You should check if the getActivity() call return null, and ... To apply corrections on your code, look at this: // (Calendar) Date function - Displays dateview on Card final boolean keepRunning1 = true; Thread thread_two = new Thread(){ @Override public void run(){ while(keepRunning1){ // Make the thread wait half a second. If you want... try { Thread.sleep(500); } catch (InterruptedException e) { Toast.makeText(getActivity().getApplicationContext(), "Default Signature Fail", Toast.LENGTH_LONG).show(); e.printStackTrace(); } // here you check the value of getActivity() and break up if needed if(getActivity() == null) return; getActivity().runOnUiThread(new Runnable(){ @Override public void run(){ TextView date = (TextView) getView().findViewById(R.id.date); date.setText(DateUtils.formatDateTime(getActivity().getBaseContext(), System.currentTimeMillis(),DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR)); } }); } } };thread_two.start();
answers question: http://stackoverflow.com/q/23825549
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23825549
type: Answer
upvote count: 74
has comment: http://stackoverflow.com/comment/55364252
downvote count: 1
score: 73

instantiation
type: Tag
tags question: http://stackoverflow.com/q/23905312
tags question: http://stackoverflow.com/q/23866825
tag name: instantiation

http://stackoverflow.com/q/23818512
has title: Java plus Operator
tagged with: java
type: Question
answer count: 2
tagged with: assignment-operator
score: 0
has answer: http://stackoverflow.com/a/23818533
tagged with: operators
has body: class ExcerciseLib1 { public static void main(String[] args) { // TODO Auto-generated method stub int x = 1; while (x &lt; 10) { x = x + 1; if (x &gt; 3) { System.out.println("big x"); } if (x &lt; 4) { System.out.println("big 1"); } } } } In the code above, big 1 get's output 2 times, and big x gets output 7 times. I don't quite understand why big x outputs 7 times, shouldn't it be 6 times? I get that if (x &lt; 4) { System.out.println("big 1"); } outputs "big 1" twice because using the loop, x = 1 + 1 equals 2 which is less than 4, x = 2 + 1 equals 3 which is less than 4. So for if (x &gt; 3) { System.out.println("big x"); } Shouldn't the loop only output it 6 times? x = 3 + 1 equals 4, 4 is greater then 3, so output big x. x = 4 + 1 equals 5, 5 is greater than 3, so output big x. x = 5 + 1 equals 6, 6 is greater than 3, so output big x. x = 6 + 1 equals 7, 7 is greater than 3, so output big x. x = 7 + 1 equals 8, 8 is greater than 3, so output big x. x = 8 + 1 equals 9, 9 is greater than 3, so output big x. x = 9 + 1 equals 10; but the loop states x &lt; 10 I'm getting brain stumped on this one. Am I understanding the "x = x + 1" expression wrong?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23818557
has comment: http://stackoverflow.com/comment/36643584

http://stackoverflow.com/comment/36609894
type: Comment
has text: Is it the same to use this? `org.apache.poi.ss.usermodel.Workbook wb = WorkbookFactory.create(input); org.apache.poi.ss.usermodel.Sheet s = wb.getSheetAt(0);`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23800454

http://stackoverflow.com/comment/36985934
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23816738
has text: As a temporary solution, I ended up copying all of the files into a different project without CVS (and named it with a suffix "- Builder"), and it exported as signed with no problem. This is a bit of an inconvenience, as this means I have to manually copy any revised files over to this project anytime I want to build a release.
score: 0

http://stackoverflow.com/a/23781449
accepted answer of: http://stackoverflow.com/q/23781398
answers question: http://stackoverflow.com/q/23781398
has body: C# attributes are more like Java annotations. (I believe that's where Java got the idea.) Marker interfaces are a Java 1.0 construct that are rarely used in new code, if ever. I don't find them to be useful. I would not recommend reviving the practice. Java interfaces should be for separating declaration of method signatures ("what") from implementation ("how"). They should be like C++ pure virtual classes, not attributes or annotations.
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/23827121
score: 0
has title: java regex "^" and "\A" difference
tagged with: regex
has body: I'm new to regex. I try to research it. I am reading following article: http://www.tutorialspoint.com/java/java_regular_expressions.htm snippet from article: ^ Matches beginning of line. and \A Beginning of entire string I don't understand the difference. Can you clarify this ?
favorite count: 0
linked to: http://stackoverflow.com/q/22937618
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23827164
downvote count: 4
answer count: 1
accepted answer: http://stackoverflow.com/a/23827164

http://stackoverflow.com/q/23874154
has body: &lt;ui:repeat value="#{cmsBean.cmsVo.attributesList}" var="attribute"&gt; &lt;ul&gt; &lt;li&gt; &lt;div&gt;"#{attribute.name}"&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/ui&gt; Now I have to create separate lists from attributeList , &lt;ul&gt; based on value of #{attribute.attributeType} , how can I use do it.
tagged with: jsf
upvote count: 2
type: Question
tagged with: primefaces
tagged with: java
has title: creating multiple Ul in ui:repeat manually
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/15726600
favorite count: 0
has answer: http://stackoverflow.com/a/23875269
type: UnansweredQuestion
score: 2

http://stackoverflow.com/q/23838642
favorite count: 0
type: AnsweredQuestion
tagged with: java
has title: Comparing user inputted string to an array variable Java
has answer: http://stackoverflow.com/a/23838678
downvote count: 1
type: Question
tagged with: arrays
score: -1
tagged with: comparison
has body: I've included my program below, basically my question is if I input a surname to allow me to find the student I want to delete how can I compare the inputted string to the surname variable in the array? When I enter the surname and try and compare this to the entries already in the array instead of comparing the surnames it's comparing the inputted string to everything in that instance of it. This is being done in the findStudent method. I think because i'm passing the entire array here surname contains everything I've entered for that student (surname, forename, exam marks). If I try and just pass the surname parameter i'm getting error messages. I've searched to see if this was answered already but all I can find is comparing an inputted string to an array that is already defined not an array created from user input. Any help would be appreciated! Thanks import java.util.Scanner; /** * * @author Connor */ public class Student { //declare student variables private String surname; private String forename; private int mark1, mark2, mark3; private double dblScore; private static String course = "French"; //constructor //=========================================================== // // MODULE : Student // RETURN TYPE : None // PARAMETERS : args : String newForename, String newSurname, int newMark1, int newMark2, int newMark3 // DESCRIPTION : Construct Student object //============================================================ public Student(String newForename, String newSurname, int newMark1, int newMark2, int newMark3) { this.forename = newForename; this.surname = newSurname; this.mark1 = newMark1; this.mark2 = newMark2; this.mark3 = newMark3; this.dblScore = (this.mark1 + this.mark2 + this.mark3) / 3; } //=========================================================== // // MODULE : getCourse // RETURN TYPE : String course // PARAMETERS : args : // DESCRIPTION : get course name //============================================================ public static String getCours…
upvote count: 0
accepted answer: http://stackoverflow.com/a/23838678
answer count: 1

http://stackoverflow.com/comment/36835188
comment on: http://stackoverflow.com/a/23898937
score: 0
type: AnswerComment
type: Comment
has text: Well a hashset is a group of keys. There is no value associated with a key. The only reason you would use a hashset it to be able to efficiently check if a key exists in the said set. You can use the [HashSet](http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html).

http://stackoverflow.com/q/23872046
has title: Clean-up method doesn't get called from window unload in IE9
has comment: http://stackoverflow.com/comment/36746130
has body: When a user closes a browser tab or window the following javascript is called Event.observe(window, 'unload', function(){ alert(WINDOW CLOSING!); methodCleanUp(); } methodCleanUp() invokes an action, via an async request, implemented in java code, not on the web page. The alert is called in all browsers, BUT IE9 doesn't fire the method whereas Mozilla &amp; Chrome are fine - almost as if IE is too eager to close. This didn't happen in the RTM IE9 release, only after installing the security updates Any ideas or advice
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36747309
has comment: http://stackoverflow.com/comment/36745224
tagged with: internet-explorer
answer count: 0
score: 0
tagged with: java
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/36747277

http://stackoverflow.com/comment/36871220
has text: @kerafill Enums are instantiated as soon as the class is loaded.
comment on: http://stackoverflow.com/a/23926660
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23929814
downvote count: 0
has body: you need to in %MYSQL_INSTALL_PATH%/bin folder,using cmd and run: mysqld -nt --skip-grant-tables mysqladmin -u root flush-privileges password "NEW_PASSWORD" and restart mysql service.
type: Answer
answers question: http://stackoverflow.com/q/23929601
score: 1
upvote count: 1

http://stackoverflow.com/a/23939991
downvote count: 0
has comment: http://stackoverflow.com/comment/36874390
has body: Define an object containing your integer and string values, have a single array of that object, sort that array. i.e. class DataElement { final String str; final int i; //Add constructor here } DataElement[] array; // sort this array Note that you will either need to implement Comparable in the DataElement or specify a Comparator to the sort method in order to control the sorting.
answers question: http://stackoverflow.com/q/23939937
score: 4
has comment: http://stackoverflow.com/comment/36874447
type: Answer
upvote count: 4

user-interface
tags question: http://stackoverflow.com/q/23844659
tags question: http://stackoverflow.com/q/23835438
tags question: http://stackoverflow.com/q/23866755
tags question: http://stackoverflow.com/q/23850839
tags question: http://stackoverflow.com/q/23841064
tags question: http://stackoverflow.com/q/23820232
tags question: http://stackoverflow.com/q/23875922
tags question: http://stackoverflow.com/q/23851845
tags question: http://stackoverflow.com/q/23851450
tags question: http://stackoverflow.com/q/23813655
tags question: http://stackoverflow.com/q/23780564
tags question: http://stackoverflow.com/q/23856497
tags question: http://stackoverflow.com/q/23814167
tags question: http://stackoverflow.com/q/23848756
tags question: http://stackoverflow.com/q/23923778
type: Tag
tags question: http://stackoverflow.com/q/23809386
tags question: http://stackoverflow.com/q/23899815
tags question: http://stackoverflow.com/q/23854923
tags question: http://stackoverflow.com/q/23863932
tags question: http://stackoverflow.com/q/23923643
tags question: http://stackoverflow.com/q/23838623
tags question: http://stackoverflow.com/q/23856021
tags question: http://stackoverflow.com/q/23847103
tags question: http://stackoverflow.com/q/23819008
tags question: http://stackoverflow.com/q/23796037
tags question: http://stackoverflow.com/q/23836077
tags question: http://stackoverflow.com/q/23809005
tags question: http://stackoverflow.com/q/23791252
tags question: http://stackoverflow.com/q/23815472
tags question: http://stackoverflow.com/q/23866825
tags question: http://stackoverflow.com/q/23789097
tags question: http://stackoverflow.com/q/23929579
tags question: http://stackoverflow.com/q/23884421
tags question: http://stackoverflow.com/q/23844730
tags question: http://stackoverflow.com/q/23908184
tags question: http://stackoverflow.com/q/23815078
tags question: http://stackoverflow.com/q/23857865
tags question: http://stackoverflow.com/q/23885552
tags question: http://stackoverflow.com/q/23911409
tags question: http://stackoverflow.com/q/23921802
tags question: http://stackoverflow.com/q/23876885
tags question: http://stackoverflow.com/q/23902248
tags question: http://stackoverflow.com/q/23819127
tags question: http://stackoverflow.com/q/23824841
tags question: http://stackoverflow.com/q/23860331
tags question: http://stackoverflow.com/q/23816019
tags question: http://stackoverflow.com/q/23816771
tags question: http://stackoverflow.com/q/23910268
tags question: http://stackoverflow.com/q/23794940
tags question: http://stackoverflow.com/q/23937218
tags question: http://stackoverflow.com/q/23842208
tags question: http://stackoverflow.com/q/23876879
tags question: http://stackoverflow.com/q/23789320
tags question: http://stackoverflow.com/q/23916851
tag name: user-interface
tags question: http://stackoverflow.com/q/23869267
tags question: http://stackoverflow.com/q/23833241
tags question: http://stackoverflow.com/q/23819845
tags question: http://stackoverflow.com/q/23825065
tags question: http://stackoverflow.com/q/23849779
tags question: http://stackoverflow.com/q/23935455
tags question: http://stackoverflow.com/q/23882640
tags question: http://stackoverflow.com/q/23920173
tags question: http://stackoverflow.com/q/23790228
tags question: http://stackoverflow.com/q/23920235

http://stackoverflow.com/q/23829740
type: Question
has comment: http://stackoverflow.com/comment/37098630
answer count: 2
has answer: http://stackoverflow.com/a/24016129
downvote count: 0
has answer: http://stackoverflow.com/a/24037940
favorite count: 0
type: UnansweredQuestion
has body: Hi Apache Mahout Experts, I wrote a simple piece of code which reads a file with input data and creates some clusters. I use version 0.9. I would like to print data inside the clusters. I implemented class CanopyClustering with 3 methods: convertToVectorFile() createClusters() and getClustersInfo() First method, converts file with points to proper format, second method creates cluster and last one prints data to standard output. When I run my code, I can see the following output: DEBUG Groups - Creating new Groups object DEBUG Groups - Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000 DEBUG UserGroupInformation - hadoop login DEBUG UserGroupInformation - hadoop login commit DEBUG UserGroupInformation - using local user:NTUserPrincipal : myname DEBUG UserGroupInformation - UGI loginUser:myname DEBUG FileSystem - Creating filesystem for file:/// DEBUG NativeCodeLoader - Trying to load the custom-built native-hadoop library... DEBUG NativeCodeLoader - Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError: no hadoop in java.library.path DEBUG NativeCodeLoader - java.library.path=C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\MATLAB\R2009b\runtime\win64;C:\Program Files\MATLAB\R2009b\bin;C:\Program Files\TortoiseSVN\bin;C:\Users\myname\Documents\apache-maven-3.1.1\bin;. WARN NativeCodeLoader - Unable to load na…
tagged with: mahout
has title: How to print data from Canopy Clusters in Apache Mahout
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37094533
tagged with: java

http://stackoverflow.com/comment/36742416
comment on: http://stackoverflow.com/q/23870326
type: Comment
type: QuestionComment
score: 1
has text: @RGK What *I* want is an intelligible question in standard English. In this case I also want to know why a clear statement in the Javadoc doesn't satisfy you, and what is so mysterious about releasing resources when you've finished with them.

http://stackoverflow.com/comment/36570778
comment on: http://stackoverflow.com/q/23780038
has text: A class is similar to a struct, so your first option is a possibility. But you could also use an array (`boolean boolArray[] = ...;`), or a `List`/`ArrayList` with the values you want. It really depends on what you want.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23912772
tagged with: java
has comment: http://stackoverflow.com/comment/37003601
tagged with: hama
has comment: http://stackoverflow.com/comment/37000965
tagged with: hadoop
has comment: http://stackoverflow.com/comment/37199245
has title: apache hama installation error on ubuntu 14.04
answer count: 2
has comment: http://stackoverflow.com/comment/36999032
tagged with: apache
has comment: http://stackoverflow.com/comment/37050297
has comment: http://stackoverflow.com/comment/37212613
downvote count: 0
has comment: http://stackoverflow.com/comment/37236019
favorite count: 0
possible better answer: http://stackoverflow.com/a/23914602
accepted answer: http://stackoverflow.com/a/24134389
has comment: http://stackoverflow.com/comment/36986431
has body: i want to install and run the hama using the hama installation guide which use port no 54310 in the whole process, but when i want to run some example on hama it gave me an error. i.e. retrying to connect to server: localhost/ 127.0.0.1:40000 here is my hama-site.xml bsp.master.address localhost The address of the bsp master server. Either the literal string "local" or a host[:port] (where host is a name or IP address) for distributed mode. bsp.system.dir /tmp/hama-hduser/bsp/system The shared directory where BSP stores control files. bsp.local.dir /tmp/hama-hduser/bsp/local local directory for temporal store. hama.tmp.dir /tmp/hama-hduser Temporary directory on the local filesystem. fs.default.name hdfs://localhost:54310 The name of the default file system. Either the literal string "local" or a host:port for HDFS. I have already started HDFS, here is the error message after run the PI example. hduser@ubuntu:/opt/hama$ /opt/hama/bin/hama jar hama-examples-0.6.4.jar pi 14/05/28 05:50:57 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:40000. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS) 14/05/28 05:50:58 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:40000. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS) 14/05/28 05:50:59 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:40000. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS) 14/05/28 05:51:00 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:40000. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS) 14/05/28 05:51:01 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:40000. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS) 1…
has answer: http://stackoverflow.com/a/23914602
has comment: http://stackoverflow.com/comment/37212102
has comment: http://stackoverflow.com/comment/36999438
has comment: http://stackoverflow.com/comment/37211472
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36846256
has comment: http://stackoverflow.com/comment/36999801
score: 1
has comment: http://stackoverflow.com/comment/37004332
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37084980
has comment: http://stackoverflow.com/comment/37038723
has answer: http://stackoverflow.com/a/24134389

http://stackoverflow.com/comment/36666243
type: Comment
type: QuestionComment
has text: @G.Bach I agree. A* search is one BFS (best-first search) algorithm.
comment on: http://stackoverflow.com/q/23830640
score: 0

http://stackoverflow.com/q/23846295
answer count: 5
has answer: http://stackoverflow.com/a/23846329
tagged with: unix
tagged with: android-studio
has answer: http://stackoverflow.com/a/51013793
has title: studio.sh open permission denied for android studio in ubuntu
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26625959
downvote count: 1
has answer: http://stackoverflow.com/a/23858602
type: Question
score: 3
tagged with: java
upvote count: 4
has answer: http://stackoverflow.com/a/61663275
favorite count: 0
tagged with: bash
has body: I downloaded an Android Studio for linux and then tried to run the studio.sh file inside the 'bin' directory as per the instruction said. The terminal showed an error saying something like this: bash: ./studio.sh: permission denied The whole Studio bundle was in .tdz format and I extracted the files before accessing via the terminal. What is the main cause for such error? Thank you so much!

http://stackoverflow.com/q/23849666
answer count: 1
has answer: http://stackoverflow.com/a/23868379
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
downvote count: 3
type: Question
has title: Error Hibernate Spring: Connection refused
has body: I'm having this error when I'm trying to run my code. My spring configuration class: <context:component-scan base-package="com.math"/> <mvc:annotation-driven /> <mvc:default-servlet-handler /> <context:annotation-config /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/game/**" location="/game/" /> <import resource="classpath:*.xml"/> My hibernate configuration xml: <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/mathgame root root 5 org.hibernate.dialect.MySQLDialect thread <!--property name="show_sql">true true</property--> create </hibernate-configuration> And my persistence xml: <!--property name="hibernateProperties"> thread true true true create org.hibernate.dialect.MySQLDialect 5 </property--> <!--bean id="mySessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> false create org.hibernate.dialect.MySQL5Dialect </bean--> <tx:annotation-driven /> And my connection factory class: public class ConnectionFactory { @Autowired private static SessionFactory sessionFactory; public static Session getSessionFactory() { return sessionFactory.openSession(); } } The error: org.omg.CORBA.COMM_FAILURE: Detalhado: 00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No at com.sun.proxy.$Proxy40.connectFailure(Unknown Source) at com.sun.corba.ee.impl.transport.ConnectionImpl.(ConnectionImpl.java:253) at com.sun.corba.ee.impl.transport.ConnectionImpl.(ConnectionImpl.java:276) at com.sun.corba.ee.impl.transport.ContactInfoImpl.createConnection(ContactInfoImpl.java:129) at com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl.beginRequest(ClientRequestDispatcherImpl.java:243) at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.request(ClientDelegateImpl.java:227) at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.is_a(ClientDelegateImpl.java:392) at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.…
score: -3
upvote count: 0

infinite-scroll
tag name: infinite-scroll
type: Tag
tags question: http://stackoverflow.com/q/23816608

http://stackoverflow.com/q/23869028
type: Question
tagged with: java.util.concurrent
has answer: http://stackoverflow.com/a/24022513
has comment: http://stackoverflow.com/comment/37123626
answer count: 2
score: 8
downvote count: 0
has title: In a Java 7+ ForkJoinPool, is it possible to cancel a task and all subtasks?
favorite count: 0
upvote count: 8
has body: My program searches for a solution (any solution) to a problem through a divide-and-conquer approach, implemented using recursion and RecursiveTasks's: I fork a task for the first branch of the division, then recurse into the second branch: if the second branch has found a solution, then I cancel the first branch, otherwise I wait for its result. This is perhaps not optimal. One approach would be for any of the launched tasks to throw an exception if a solution is found. But then, how would I cancel all the launched tasks? Does cancelling a task also cancel all sub-tasks?
type: UnansweredQuestion
tagged with: fork-join
linked to: http://stackoverflow.com/q/21320156
tagged with: java
has answer: http://stackoverflow.com/a/23973780

http://stackoverflow.com/a/23828628
score: 11
downvote count: 1
upvote count: 12
has body: Yes. Take a look e.g. at Goldman Sachs collections. They have a complete reimplementation of the JDK's collection framework (and much more) with an emphasis on low memory footprint. For example, their HashMap doesn't create the Entry objects until they really need to. Look at the documentation here. There's also Javolution, a smaller library with a slightly different purpose - mainly for close-to-realtime and time-predictable classes, this also implies low garbage. If you want to store primitives (which avoids the creation of their wrappers), look at one of these: Trove - the "standard" collections for primitives Goldman Sachs collections, again HPPC - lower level access, often slightly faster than Trove, but enables you to shoot yourself into the foot more easily Koloboke - a Trove fork made by people from OpenHFT. Insanely fast, evolving fast. As of now (September 2014), only Maps and Sets are supported. EDIT 2020: Also see https://github.com/TimeAndSpaceIO/SmoothieMap.
has comment: http://stackoverflow.com/comment/72337414
answers question: http://stackoverflow.com/q/23828425
type: Answer

http://stackoverflow.com/comment/36738904
score: 0
has text: yes "public class LM_Fragment extends Fragment"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23868608

http://stackoverflow.com/comment/36735711
comment on: http://stackoverflow.com/q/23864440
has text: Thank Oleg Estekhin. I am trying to get the tag value from cipher as same as the openssl generated tag.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23813491
has answer: http://stackoverflow.com/a/23859348
accepted answer: http://stackoverflow.com/a/23859348
type: Question
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/36633845
favorite count: 0
upvote count: 5
tagged with: parse-platform
tagged with: android
has title: have menuitem only appear in action bar if ParseUser is viewing own post
has body: Basically I want only a menuitem icon for Edit to show up in the action bar if the current ParseUser is viewing their own post. I figure I could check if their viewing their own post simply by grabbing the current parse user like so (postedBy simply being a string from intent passed from listview activity): ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser.username == postedBy) { } Problem is now how would I make it so only the a icon for Edit in the ActionBar shows up if this is the case, if not then they don't show up. (so others can't edit) Possibly in onOptionsItemSelected? But that wouldn't make sense to me, what would make sense is having it where it's displayed which would be in XML?? Or possibly making two menu XMLS and calling one or the other depending if it's the current users post?
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/23876100
has body: I am using mongodb and facing a problem That I want to select host from URL that are stored in mongodb document (JSON). How can I do that in real time ? What I am currently doing is first updating mongodb record with the host for each record and then after that I do group by on host. For eg. suppose I have url like http://example.com/a/b/c then I update each record with the domain that means example.com(say as host ) then I select host for my group by operation. So basically I want to select the host but without updating each record with host. Is that possible?How? Thanks. Dont know if someone got this or not. So clear example is (as I think), Before update i have this 1. { "url": "http://www.example.com/a/b/c" } After update I make this as 2. { "url": "http://www.example.com/a/b/c", "host":"www.example.com" } So I want to select host without updating document, in my group by query. -----Another Explaination. I have a mongo document as above with just url (pointed as 1 above) So How can I do a group by query on url's host no the url itself. query = new BasicDBObject(); key = new BasicDBObject(); key.put("url", true); DBCursor cursor = table.find(query,key); while(cursor.hasNext()) { System.out.println(cursor.next()); //will print whole url } System.out.println("============Printing only host(domain) from url"); key = new BasicDBObject(); key.put("url", true); cursor = table.find(query,key); while(cursor.hasNext()) { System.out.println(new URL(cursor.next().get("url").toString()).getHost()); //will print only host www.example.com } ` The above code will print the url first and then only host using Cursor. But I want to group by on host(domain of the url) by extracting it somehow. So that's why what i m doing currently, I first do group by on url to get unique url then using URL class of JAVA NET package I get host (using .getHost() method ) for each unique url of my JSON document and update it with the host as I have shown in point (2) above. Now I can easily do grou…
score: 0
has comment: http://stackoverflow.com/comment/36752942
has comment: http://stackoverflow.com/comment/36753972
answer count: 0
type: UnansweredQuestion
has title: Parse and Select mongodb
has comment: http://stackoverflow.com/comment/36753003
tagged with: java
has comment: http://stackoverflow.com/comment/36753856
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/36773968

http://stackoverflow.com/comment/36646332
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23819595
has text: Yeah, those are both in my path. I also tried to run another class (JFreeChart example) that was working on another computer, and it also fails to run giving me the same exception.

http://stackoverflow.com/a/23830536
score: 5
has body: You use JDev in debug mode. The console displays all logs of JDev. (jdev.exe or jdev64.exe on windows) Run this executable to start JDev in normal mode: JDEV_HOME\jdeveloper\jdev\bin\jdevw.exe (or jdev64W.exe if on 64 bit windows) Side note: JDEV_HOME is the location where you installed JDeveloper. The reference documentation: Oracle Jdevlopper Post Install
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23829623
answers question: http://stackoverflow.com/q/23829623
upvote count: 5

http://stackoverflow.com/comment/36856875
comment on: http://stackoverflow.com/q/23930776
has text: Changed to this: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> Still the same error
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36866578
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23935445
type: Comment
has text: My guess is that `manager` object isn't serializable

http://stackoverflow.com/comment/36765396
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23882552
has text: Do you have a webserver on this(192.168.1.200) machine? Is it configured right? Are you able to call the service via a browser?

http://stackoverflow.com/a/59727981
score: 0
has body: Block Disk Auxiliary Cache The Block Disk Cache stores cached values on disk. Like the Indexed Disk Cache, the Block Disk Cache keeps the keys in memory. The Block Disk Cache stores the values in a group of fixed size blocks, whereas the Indexed Disk Cache writes items to disk in one chunk. The Block Disk Cache has advantages over the normal indexed model for regions where the size of the items varies. Since all the blocks are the same size, the recycle bin is very simple. It is just a list of block numbers. Also, the Block Disk Cache will never need to be optimized. Once the maximum number of keys is reached, blocks will be reused. All of the necessary information located at : https://commons.apache.org/proper/commons-jcs/BlockDiskCache.html For the block disk cache, KEYS are stored at Memory. values are stored at disk.
answers question: http://stackoverflow.com/q/23908486
type: Answer

http://stackoverflow.com/a/23780779
score: 0
answers question: http://stackoverflow.com/q/23780544
type: Answer
has body: Your f:selectItems seems incorrect - you haven't specified the items' values or labels. Try &lt;f:selectItems value="#{calendar._years}" var="year" itemLabel="#{year}" itemValue="#{year}" /&gt;

http://stackoverflow.com/comment/36601204
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23796063
has text: Pixels don't have fractions, it's simply not possible. The `Shape` API support which brought fractional parameters was designed for high resolution printing purposes

http://stackoverflow.com/q/23817269
has body: I read interface Map's JavaDoc and it says this: Many methods in Collections Framework interfaces are defined in terms of the equals method. For example, the specification for the containsKey(Object key) method says: "returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k))." This specification should not be construed to imply that invoking Map.containsKey with a non-null argument key will cause key.equals(k) to be invoked for any key k. Implementations are free to implement optimizations whereby the equals invocation is avoided, for example, by first comparing the hash codes of the two keys. (The Object.hashCode() specification guarantees that two objects with unequal hash codes cannot be equal.) My understanding is when containsKey() is invoked, both hashCode() and equals() wil be called, therefore I wrote my own code to test it. HappyDay class will be stored as a key in HashMap, I override hashCode() and equals() methods, and add System.out.println("invoking hashCode()" + this.happyHour); and System.out.println("invoking equals()"); to check whether the method is invoked or not. public class HappyDay { private final int happyHour; public HappyDay(int hh) { this.happyHour = hh; } public int getHappyHour() { return this.happyHour; } @Override public boolean equals(Object o) { System.out.println("invoking equals()"); if (o == null) {return false;} if (o == this) {return true;} //this is an easy overridden, if happy hour equal, objects will be equal. if (o instanceof HappyDay) { HappyDay other = (HappyDay) o; int otherHappyHour = other.getHappyHour(); if (this.happyHour == otherHappyHour) { return true; } } return false; } @Override public int hashCode() { System.out.println("invoking hashCode()" + this.happyHour); int hash = 7; hash = hash + this.happyHour; return hash; } } public class Main { public static void main(String[] args) { Map&lt;HappyDay,String&gt; hm = new HashMap&lt;&gt;(); HappyDay hd1 = new H…
favorite count: 0
has title: Why containsKey() of Map only invoke hashCode()?
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23817397
tagged with: equals
downvote count: 0
has comment: http://stackoverflow.com/comment/36641191
has comment: http://stackoverflow.com/comment/36641449
type: Question
accepted answer: http://stackoverflow.com/a/23817363
tagged with: hashmap
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/23817363
answer count: 2
possible better answer: http://stackoverflow.com/a/23817397

http://stackoverflow.com/a/23793811
accepted answer of: http://stackoverflow.com/q/23792433
downvote count: 0
has comment: http://stackoverflow.com/comment/36604470
score: 1
has body: One of your problems is that your key variables are all local to the showTableData method, and thus are only visible within that method. If you want to use mutator and accessor methods, then make your TableModel a field, and give the class methods to extract data from the model, or add or change data in the model (only through the model's methods though). So: public class SomeClass extends JFrame implements ActionListener { private DefaultTableModel model; public Object getRowData(int row) { if (model != null) { // return row of data from model here } else { // throw some exception } } SomeClass() { //code } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == b1) { showTableData(); } } public void showTableData() { // DefaultTableModel model = new DefaultTableModel(); model = new DefaultTableModel(); // don't re-declare the model here model.setColumnIdentifiers(columnNames); table.setModel(model); You also need to review some basic Java tutorials about accessors/mutators also known as getters/setters. We won't be able to help you much til you understand the rudiments of basic Java first.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23792433
type: Answer

http://stackoverflow.com/a/23814462
has comment: http://stackoverflow.com/comment/36636207
downvote count: 0
has comment: http://stackoverflow.com/comment/36635769
has comment: http://stackoverflow.com/comment/36636082
type: Answer
has comment: http://stackoverflow.com/comment/36636253
upvote count: 1
has body: public static void main(String[] args) { String word = "S]RG-M]P"; char[] a = word.toCharArray(); for (int i = 1; i &lt; a.length-1; i++) {//@Jon Skeet again is right X2 :) //no need now, for loop bound changed //if(i+1&gt;a.length){ // continue; // } if (a[i] == ']') { //no need now, for loop bound changed //@Jon Skeet you are right, this handles the case :) //if(i==0 || i == a.length-1){ //continue; //} a[i + 1] = 'r'; a[i - 1] = 'l'; } } String outt = new String(a); System.out.print(outt); }// main
has comment: http://stackoverflow.com/comment/36651207
score: 1
has comment: http://stackoverflow.com/comment/36636321
accepted answer of: http://stackoverflow.com/q/23814357
has comment: http://stackoverflow.com/comment/36653308
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23814357

http://stackoverflow.com/q/23826792
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36658892
has answer: http://stackoverflow.com/a/23831373
has comment: http://stackoverflow.com/comment/36658935
type: Question
has answer: http://stackoverflow.com/a/23832530
has body: I want to change a date string from YYYY-MM-DD format to DD.MM.YYYY format using regex. Here is my implementation: String date = "2008-12-30"; //30th Dec, 2008 String searchPattern = "(\\d{4})-(\\d\\d)-(\\d\\d)"; //Implementing the Pattern from searchPattern Pattern pattern = Pattern.compile(searchPattern); Matcher matcher = pattern.matcher(date); String newDate = ""; if(matcher.find()) { //Functions newDate = matcher.replaceFirst(matcher.group(3)+"."+matcher.group(2)+"."+matcher.group(1)); //Issue with group text // newDate = matcher.replaceFirst("\3.\2.\1"); } If I use captured groups like \1,\2 etc, the output contains funny text. So, the problem in a nutshell is: matcher.group(1) functions \1 returns funny text
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36658927
favorite count: 0
has comment: http://stackoverflow.com/comment/36658791
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36659660
tagged with: regex
downvote count: 0
has title: Java Matcher groups output issue

string
tags question: http://stackoverflow.com/q/23923386
tags question: http://stackoverflow.com/q/23867424
tags question: http://stackoverflow.com/q/23790589
tags question: http://stackoverflow.com/q/23791751
tags question: http://stackoverflow.com/q/23910989
tags question: http://stackoverflow.com/q/23787035
tags question: http://stackoverflow.com/q/23847882
tags question: http://stackoverflow.com/q/23835271
tags question: http://stackoverflow.com/q/23866256
tags question: http://stackoverflow.com/q/23932722
tags question: http://stackoverflow.com/q/23928937
tags question: http://stackoverflow.com/q/23839782
tags question: http://stackoverflow.com/q/23795757
tags question: http://stackoverflow.com/q/23921658
tags question: http://stackoverflow.com/q/23869613
tags question: http://stackoverflow.com/q/23830987
tags question: http://stackoverflow.com/q/23792743
tags question: http://stackoverflow.com/q/23799381
tags question: http://stackoverflow.com/q/23892525
tags question: http://stackoverflow.com/q/23846063
tags question: http://stackoverflow.com/q/23811693
tags question: http://stackoverflow.com/q/23841560
tags question: http://stackoverflow.com/q/23918795
tags question: http://stackoverflow.com/q/23868957
tags question: http://stackoverflow.com/q/23851668
tags question: http://stackoverflow.com/q/23798211
tags question: http://stackoverflow.com/q/23816739
tags question: http://stackoverflow.com/q/23829844
tags question: http://stackoverflow.com/q/23800148
tag name: string
tags question: http://stackoverflow.com/q/23856710
tags question: http://stackoverflow.com/q/23923414
tags question: http://stackoverflow.com/q/23796496
tags question: http://stackoverflow.com/q/23800194
tags question: http://stackoverflow.com/q/23904391
tags question: http://stackoverflow.com/q/23894791
tags question: http://stackoverflow.com/q/23814357
tags question: http://stackoverflow.com/q/23939467
tags question: http://stackoverflow.com/q/23790423
tags question: http://stackoverflow.com/q/23842357
tags question: http://stackoverflow.com/q/23842810
tags question: http://stackoverflow.com/q/23926312
tags question: http://stackoverflow.com/q/23803730
tags question: http://stackoverflow.com/q/23909689
tags question: http://stackoverflow.com/q/23798655
tags question: http://stackoverflow.com/q/23912560
tags question: http://stackoverflow.com/q/23798564
tags question: http://stackoverflow.com/q/23874230
type: Tag
tags question: http://stackoverflow.com/q/23800848
tags question: http://stackoverflow.com/q/23856703
tags question: http://stackoverflow.com/q/23856148
tags question: http://stackoverflow.com/q/23827302
tags question: http://stackoverflow.com/q/23802591
tags question: http://stackoverflow.com/q/23927618
tags question: http://stackoverflow.com/q/23894792
tags question: http://stackoverflow.com/q/23936675
tags question: http://stackoverflow.com/q/23859431
tags question: http://stackoverflow.com/q/23839111
tags question: http://stackoverflow.com/q/23898066
tags question: http://stackoverflow.com/q/23810276
tags question: http://stackoverflow.com/q/23940672
tags question: http://stackoverflow.com/q/23877580
tags question: http://stackoverflow.com/q/23894842
tags question: http://stackoverflow.com/q/23882242
tags question: http://stackoverflow.com/q/23897305
tags question: http://stackoverflow.com/q/23798262
tags question: http://stackoverflow.com/q/23812764
tags question: http://stackoverflow.com/q/23930290
tags question: http://stackoverflow.com/q/23834689
tags question: http://stackoverflow.com/q/23930471
tags question: http://stackoverflow.com/q/23888326
tags question: http://stackoverflow.com/q/23832593
tags question: http://stackoverflow.com/q/23886788
tags question: http://stackoverflow.com/q/23935958
tags question: http://stackoverflow.com/q/23843805
tags question: http://stackoverflow.com/q/23927192
tags question: http://stackoverflow.com/q/23783550
tags question: http://stackoverflow.com/q/23884914
tags question: http://stackoverflow.com/q/23879154

http://stackoverflow.com/q/23859803
tagged with: runtime
downvote count: 0
has body: I can't understand what's happening here public class UnderstandGC { public class Inner1 { String name=new Inner2().name; public void finalize() { System.out.println("Inner1 -&gt; I am Dead"); } } public class Inner2 { public String name="Inner2"; public void finalize() { System.out.println("Inner2 -&gt; I am Dead"); } } public void finalize() { System.out.println("Main -&gt; I am Dead"); } public static void main(String[] args) { UnderstandGC ugc=new UnderstandGC(); Inner1 inner1=ugc.new Inner1(); //System.out.println("hello"); //1 Runtime.getRuntime().gc(); } } Output expected: Inner2 -&gt; I am Dead bcoz object of Inner2 instantiated as field reference in Inner1 has no local references from the main thread runtime stack. Output Observed: nothing The interesting observation is if I include comment //1 in my code it works fine. Can't understand what's happening.
accepted answer: http://stackoverflow.com/a/23859883
score: 1
tagged with: println
favorite count: 0
has title: Garbage Collector unexpected output
tagged with: garbage-collection
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23859883
tagged with: java
tagged with: output
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23859956
answer count: 2
has answer: http://stackoverflow.com/a/23859956

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/23829509

http://stackoverflow.com/a/23875040
has comment: http://stackoverflow.com/comment/36768446
answers question: http://stackoverflow.com/q/23874271
has body: I don't think that if statements should be unit tested. Anyway, as long as you use new Date() your code won't be testable, because the test result will depend on the day of the week the test is run. (Also, you should not use the deprecated Date.getDate()). I'd split your method into three methods: private void doSomeAction(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); if (cal.get(Calendar.DAY_OF_MONTH) == 1) { doSomeActionForFirstDay(); } else { doSomeActionForOtherDays(); } } public void doSomeActionForFirstDay() { // IMPLEMENT AND TEST THIS ONE } public void doSomeActionForOtherDays() { // IMPLEMENT AND TEST THIS ONE } and test only the second and third method. If you happen to use the idiom doSomeAction(new Date()) a lot in your code, you can always add a fourth method: public void doSomeActionToday() { doSomeAction(new Date()); } and this obviously doesn't need any test. (Or you can look at these ways to manipulate the time read from System.currentTimeMillis())
type: Answer
accepted answer of: http://stackoverflow.com/q/23874271
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/23882995
type: AnsweredQuestion
tagged with: java
has title: Single log file for multiple webapps
type: Question
has body: In my tomcat there are multiple webapps deployed and they communicate with each other. Currently they all have their own log file. But when there is some issue comes from call I have to 1st check with the app to whom I made a call and check log file of respective apps involved in the call. So I want that, as all apps is deployed in same tomcat and sharing a common log4j, if a call made to any app then all logs should be in a single log file and no matters how my webapps are involved all error comes from any webapp during the call should be in a single log file. I have no idea how can I achieve this. So any help is appreciable. Edited: I think my question is not cleared so updated with use case: I have three webapps A, B, C having logs files as A.log, B.log and C.log. I made two calls. 1st one to A (that internally calls C) and 2nd to B (that internally calls C). Now logging of first call must be in A.log (with the logs of every step performed inside the webapp c) and second call must be in B.log (with the logs of every step performed inside the webapp c).
has answer: http://stackoverflow.com/a/23998294
score: 0
has answer: http://stackoverflow.com/a/23883209
answer count: 3
has comment: http://stackoverflow.com/comment/36766710
has answer: http://stackoverflow.com/a/23999104
accepted answer: http://stackoverflow.com/a/23999104
possible better answer: http://stackoverflow.com/a/23998294
tagged with: log4j2
tagged with: logging

http://stackoverflow.com/a/23877659
accepted answer of: http://stackoverflow.com/q/23877491
has body: Code such as this should be put in onPause() and not onDestroy() to be sure it gets called when needed. According to the docs Note: do not count on this method being called as a place for saving data! For example, if an activity is editing data in a content provider, those edits should be committed in either onPause() or onSaveInstanceState(Bundle), not here. This method is usually implemented to free resources like threads that are associated with an activity, so that a destroyed activity does not leave such things around while the rest of its application is still running. There are situations where the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it should not be used to do things that are intended to remain around after the process goes away. You aren't saving data here but the same principle applies. So stopping the recording in onPause() will guarantee the code runs when the user presses the Back button. Overriding onBackPressed() would work too but that wouldn't account for if the Activity went into the background for other reasons.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23877491

ejb
tags question: http://stackoverflow.com/q/23866172
tags question: http://stackoverflow.com/q/23834615
tags question: http://stackoverflow.com/q/23877189
tags question: http://stackoverflow.com/q/23785855
tags question: http://stackoverflow.com/q/23879015
tag name: ejb
tags question: http://stackoverflow.com/q/23929880
tags question: http://stackoverflow.com/q/23856207
tags question: http://stackoverflow.com/q/23846216
tags question: http://stackoverflow.com/q/23919927
tags question: http://stackoverflow.com/q/23877236
tags question: http://stackoverflow.com/q/23931645
tags question: http://stackoverflow.com/q/23838280
tags question: http://stackoverflow.com/q/23843850
tags question: http://stackoverflow.com/q/23919419
type: Tag
tags question: http://stackoverflow.com/q/23877624

http://stackoverflow.com/q/23921731
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33765078
tagged with: nullpointerexception
downvote count: 0
has comment: http://stackoverflow.com/comment/36841108
score: 1
favorite count: 0
type: Question
tagged with: multithreading
tagged with: swt
has body: I have a client and server. Server sends some questions to the Client. In client side I want to display these questions on a SWT application window. I use one thread to show the window and main thread contacts with the Server. After client receives the questions, NullPointerException is thrown in text widget. (writeQuestions method below). I think "q1Txt" is not null because it is initiated in "createContets" method. Besides the arraylist that have question is not null too because I checked it. Can you help me about it? My code is below. public class Client { protected static Shell shell; private static Text q1txt; private static Text q2txt; private static Text q3txt; private static Text q4txt; private static Text q5txt; private static Text ans1txt; private static Text ans2txt; private static Text ans3txt; private static Button ans5YesBtn; private static Button ans4NoBtn; private static Button ans4YesBtn; private static Button ans5NoBtn; private static ArrayList&lt;Integer&gt; ansList = new ArrayList&lt;Integer&gt;(); private static boolean isAnswered = false; static String name; static int socketNum; static Socket socket; public static int l = 4; public static void main(String[] args) throws InterruptedException { new Screen().start(); try { socket = new Socket("", 9898); ObjectOutputStream objOut = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream objIn = new ObjectInputStream(socket.getInputStream()); objOut.writeObject("8080"); ArrayList&lt;String&gt; questions = (ArrayList&lt;String&gt;) objIn.readObject(); writeQuestions(questions); while(!isAnswered) Thread.sleep(2000); socket.close(); } catch (UnknownHostException e) { System.err.println("There is not like this company!"); } catch (IOException e) { System.err.println("Company does not answer!"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void writeQuestions(ArrayList&lt;String&gt; questions){ q1txt.setText(questions.get(0))…
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36840712
has title: SWT NullPointerException

http://stackoverflow.com/comment/36691308
comment on: http://stackoverflow.com/q/23843694
score: 0
type: Comment
has text: Are the objects connected over the network? If so, please provide some more code showing how the connection is established
type: QuestionComment

http://stackoverflow.com/q/23802410
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has body: I'm currently developing a middle level web-app in J2EE using servlets and JSP. It is just like a Content Management System. My website is working very similar according to my needs, but there are some Questions about the best practices and the bad practices for using MVC in J2EE. Code for user to log-in to app is: <c:choose> <c:when test="${not empty sessionScope.admin}"> + Add a Content </c:when> <c:otherwise> Admin Login </c:otherwise> </c:choose> Java code in controller servlet is: if (userDAO.isUser(request.getParameter("uname"), request.getParameter("upass"))) { request.getSession().setAttribute("admin", request.getParameter("uname")); request.getRequestDispatcher("/admin.jsp").forward(request, response); } else { request.getSession().setAttribute("admin", ""); request.getRequestDispatcher("/content.jsp").forward(request, response); } For log-out: Logout Java code in controller servlet is: if (action != null && action.equals("log-out")) { HttpSession session = request.getSession(false); if(session != null){ session.invalidate(); } request.getRequestDispatcher("index.jsp").forward( request, response); } I want to know is above logic for log-in, log-out and session management is correct? And I'm also unable to preventing the user go back to secure page after he is logged-out, how can I set that?
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: session management in servlet jsp
type: Question
tagged with: servlets
has comment: http://stackoverflow.com/comment/36613154
downvote count: 0

http://stackoverflow.com/comment/36715347
has text: After reading your explanation, I went looking for a different point of failure, and found that the check File.exists() always returned false and caused the problem. This is true for any file, regardless of the file's access permission, so I don't think this is a file permission problem, although I haven't tried accessing the file yet. Will update after trying.
comment on: http://stackoverflow.com/q/23855199
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36616663
type: QuestionComment
has text: Thanks, I have corrected the errors.
score: 0
comment on: http://stackoverflow.com/q/23804678
type: Comment

http://stackoverflow.com/comment/36768088
score: 0
type: AnswerComment
type: Comment
has text: Pasting code in comments is really messy, as all formatting is lost. Also there is a character limit in comments. Maybe you can add an edit section in your question and paste it there.
comment on: http://stackoverflow.com/a/23874901

http://stackoverflow.com/a/23871223
score: 6
has body: As @Braj mentioned in comments, you can use static factory. Private constructor cannot be accessed outside of class, but it can be accessed from inside, like the following: public class Test { private Test(){ } static Test getInstance(){ return new Test(); } } This pattern can be used for making Builders, for example.
answers question: http://stackoverflow.com/q/23871173
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/comment/70333174
comment on: http://stackoverflow.com/q/23923443
score: 0
type: Comment
type: QuestionComment
has text: For those who use Jenkins, the Java version could be specified there. If it isn't, it takes a default value.

http://stackoverflow.com/q/23808432
has title: How to upload a file in the google cloud storage using java
answer count: 2
tagged with: file-upload
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/44836828
upvote count: 11
has comment: http://stackoverflow.com/comment/36640883
has comment: http://stackoverflow.com/comment/36648572
tagged with: java
downvote count: 1
type: Question
has body: I have been trying for a long time to upload a file in the Google cloud store using java. By goggling I have found this code, but cant able to understand exactly. Can anyone please customize this one to upload a file in the GCS? // Given InputStream inputStream; // object data, e.g., FileInputStream long byteCount; // size of input stream InputStreamContent mediaContent = new InputStreamContent("application/octet-stream", inputStream); // Knowing the stream length allows server-side optimization, and client-side progress // reporting with a MediaHttpUploaderProgressListener. mediaContent.setLength(byteCount); StorageObject objectMetadata = null; if (useCustomMetadata) { // If you have custom settings for metadata on the object you want to set // then you can allocate a StorageObject and set the values here. You can // leave out setBucket(), since the bucket is in the insert command's // parameters. objectMetadata = new StorageObject() .setName("myobject") .setMetadata(ImmutableMap.of("key1", "value1", "key2", "value2")) .setAcl(ImmutableList.of( new ObjectAccessControl().setEntity("domain-example.com").setRole("READER"), new ObjectAccessControl().setEntity("user-administrator@example.com").setRole("OWNER") )) .setContentDisposition("attachment"); } Storage.Objects.Insert insertObject = storage.objects().insert("mybucket", objectMetadata, mediaContent); if (!useCustomMetadata) { // If you don't provide metadata, you will have specify the object // name by parameter. You will probably also want to ensure that your // default object ACLs (a bucket property) are set appropriately: // https://developers.google.com/storage/docs/json_api/v1/buckets#defaultObjectAcl insertObject.setName("myobject"); } // For small files, you may wish to call setDirectUploadEnabled(true), to // reduce the number of HTTP requests made to the server. if (mediaContent.getLength() &gt; 0 &amp;&amp; mediaContent.getLength() &lt;= 2 * 1000 * 1000 /* 2MB */) { insertObject.getMediaHttpUploader().se…
has answer: http://stackoverflow.com/a/45721973
score: 10
tagged with: google-cloud-storage

http://stackoverflow.com/q/23844265
has comment: http://stackoverflow.com/comment/36692302
tagged with: zooming
has body: Basically, I am new to Java and my guess is that the issue I'm having has a lot to do with the way Java's UI framework is implemented. Here's the catch: I have Implemented a control that allows zooming in and out of a displayed BufferedImage I have an image rendered on a JPanel, the JPanel is contained within a scrollbar. Zooming in\out etc works perfectly. The Scrollbars are rendered correctly on Zoom In and disappear when I zoom out. I want to add the functionality of focusing on a specific quarter of the displayed image via four dedicated buttons, each send an int (1-4) to this method, that controls the scrollbars. public void zoomToQuarter(int i) { double width = (currentBufferedImage.getWidth()*2.2)+1; double height = (currentBufferedImage.getHeight()*2.2)+1; JScrollBar vertical = scrollPane.getVerticalScrollBar(); JScrollBar horizontal = scrollPane.getHorizontalScrollBar(); horizontal.setMaximum((int)width); vertical.setMaximum((int)height); //scrollPane.revalidate(); BufferedImage zoomedImage = ImageUtilities.resizeImage(currentBufferedImage, width, height); renderBefferedImage(zoomedImage); focusedOnSubLocation = true; switch (i) { case(1): vertical.setValue(0); horizontal.setValue(0); break; case(2): vertical.setValue(0); horizontal.setValue(horizontal.getMaximum()); break; case(3): vertical.setValue(vertical.getMaximum()); horizontal.setValue(0); break; case(4): vertical.setValue(vertical.getMaximum()); horizontal.setValue(horizontal.getMaximum()); break; default: break; } } A click on one of the four buttons immediately propagates to this method q1Button = new JButton("Q1"); lowerZoomPanel.add(q1Button); q1Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { sgiImagePanel.pause(); sgiImagePanel.zoomToQuarter(1); sgiImagePanel.revalidate(); sgiImagePanel.repaint(); } }); And resizes the image whilst scrolling the scrollbars accordingly, The method works as expected, but only once I click a button ( any of the four…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36692305
has comment: http://stackoverflow.com/comment/36692364
answer count: 0
has title: JScrollPane does not immediately refresh scrollbars
tagged with: swing
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/36701417
tagged with: java
has comment: http://stackoverflow.com/comment/36692250
has comment: http://stackoverflow.com/comment/36703340
tagged with: jscrollbar
score: 0
has comment: http://stackoverflow.com/comment/36715844

http://stackoverflow.com/comment/36700234
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23847988
has text: @usama8800 do you have any idea about this issue ?
score: 0

http://stackoverflow.com/a/23790235
answers question: http://stackoverflow.com/q/23790173
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23790173
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/36589753
has body: You can do a few point fixes, like checking keepRunning at key points in A's loop. You could also interrupt thread A, which only helps you if it calls any methods that throw InterruptedException. But you can't just have thread A stop dead in its tracks, and for good reason: this would be prone to deadlock. There used to be a methods Thread.stop and Thread.suspend that did just that, and they've been deprecated because of those dangers. Starting in Java 8, that method throws UnsupportedOperationException. Basically, a thread has to stop itself. It can do so at the request of other threads (communicated by a field like keepRunning or by an interrupt), but it has to do it. One thread can't directly stop another.
upvote count: 1
has comment: http://stackoverflow.com/comment/36593616

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/23916429
type: Tag

http://stackoverflow.com/a/23859319
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23858408
has body: Use regular expressions. First import: import java.util.regex.Matcher; import java.util.regex.Pattern; Then write something like this: String line = null; Pattern patternEdge = Pattern.compile("\\s*([A-Z])\\s*-&gt;\\s*([A-Z])\\s*\\[label=\"(\\d+),(\\d+)\"\\];"); Pattern patternVertex = Pattern.compile("\\s*([A-Z])\\s*\\[label=\"([A-Z]),(\\d+)\"\\];"); Matcher m = null; while ((line = in.readLine()) != null) { m = patternEdge.matcher(line); if (m.find()) { String source = m.group(1); String destination = m.group(2); int speedLimit = Integer.parseInt(m.group(3)); int distance = Integer.parseInt(m.group(4)); Edges.add(new EdgesRep(source, destination, speedLimit, distance)); } else { m = patternVertex.matcher(line); if (m.find()) { String name = m.group(2); int time = Integer.parseInt(m.group(3)); Vertex.add(new VerticesRep(name, time)); } else System.err.println("Expression is incorrect. No matches"); } } //for debugging for(EdgesRep e : Edges) System.out.println(e.getSource() + " " + e.getDestination() + " " + e.getSpeedLimit() + " " + e.getDistance()); //for debugging for(VerticesRep v : Vertex) System.out.println(v.getName() + " " + v.getTime()); Because the first line doesn't really mean anything you may want to just skip it... On this code block I assumed it starts with A -> B [label="10,90"]; Hope it helped :)
answers question: http://stackoverflow.com/q/23858408

http://stackoverflow.com/q/23875793
has answer: http://stackoverflow.com/a/23875977
has comment: http://stackoverflow.com/comment/36752237
favorite count: 0
has answer: http://stackoverflow.com/a/23876644
has comment: http://stackoverflow.com/comment/36752166
tagged with: regex
has body: I am trying to see if a given host name appears in a list of hosts in the form of comma separated string like the following: String list = "aa.com,bb.com,cc.com,dd.net,ee.com,ff.net"; String host1 = "aa.com"; // should be a match String host2 = "a.com"; // shouldn't be a match String host3 = "ff.net" // should be a match // here is a test for host1 if (list.matches(".*[,^]" + host1 + "[$,].*")) { System.out.println(host1 + " matched"); } else { System.out.println(host1 + " not matched"); } But I got not matched for host (aa.com) but then I am not very familiar with regex. Please correct me! BTW I don't want to use a solution where you split the host list into an array and then doing matching there. It was too slow because the host list can be quite long. Regex apporoach can be even worse but I was trying to make it work first.
accepted answer: http://stackoverflow.com/a/23877116
has comment: http://stackoverflow.com/comment/36752531
answer count: 5
possible better answer: http://stackoverflow.com/a/23875967
has answer: http://stackoverflow.com/a/23875967
upvote count: 1
has comment: http://stackoverflow.com/comment/36847608
has comment: http://stackoverflow.com/comment/36752197
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23876095
has title: Java String.matches regex
type: Question
has comment: http://stackoverflow.com/comment/36752851
has comment: http://stackoverflow.com/comment/36752163
has answer: http://stackoverflow.com/a/23877116
downvote count: 0

http://stackoverflow.com/a/23922791
has comment: http://stackoverflow.com/comment/37719843
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37705995
has comment: http://stackoverflow.com/comment/36844139
has body: I'm not sure if this is what you mean, but I'll show 2 ways: If you have your instances of Person declares as single variables, it'll look like this: Person p1 = new Person("name1"); Person p2 = new Person("name2"); Person p3 = new Person("name3"); (I ignored the other Person's fields to make this easier.) Now you can put those Persons in an Person[] (Person Array) Person[] persons = new Person []{p1, p2, p3}; Now we will loop trough the persons (I suppouse you have the .getName() method in you Person class) String[] names = new String[persons.length]; // Create names Array for (int i = 0; i &lt; persons.length; i++) //Loop the persons Array { names[i] = persons[i].getName(); //Take the name from persons in //position [i] and put it in position //[i] of the names Array. } The other way is directly placing the names: String[] names = new String[]{p1.getName(), p2.getName(), p3.getName()};
upvote count: 2
answers question: http://stackoverflow.com/q/23922568
type: Answer

http://stackoverflow.com/comment/36753965
type: Comment
has text: This is too strong an opinion I think. I personally do not like if a `Document` knows how to export itself to a `File`. *This* would be a bad design.
comment on: http://stackoverflow.com/a/23856098
type: AnswerComment
score: 0

http://stackoverflow.com/q/23860364
tagged with: heap-memory
answer count: 4
has comment: http://stackoverflow.com/comment/36725844
tagged with: memory-management
linked to: http://stackoverflow.com/q/19750796
linked to: http://stackoverflow.com/q/1865501
has answer: http://stackoverflow.com/a/23988562
has answer: http://stackoverflow.com/a/23900123
has comment: http://stackoverflow.com/comment/36799813
score: 16
has answer: http://stackoverflow.com/a/23984291
upvote count: 16
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36725799
has comment: http://stackoverflow.com/comment/36733364
possible better answer: http://stackoverflow.com/a/29247267
tagged with: java
has body: I'm working on a single machine with 512GB RAM (addressed by several AMD Opteron 6212 CPUs). There is currently about 300GB RAM free. Running a large java computation by running java path/to/myApp -Xms280g -Xmx280g &gt; output.txt should make Java reserve 280GB immediately, and error if that fails. Strangely, no error occurs but top only shows a memory usage of 30.4GB but it doesn't crash. How can this happen? Isn't java supposed to crash if the initial heap size cannot be allocated? And effectively, I get OutOfMemory/Java heap space/GC overhead limit errors once the 30.4GB are full, well before the 280GB is ever reached. Running with 250GB or 300GB yields a similar 30.3GB ~ 30.4GB limit. I'm running OpenJDK 64-bit server VM with OpenJDK Runtime Environment (IcedTea6) on Gentoo Linux, and there is plenty of free RAM (over 300GB).
accepted answer: http://stackoverflow.com/a/23984291
has answer: http://stackoverflow.com/a/29247267
has comment: http://stackoverflow.com/comment/36724194
has comment: http://stackoverflow.com/comment/36810263
has comment: http://stackoverflow.com/comment/36728018
has comment: http://stackoverflow.com/comment/36939128
has comment: http://stackoverflow.com/comment/36937772
has comment: http://stackoverflow.com/comment/36725815
has comment: http://stackoverflow.com/comment/36810142
downvote count: 0
has title: java does not properly reserve huge initial heap size
has comment: http://stackoverflow.com/comment/36724173
has comment: http://stackoverflow.com/comment/36798667
favorite count: 0
tagged with: gentoo

http://stackoverflow.com/q/23804887
has body: I am using AsyncTask to download a webpage source(HTML) . It is working properly but it take to long to execute .. is there a better method. I think It is wasting time in UrlConnection .I have tried to do this with HttpClient but can't get Html source. Help me out in making it fast or .. tell me how to put this AsyncTask in thread? class RetrieveFeedTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); Utilities.hideSoftKeyboard(PlayListActivity.this); progressDialog = ProgressDialog.show(PlayListActivity.this, "Loading...", "Please wait..."); } @Override protected String doInBackground(String... urls) { try { URL url= new URL(urls[0]); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; String HTML_response = ""; while ((inputLine = br.readLine()) != null) { // System.out.println(inputLine); HTML_response += inputLine; } br.close(); System.out.println("Done"); Parser(feed); return HTML_response; } /*catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }*/catch (Exception e) { e.printStackTrace(); return null; } } @Override protected void onPostExecute(String feed) { super.onPostExecute(feed); PlayListAdapter adapter = new PlayListAdapter( PlayListActivity.this, list); list_of_songs.setAdapter(adapter); progressDialog.dismiss(); } } @SuppressLint("NewApi") void Parser(String x) { if (x.contains(spliter_start)) { if (spliter_end.isEmpty()) { x = x.substring(x.indexOf(spliter_start)); } else { x = x.substring(x.indexOf(spliter_start), x.indexOf(spliter_end)); } } int i = 0; list.clear(); while (x.contains(loop_controller)) { if (i &gt; 50) { break; } HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); x = x.substring(x.indexOf(song_start)); map.put("songsName",x.substring( x.indexOf(song_start)…
tagged with: android
tagged with: android-asynctask
has title: Fast method to download HTML in android?
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36618229
has answer: http://stackoverflow.com/a/23805793
has answer: http://stackoverflow.com/a/23805733
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36619271
answer count: 2
has comment: http://stackoverflow.com/comment/36618279
score: 0

http://stackoverflow.com/comment/36702093
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23844861
score: 0
has text: @BobDalgleish can u plz elaborate it how JVMS will interact , after this answer will be complete.

http://stackoverflow.com/q/23863932
answer count: 1
has comment: http://stackoverflow.com/comment/36742685
tagged with: java
tagged with: javafx
tagged with: listview
type: AnsweredQuestion
tagged with: user-interface
has answer: http://stackoverflow.com/a/23867803
has body: I just had a problem with an invisible, disabled list and a text field(visible) underneath it. I wasn't able to access the text field because I was still clicking on the list. Is there any way to have an invisible control and still be able to use the control underneath it?
type: Question
score: 0
has title: Can I Layer JavaFX Controls?
accepted answer: http://stackoverflow.com/a/23867803

http://stackoverflow.com/comment/36840835
type: QuestionComment
has text: You should always close the connection after use (to make it available for other uses), but JTA will not really close it and put it back into pool in order to save the creation costs for next use. First if you also close the data source then you close the whole pool and all its stored connections physically.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23921386

apache-stringutils
tag name: apache-stringutils
type: Tag
tags question: http://stackoverflow.com/q/23910169

http://stackoverflow.com/comment/36805201
has text: I tried that also where I am getting "Type mismatch: cannot convert from TeemWurkAsyncTask.WebAPIConstants to int"
comment on: http://stackoverflow.com/a/23902969
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23834640
upvote count: 3
has body: I have a stock installation of openjdk 7u21-2.3.9-5 as included with Linux Mint Debian Edition (jessie/sid) 201403. I'm trying to write java code to establish an SSL/TLS connection mutually-authenticated using Elliptic Curve keys. It's not working. Update: Since originally posting this question, I have since succeeded in establishing a secure connection by using the secp256r1 curve (rather than secp256k1) for both the server and client keys. However I am leaving this question mostly as I originally wrote it since I still am interested in the answer to the question. In particular I note that the security of the secp256r1 curve has been questioned. In searching the internet for help my attention was called to the second-to-last provider listed in my java.security file: #security.provider.9=sun.security.ec.SunEC Why is this here? Why is it commented out? I have tried using SSL (TLS) client keys based on both the secp256k1 and secp256r1 curves. I've also tried adding bouncycastle as a provider. With the server certificate using secp256k1 I cannot establish a connection, even with the bouncycastle provider available; on the other hand, if the server and client keys are both based on the secp256r1 curve then I can establish a secure connection. So far, my understanding is that there is a SunEC cryptographic provider that supports all EC curves but is not included with OpenJDK, that if I could find and install the proper java jar file and binary shared binary library then I could use that provider, but also that there is some incompatibility between that and the included rt.jar file. Furthermore, I understand that the SunPKCS11 provider, which is included with OpenJDK, handles a subset of EC curves, including secp256r1, but not secp256k1. If bouncycastle is available then it seems to kicks in when trying to use the secp256k1 curve for the client key, but not for the server key. I have little confidence in the accuracy of my understanding because it's based on information f…
favorite count: 0
type: UnansweredQuestion
tagged with: elliptic-curve
score: 3
answer count: 0
downvote count: 0
tagged with: java
type: Question
has title: What is the purpose of the commented-out sun.security.ec.SunEC provider in java-7-openjdk?
tagged with: ssl
tagged with: ssl-certificate

http://stackoverflow.com/q/23794900
type: Question
has answer: http://stackoverflow.com/a/23817558
tagged with: bean-validation
score: 8
linked to: http://stackoverflow.com/q/17570314
has title: Is it possible to validate an object field only if it is not null?
has comment: http://stackoverflow.com/comment/36607242
answer count: 2
tagged with: validation
downvote count: 0
has comment: http://stackoverflow.com/comment/36627750
favorite count: 0
accepted answer: http://stackoverflow.com/a/23817558
upvote count: 8
has comment: http://stackoverflow.com/comment/36602252
linked to: http://stackoverflow.com/q/19262979
possible better answer: http://stackoverflow.com/a/72772198
has answer: http://stackoverflow.com/a/72772198
type: AnsweredQuestion
has body: There are two existing variants of this question: Validate only if the field is not Null : A solution to a conditionally handling a String field Hibernate validation - only validate if object is not null : The only answer demonstrates the behavior and hints at how you could handle it when triggering the validation manually. My question adds the qualifier of how can I do this when using @Valid on an object which may be null. The use case here is that we have two fields where one or the other need to be not null (Custom validator on the class that contains the fields). When one is not null, I need it to be valid. Do I then need to fully and manually validate that object within my custom validator, adding more responsibility to it than it was intended for? Using only annotations in this case causes a NullPointerException to be thrown, which breaks it out of validation before it could be handled. Is there not currently a way to do this?
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/36798394
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23896517
type: AnswerComment
has text: @MartinR - A quick (hence incomplete) check shows `iVar`, `self->iVar` and `(*self).iVar` all produce the same code. I.e. the implementation detail that both `.` and `->` are no longer using fixed offsets is correctly handled by the compiler as it should be and the equivalence still holds. Indeed I don't think fixed offsets were ever part of the C Standard definition of member access.

http://stackoverflow.com/a/23878780
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36758516
type: Answer
has comment: http://stackoverflow.com/comment/36758484
answers question: http://stackoverflow.com/q/23878708
score: 1
has comment: http://stackoverflow.com/comment/36758629
has body: You should not parse HTML using regular expressions, but your written code seems to work fine? String result = "&lt;input type=\"hidden\" name=\"token\" value=\"YToxOntzOjU\"/&gt;"; Pattern pattern = Pattern.compile("name=\"(token)\"[^&gt;]*value=\"([^\"]+)\"", 2); Matcher matcher = pattern.matcher(result); if (matcher.find()) { String value = matcher.group(2); System.out.println(value); //=&gt; "YToxOntzOjU" } Working Demo
upvote count: 1
has comment: http://stackoverflow.com/comment/36758533
has comment: http://stackoverflow.com/comment/36758538
has comment: http://stackoverflow.com/comment/36758610
accepted answer of: http://stackoverflow.com/q/23878708

http://stackoverflow.com/q/23798137
type: Question
tagged with: encoding
accepted answer: http://stackoverflow.com/a/23822013
score: 0
has comment: http://stackoverflow.com/comment/36604983
answer count: 1
has answer: http://stackoverflow.com/a/23822013
has body: I use Java, GWT, Spring, Maven and Tomcat. Field validation messages stored in .properties files each of them saved UTF-8 encoding. One of these files has words written in Russian, so when I change web interface language to Russian I receive validation message in wrong encoding like this: Ð½Ðµ Ð´Ð¾Ð»Ð¶Ð½Ð¾ Ð±ÑÑÑ null (right message from file looks like: не должно быть null) Localization messages provides by class which extends com.google.gwt.i18n.client.Messages Any suggestions?
has comment: http://stackoverflow.com/comment/36613219
tagged with: maven
has comment: http://stackoverflow.com/comment/36728498
tagged with: internationalization
has title: Validation Messages GWT i18n Encoding Issue
tagged with: gwt
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23847357
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23804168
upvote count: 1
has body: There isn't any way I'm aware of for doing this directly. What you could try is to generate the columns at compile or deploy time in a separate file as &lt;sql&gt; elements and then include them in your mapper files as needed. There is also this statement-builders feature added to MyBatis that alows you to build SQL from code so maybe have a look at that also.

http://stackoverflow.com/q/23816475
has answer: http://stackoverflow.com/a/23816747
score: 5
type: AnsweredQuestion
has body: In play Framework, how can I get the URL the user came from in a controller? I've tried request.url, but that isn't working.
tagged with: playframework-2.3
tagged with: java
has title: (Play Framework 2.3.x) How to get the previous url?
tagged with: request
type: Question
accepted answer: http://stackoverflow.com/a/23816747
upvote count: 5
has comment: http://stackoverflow.com/comment/36735316
tagged with: playframework
answer count: 1
tagged with: url
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36585624
has text: @BrunoLorenço http://stackoverflow.com/questions/6355787/how-to-pass-arraylisthashmapstring-stringfrom-one-activity-to-another. It should work in case of fragment also
type: Comment
comment on: http://stackoverflow.com/q/23787811
score: 0
type: QuestionComment

http://stackoverflow.com/q/23874584
type: AnsweredQuestion
has body: I have a problem with JTextField. I will type in my form name, surname, phone_number and email. But I don't know how. Actually System.out.print prints 4 times null. Method .getText() return unknow source. This is my code: package View; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import Date.DaneDoKontaktow; import Date.KolekcjaKontaktow; import Main.main; import Model.OperacjeKontakty; public class DodajKontakt extends JFrame implements ActionListener { public JButton dodaj; public JButton anuluj; public JTextField s_imie; public JTextField s_nazwisko; public JTextField s_telefon; public JTextField s_email; private OperacjeKontakty operacje = new OperacjeKontakty(); public DodajKontakt(){ super("Dodawanie kontaktu"); setSize(300,300); setLocationRelativeTo(null); setLayout(null); setResizable(false); setVisible(true); dodaj = new JButton("Dodaj"); dodaj.setBounds(50, 220, 100, 30); add(dodaj); anuluj = new JButton("Anuluj"); anuluj.setBounds(165, 220, 100, 30); add(anuluj); DaneDoKontaktow dane = new DaneDoKontaktow(); JLabel imie = new JLabel(dane.imie); imie.setBounds(15,30,70,15); add(imie); JLabel nazwisko = new JLabel(dane.nazwisko); nazwisko.setBounds(15,60,70,20); add(nazwisko); JLabel telefon = new JLabel(dane.telefon); telefon.setBounds(15,90,70,20); add(telefon); JLabel email = new JLabel(dane.email); email.setBounds(15,120,70,20); add(email); anuluj.addActionListener(this); anuluj.setActionCommand("klik_anuluj"); JTextField s_imie = new JTextField(); s_imie.setBounds(100,20,150,30); add(s_imie); JTextField s_nazwisko = new JTextField(); s_nazwisko.setBounds(100,52,150,30); add(s_nazwisko); JTextField s_telefon = new JTextField(); s_telefon.setBounds(100,85,150,30); add(s_telefon); JTextField s_email = new JTextField(); s_email.setBounds(100,117,150,30); add(s_email); dodaj.addActionListener(thi…
downvote count: 2
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/23874650
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/36749883
tagged with: java
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/36750029
has answer: http://stackoverflow.com/a/23874650
favorite count: 0
has answer: http://stackoverflow.com/a/23874652
accepted answer: http://stackoverflow.com/a/23874652
has title: I cant use JTextField

http://stackoverflow.com/comment/36688520
comment on: http://stackoverflow.com/q/23841560
score: 0
type: Comment
type: QuestionComment
has text: yes i am asking about more efficient to execute.

http://stackoverflow.com/comment/36721925
comment on: http://stackoverflow.com/q/23845681
type: Comment
type: QuestionComment
has text: Well in order to be precise a static method cannot access a non-static method or instance variable **directly**. I am guessing this is all about. When a statement like the one in 2 is given it must be fulfilled in both parts and also it should be done in a direct manner. Indirect access is like saying a private instance member is accessible through setters and getters so it can be accessed. Anyway, I would argue that the answer of @Abimaran Kugathasan is more accurate.
score: 0

http://stackoverflow.com/comment/36888157
has text: In your pattern, you are using `%logger{36}`. Just use `%logger` instead
comment on: http://stackoverflow.com/a/23927572
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/23867063
has body: When i try to link my Java to my XML, the computer doesn't seem to pick up my XML id of my buttons here is the java code: package com.android.simple; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int counter; Button add; Button sub; TextView display; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); counter = 0; add = (Button) findViewById(R.layout.bAdd); } } XML code, as you can see, the button's id is saved as bAdd and so it is called in the java code as well: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${packageName}.${activityClass}" &gt; &lt;Button android:layout_width="200dp" android:layout_height="50dp" android:layout_below="@+id/tvDisplay" android:layout_centerHorizontal="true" android:layout_marginTop="149dp" android:text="Subtract one" android:id="@+id/bSub" /&gt; &lt;Button android:layout_width="200dp" android:layout_height="50dp" android:layout_alignBottom="@+id/bSub" android:layout_alignLeft="@+id/bSub" android:layout_marginBottom="67dp" android:text="Add one" android:id="@+id/bAdd" /&gt; &lt;TextView android:layout_width="100dp" android:layout_height="20dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="36dp" android:layout_weight="0.00" android:text="Your total is 0 " android:id="@+id/tvDisplay" /&gt; &lt;/RelativeLayout&gt;
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23867074
answer count: 2
possible better answer: http://stackoverflow.com/a/23867166
upvote count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36736014
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23867166
downvote count: 0
has title: Error in my Java code referring to my XML button
accepted answer: http://stackoverflow.com/a/23867074
type: Question

http://stackoverflow.com/comment/38290450
comment on: http://stackoverflow.com/a/24657228
type: Comment
score: 0
type: AnswerComment
has text: In the Excel the formula cell is displyed as normal text, click on that though retrieves the desired screen shot. How to make the Formula link cell to be displayed like hyperlink ?

http://stackoverflow.com/comment/36814698
comment on: http://stackoverflow.com/a/23905592
has text: @Raj..... If you have to start the progress dialog for a AsycTask then you can start in onPreExecute() and then stop the progress dialog in onPostExecute()....And also if you will see the implementation of AsycTask then you can find that it has thread pool so it is starting the task on different thread not on main thread so why you want to add another thread to that....anyway sorry for delay because you already accepted the answer :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23922115
has answer: http://stackoverflow.com/a/23922197
has body: I've a typical scenario &amp; need to understand best possible way to handle this, so here it goes - I'm developing a solution that will retrieve data from a remote SOAP based web service &amp; will then push this data to an Oracle database on network. Also, this will be a scheduled task that will execute every 15 minutes. I've event queues on remote service that contains the INSERT/UPDATE/DELETE operations that have been done since last retrieval, &amp; once I retrieve the events for last 15 minutes, it again add events for next retrieval. Now, its just pushing data to Oracle so all my interactions are INSERT &amp; UPDATE statements. There are around 60 tables on Oracle with some of them having 100+ columns. Moreover, for every 15 minutes cycle there would be around 60-70 Inserts, 100+ Updates &amp; 10-20 Deletes. This will be an executable jar file that will terminate after operation &amp; will again start on next 15 minutes cycle. So, I need to understand how should I handle WRITE operations (best practices) to improve performance for this application as whole ? Current Test Code (on every cycle) - Connects to remote service to get events. Creates a connection with DB (single connection object). Identifies the type of operation (INSERT/UPDATE/DELETE) &amp; table on which it is done. After above, calls the respective method based on type of operation &amp; table. Uses Preparedstatement with positional parameters, &amp; retrieves each column value from remote service &amp; assigns that to statement parameters. Commits the statement &amp; returns to get event class to process next event. Above is repeated till all the retrieved events are processed after which program closes &amp; then starts on next cycle &amp; everything repeats again. Thanks for help !
score: 0
answer count: 3
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36842719
type: UnansweredQuestion
tagged with: oracle-database
tagged with: soap
has answer: http://stackoverflow.com/a/23926194
tagged with: java
has title: Improving performance for WRITE operation on Oracle DB in Java
type: Question
has answer: http://stackoverflow.com/a/23922736

http://stackoverflow.com/comment/36818747
type: QuestionComment
has text: No not with a filter. Also why would you want to manipulate the arguments before they reach the controller.
comment on: http://stackoverflow.com/q/23910489
score: 0
type: Comment

http://stackoverflow.com/q/23872779
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23883651
tagged with: eclipse
has title: Apache Felix Webconsole 404
type: Question
tagged with: bndtools
has comment: http://stackoverflow.com/comment/36749149
has body: I am running BND tools in eclipse Kepler under windows 7 using JavaSE 1.6, and I am trying to start an Apache Felix framework 4.4.0 with a webconsole. I am quite puzzled since the same approach did seem to work under Ubuntu 14.04. What am I not seeing? Besides the normal bundles, I am running the bundles for the Jetty webserver and the felix webconsole bundle. Now when I try to access http://localhost:8080/system/console I get a 404 from jetty. Now this does tell me that jetty is working correctly, but the webconsole somehow does not work correctly. I have tried to re-add the bundles, restart eclipse, restart my PC, but all without effect. A minimal example does run on another machine running Ubuntu, and I used to be able to run it in the past as well. Now I did find that there is a property "manager.root" by which I can set the location of the webconsole myself, but I haven't changed it (even if I did, it seemed ineffective). Is there a command to get the location from the console? I am running only the following 4 bundles: org.apache.felix.gogo.shell org.apache.felix.gogo.command org.apache.felix.http.jetty org.apache.felix.webconsole Active bundles: ID|State |Level|Name 0|Active | 0|System Bundle (4.4.0) 1|Active | 1|Java Servlet API (3.0.1) 2|Active | 1|Apache Felix Gogo Command (0.12.0) 3|Active | 1|Apache Felix Gogo Runtime (0.10.0) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Active | 1|Apache Felix Http Jetty (2.2.2) 6|Active | 1|Apache Felix Web Management Console (All In One) (4.2.2.all) 7|Active | 1|osgi.enterprise (4.2.0.201003190513) 8|Active | 1|osgi.residential (4.3.0.201111022239)
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36756385
tagged with: apache-felix
has comment: http://stackoverflow.com/comment/65375765
tagged with: osgi
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36750477

http://stackoverflow.com/q/23860914
has body: I was working on Problem 8 and I've come up with a solution that works fine for four and five consecutive digits, giving the answers 5832 and 40824 respectively, although it seems to be failing when I try thirteen digits. The following is my code: public static void main(String[] args){ String s="7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"; int num=1; int res=0; for(int i=0;i&lt;=s.length()-13;i++){ num=1; for(int j=0;j&lt;13;j++) num=num*Integer.parseInt(s.substring(i+j,i+j+1)); if(res&lt;num) res=num; } System.out.println(res); } I get "2091059712" as a result and ProjectEuler does not accept it. What is the problem? Either my code is wrong or they did miscalculation. If my code is wrong, can you help me to fix it?
downvote count: 0
possible better answer: http://stackoverflow.com/a/23861492
favorite count: 0
has answer: http://stackoverflow.com/a/23861492
has comment: http://stackoverflow.com/comment/36725250
has comment: http://stackoverflow.com/comment/36725214
has title: ProjectEuler 8: Is my code wrong or Is it their false?
has comment: http://stackoverflow.com/comment/36725203
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36725358
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36725258
type: Question
has answer: http://stackoverflow.com/a/23861123
has comment: http://stackoverflow.com/comment/36725174
has comment: http://stackoverflow.com/comment/36725215
has comment: http://stackoverflow.com/comment/36725275
accepted answer: http://stackoverflow.com/a/23861123
answer count: 2

http://stackoverflow.com/comment/36846161
type: Comment
type: QuestionComment
has text: `e.getX() < 50 && e.getX() > 250` How can you expect both of those conditions to be true?
score: 0
comment on: http://stackoverflow.com/q/23924693

http://stackoverflow.com/comment/72168801
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23883828
type: Comment
has text: Testing the caching by looking at Random values is a great idea!

http://stackoverflow.com/q/23840004
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23840084
tagged with: java
tagged with: eclipse
type: Question
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/23840084
has answer: http://stackoverflow.com/a/25660652
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25660652
tagged with: android
has body: In my app I have a SherlockNavigationDrawer, with a list of options, each one has a different activity that calls an xml with a fragmentmap, I have no problem when I have opened a map and want to open another, but I got it when I return to any of the maps already open. this is my code, any suggestion is welcome: MainActivity.java: public class MainActivity extends SherlockFragmentActivity { // Declare Variables DrawerLayout mDrawerLayout; ListView mDrawerList; ActionBarDrawerToggle mDrawerToggle; MenuListAdapter mMenuAdapter; String[] title; Fragment fragment1 = new Fragment1(); Fragment fragment2 = new Fragment2(); Fragment fragment3 = new Fragment3(); private CharSequence mDrawerTitle; private CharSequence mTitle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from drawer_main.xml setContentView(R.layout.drawer_main); // Get the Title mTitle = mDrawerTitle = "¿Qué buscás?"; // Generate title title = new String[] { "CORTE LÁSER", "CORTE METALES", "CORTE POR CHORRO DE AGUA", "CURSOS", "EQUIPOS DE VIDEO", "FICHAS TÉCNICAS", "FOTÓGRAFOS", "GRÁFICAS", "IMPRESIÓN 3D", "LIBRERÍAS Y PAPELERAS", "MAQUETAS Y PROTOTIPOS", "MODELADO 3D", "MODELOS", "PLÁSTICOS", "ROUTER", "SUBLIMACIÓN", "TELGOPOR", "TERMOFORMADO", "TORNERO MADERA", "TORNERO METALES", "VINILOS" }; // Locate DrawerLayout in drawer_main.xml mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // Locate ListView in drawer_main.xml mDrawerList = (ListView) findViewById(R.id.listview_drawer); // Set a custom shadow that overlays the main content when the drawer // opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // Pass string arrays to MenuListAdapter mMenuAdapter = new MenuListAdapter(MainActivity.this, title); // Set the MenuListAdapter to the ListView mDrawerList.setAdapter(mMenuAdapter); // Capture listview menu item click mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // Enable Ac…
has title: Android app crash when come back to fragmentmap - GoogleMap v2

http://stackoverflow.com/comment/36682626
type: QuestionComment
has text: But I have a generator that makes a number from 1 to 10
comment on: http://stackoverflow.com/q/23838985
score: 0
type: Comment

http://stackoverflow.com/comment/36800952
type: QuestionComment
comment on: http://stackoverflow.com/q/23900565
score: 0
has text: i have posted some of my code
type: Comment

http://stackoverflow.com/q/23794354
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24047704
has body: When connected, the Google Glass shows up as "Android Composite ADB Interface" under Android Device in my Device Manager. In Eclipse (ADT), the Google Glass is in the DDMS with status "online." The snippet added to my "android_winusb.inf" file under both x86 and amd64 in the ADT Bundle is as follows (this is the location used for the manual driver update): ;Google Glass %SingleAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_4E11&amp;REV_0216 %CompositeAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_4E11&amp;MI_01 %SingleAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_9001&amp;REV_0216 %CompositeAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_9001&amp;MI_01 When I run a project with Build Target Glass Development Kit preview as an Android Application, the Glass does not appear as a running Android Device. When running the command "adb devices" in the command window in the directory of where adb is (in platform-tools in the ADB bundle) there is a device listed. I am operating on Windows 7. Not sure what to do, any help would be greatly appreciated! Thanks EDIT: This problem only persists with the specific Glass I was using. This Glass is version XE10 and has actually been experiencing many problems. Another glass with version XE17.2 (up to date as of 5/21/14) was able to connect and load android projects with the above configurations.
has comment: http://stackoverflow.com/comment/36716772
type: Question
tagged with: android
has title: Glass (XE10) not recognized as running android device
has comment: http://stackoverflow.com/comment/37037019
score: 0
has comment: http://stackoverflow.com/comment/37037030
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24047704
tagged with: eclipse
tagged with: google-gdk

http://stackoverflow.com/comment/36831180
type: Comment
type: QuestionComment
has text: Your code looks correct to me (or at least like it should work). The error is in any case coming from the server. So you probably want to look at how that is configured and who else is connecting to the db. You could try bumping the number of connections in my.cnf.
comment on: http://stackoverflow.com/q/23916756
score: 0

http://stackoverflow.com/comment/36596172
comment on: http://stackoverflow.com/q/23793415
type: Comment
type: QuestionComment
has text: @user2357112 Yes you're right, I didn't pay attention that equals and hashcode were only based on the resource path.
score: 0

http://stackoverflow.com/a/23849830
has comment: http://stackoverflow.com/comment/36704918
answers question: http://stackoverflow.com/q/23839945
has comment: http://stackoverflow.com/comment/89849260
accepted answer of: http://stackoverflow.com/q/23839945
has comment: http://stackoverflow.com/comment/36704756
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36707456
type: Answer
score: 2
upvote count: 2
has body: Looking at your updated use case: lambdas are desugared to synthetic (compiler-generated) methods, with a function object that forwards interface calls through the generated method (I haven't looked into exactly how this is implemented, but I think Brian Goetz has talked about it). You can just look in that method's bytecode (loaded from the class file; some of the ASM sample code does this) and read off the field access. Instrumentation is not required. Note that you can't create a proxy to see field access; the field access is performed in the lambda method (or more generally, where the field is loaded) without executing any code in Foo. In fact, you don't even need to call the lambda if all you want is to get the field name, and if all you're using the Foo proxy for is the call, you don't need a proxy. I'm not aware of any way to intercept field accesses as easily as java.lang.reflect.Proxy makes intercepting method calls. The getfield and putfield bytecodes use symbolic descriptors that encode the class and field name, so you could use a Java agent to add method calls before or after each load and store passing the field name, object and value being loaded/stored. (This works best if you're only interested in a subset of fields, say all fields of a particular class.) Depending on your needs, you may also have to recognize reflective accesses to your fields by instrumenting use of java.lang.reflect.Field, the handle returned by MethodHandles.Lookup.findGetter/Setter etc. (which may involve interprocedural analysis or reasoning about string operations used to build the field name, etc.). You could also try instrumenting "just before" the library calls into some JVM-specific native functionality, but that ties you to one JVM implementation and your instrumentation may be skipped if the JVM intrinsifies (special-cases codegen for) reflective calls. If you're willing to write C code, you can use the JVM Tool Interface watched field functions. This seems the easiest w…

http://stackoverflow.com/comment/36647237
type: Comment
comment on: http://stackoverflow.com/a/23807596
has text: Hmmm must be the code calling this - my guess is it's swallowing the SuperCsvException
type: AnswerComment
score: 0

http://stackoverflow.com/q/23890136
has answer: http://stackoverflow.com/a/23908282
has comment: http://stackoverflow.com/comment/36780801
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/23908282
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36804343
type: Question
has body: I have a converter, but it is not called. I Always get a BindException. public class IntegerToQueConverter implements Converter<Integer, QuestionType> { @Autowired private QuestionTypeService questionTypeService; @Override public QuestionType convert(Integer questionType) { return questionTypeService.findOne(questionType); } I defined the following bean in application context. <annotation-driven conversion-service="conversionService"> Please help. Thanks in advance! update: I want the converter to be called in this code: @RequestMapping(value="/insertQuestion", method = RequestMethod.POST) public ModelAndView insertQuestion(@ModelAttribute("questions") Question question) { ModelAndView view=new ModelAndView("addQuestion"); System.out.println(question.getQuestion()); ............................. return view; }
has title: Spring Converter is not called
tagged with: java

http://stackoverflow.com/comment/36821798
comment on: http://stackoverflow.com/q/23911578
type: Comment
type: QuestionComment
has text: I am trying to find dhcp client list in my java code; as shown in router webUI.I am getting exception provided in below link; on this basis am telling this firewall problem. and I can not reconfigure fiewall bcz there are android devices too in this network
score: 0

http://stackoverflow.com/a/23793225
downvote count: 1
has comment: http://stackoverflow.com/comment/36596219
has body: I think it might be an issue with special characters, because you pass the telephone number with a '+' in your request. The + sign in URL get request is used to represent a space you should escape it, probably with %2B source
has comment: http://stackoverflow.com/comment/36595777
score: 1
has comment: http://stackoverflow.com/comment/36596205
has comment: http://stackoverflow.com/comment/36595738
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36595629
has comment: http://stackoverflow.com/comment/36595438
has comment: http://stackoverflow.com/comment/36595706
accepted answer of: http://stackoverflow.com/q/23792928
has comment: http://stackoverflow.com/comment/36596272
answers question: http://stackoverflow.com/q/23792928
type: Answer
has comment: http://stackoverflow.com/comment/36595627
has comment: http://stackoverflow.com/comment/36596695
upvote count: 2
has comment: http://stackoverflow.com/comment/36595851

http://stackoverflow.com/comment/36626142
comment on: http://stackoverflow.com/q/23809542
score: 1
type: Comment
has text: You have two Location classes, in different packages
type: QuestionComment

http://stackoverflow.com/a/23863177
downvote count: 0
type: Answer
has body: ArrayUtils.addAll(array1, array2, ...)
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23863133

http://stackoverflow.com/comment/36672801
comment on: http://stackoverflow.com/q/23833934
type: QuestionComment
has text: @PabloFranciscoPérezHidalgo Oops, sorry. Yes, you're true :).
type: Comment
score: 0

http://stackoverflow.com/a/23838112
has comment: http://stackoverflow.com/comment/36681033
has comment: http://stackoverflow.com/comment/36681224
answers question: http://stackoverflow.com/q/23838097
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/23838097
has comment: http://stackoverflow.com/comment/36681198
type: AcceptedAnswer
downvote count: 0
has body: Arrays are Objects too, but they don't override Object's toString() method. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode()) That explains the strange-looking output you've received. Try Arrays.toString: The string representation consists of a list of the array's elements, enclosed in square brackets (&quot;[]&quot;). Adjacent elements are separated by the characters &quot;, &quot; (a comma followed by a space). System.out.print(Arrays.toString(FirstExercise.concatenator(first, second)));
type: Answer

http://stackoverflow.com/comment/36604706
has text: Locale current = getResources().getConfiguration().locale;
comment on: http://stackoverflow.com/a/23798019
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36856898
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23930905
has text: You close the last file, but not the earlier ones. Is the last file complete?
type: Comment

http://stackoverflow.com/a/23893785
downvote count: 0
has body: There are a couple of ways I can think of to solve this using CDI. First, if the isSuitableFor method is as simple as you list, you can use a Qualifier with a @Nonbinding value for the int listed, and simply look up the implementation with that qualifier value. Let's say that the qualifier is @Vertices and the value for Triangle is 3, so then the qualifier becomes: @Qualifier @Target({ TYPE, METHOD, PARAMETER, FIELD }) @Retention(RUNTIME) @Documented public @interface Vertices { @Nonbinding int value(); } And Triangle becomes: @Vertices(3) public class Triangle implements Polygon{ } And you would get a reference to it via: @Inject @Vertices(3) private Polygon polygon; Or you can create an AnnotationLiteral for vertices and manually look it up via instance. Another way, is to iterate through all Instances, like this: @Inject @Any private Instance&lt;Polygon&gt; polygons; for(Polygon p : polygons) { if(p.isSuitableFor(x)) { // do something. } } This assuming that all polygons are registered beans. This will be slow for large numbers of polygons. The third way is to use an event, and instead of qualifying the class, qualify the observer method. E.g. @Inject private Event&lt;SomePayload&gt; somePayload; // later on somePayload.select(new VerticesLiteral(3)).fire(somePayload); // and the observer method in Triangle public void handle(@Observes @Vertices(3) SomePayload somePayload) { ... } // and in square public void handle(@Observes @Vertices(4) SomePayload somePayload) { ... }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23879015

http://stackoverflow.com/q/23915478
has answer: http://stackoverflow.com/a/23915520
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23915520
has body: I want to execute following command: awk '{print "1" $0}' /path_toFile/file.txt this is my code: String[] params = new String[3]; params[0] = "/usr/bin/awk"; params[1] = "print \"1\" $0"; params[2] = "/path_toFile/file.txt"; Runtime.getRuntime().exec(params); Getting Error: Exit Value = 2 syntax error The source line is 1. The error context is &gt;&gt;&gt; print &lt;&lt;&lt; \"1\" $0 awk: Quitting The source line is 1.
score: 0
answer count: 1
tagged with: awk
has title: Issue executing Runtime.getRuntime().exec AWK
tagged with: unix
type: AnsweredQuestion

http://stackoverflow.com/q/23901234
type: Question
has body: I'm developing a game called GalaxyWar, and I am trying to make a map selection menu. I found a problem that when I am using a BoxLayout with BoxLayout.Y_AXIS on a JPanel with setAlignmentX(CENTER_ALIGNMENT), the subcomponents (JPanel's) with assigned size, take up the entire height of the panel (all together), instead of the assigned height! Here is my code: scrollPane = new JScrollPane(); scrollPane.setBounds(160, 11, 452, 307); add(scrollPane); mapContainer = new JPanel(); mapContainer.setAlignmentX(CENTER_ALIGNMENT); mapContainer.setAlignmentY(JPanel.TOP_ALIGNMENT); mapContainer.setLayout(new BoxLayout(mapContainer, BoxLayout.Y_AXIS)); scrollPane.setViewportView(mapContainer); JPanel demoPanel = new JPanel(); demoPanel.setLayout(null); demoPanel.setBackground(Color.YELLOW); demoPanel.setSize(50, 100); mapContainer.add(demoPanel); I've researched on this for long, but couldn't find any solutions so far.
linked to: http://stackoverflow.com/q/7229226
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/23903624
accepted answer: http://stackoverflow.com/a/23903624
answer count: 1
tagged with: alignment
favorite count: 0
has comment: http://stackoverflow.com/comment/36801993
upvote count: 3
has comment: http://stackoverflow.com/comment/36802204
has comment: http://stackoverflow.com/comment/36802683
has comment: http://stackoverflow.com/comment/36801988
linked to: http://stackoverflow.com/q/17874717
downvote count: 0
has title: How to make Components align to the TOP in JPanel with BoxLayout?
tagged with: swing
tagged with: boxlayout
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36805555
score: 3
has comment: http://stackoverflow.com/comment/36802354
tagged with: java
tagged with: jpanel
linked to: http://stackoverflow.com/q/18744960

http://stackoverflow.com/comment/40708884
type: AnswerComment
comment on: http://stackoverflow.com/a/25439844
type: Comment
has text: We have written with Mixpanel about this, and this is their solution as well :( I agree that it is hardly ideal though.
score: 1

http://stackoverflow.com/a/23876358
has comment: http://stackoverflow.com/comment/36888335
has comment: http://stackoverflow.com/comment/36762659
type: Answer
has comment: http://stackoverflow.com/comment/36834839
upvote count: 1
has comment: http://stackoverflow.com/comment/36760041
has body: The volume controls that are provided are very crude. When you set a new volume, the entire change happens all at once. This can create a discontinuity in the sound that results in a pop. To eliminate this, one can try making the volume change more gradually. Sometimes this works. You will have to tinker with it to find the best trade-off of the amount of time needed for a transition and smoothness. There are several issues that pertain. (1) The "distance" one can travel in a single volume change without a pop can be different at the low end versus the high end, depending on the scaling in use. (2) The number of changes you can make over a period of time is limited by the buffer size. You can only make one change per buffer. Thus decreasing the buffer size will allow more granularity in the volume changes, but will increase the risk of drop-outs. Frankly, I just threw up my hands and gave up using the provided volume lines. Instead, I program the changes to transition on a per-frame basis. This can be done by taking each buffer and converting the bytes to PCM, doing the volume multiplication on the individual frames and converting back to bytes. The processing cost turns out to be pretty minor.
answers question: http://stackoverflow.com/q/23852838
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36911240

versions-maven-plugin
type: Tag
tags question: http://stackoverflow.com/q/23806243
tag name: versions-maven-plugin

http://stackoverflow.com/a/23866716
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: Take a look into this link: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html it may help you. You could try to use inJustDecodeBounds and get the image dimensions before decoding it. like: BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream input = connection.getInputStream(); BitmapFactory.decodeStream(input ,null,options); And then set a maximum width and height and decode it. There's a sample code on the like above where you can find two methods to do it.
answers question: http://stackoverflow.com/q/23866428

solr
tags question: http://stackoverflow.com/q/23915695
tags question: http://stackoverflow.com/q/23800718
tags question: http://stackoverflow.com/q/23927420
tag name: solr
tags question: http://stackoverflow.com/q/23865005
tags question: http://stackoverflow.com/q/23792668
tags question: http://stackoverflow.com/q/23824016
type: Tag

jboss5.x
tag name: jboss5.x
type: Tag
tags question: http://stackoverflow.com/q/23802941

http://stackoverflow.com/comment/36892428
has text: Even if it would work that way, how would I trigger the usage of my `CustomValidator` from the backing bean listener method?
comment on: http://stackoverflow.com/a/23923542
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36813755
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23907057
has text: If it is directly in the target folder then this is not a standard maven location. Try: java -classpath . MainPane
type: Comment

akka
type: Tag
tags question: http://stackoverflow.com/q/23835157
tags question: http://stackoverflow.com/q/23785766
tags question: http://stackoverflow.com/q/23798414
tags question: http://stackoverflow.com/q/23904154
tags question: http://stackoverflow.com/q/23902764
tags question: http://stackoverflow.com/q/23903427
tags question: http://stackoverflow.com/q/23894725
tag name: akka
tags question: http://stackoverflow.com/q/23782247

http://stackoverflow.com/a/23866052
upvote count: 2
has comment: http://stackoverflow.com/comment/36787345
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23863401
answers question: http://stackoverflow.com/q/23863401
type: Answer
score: 2
downvote count: 0
has body: I would consider managing the datasource outside persistence.xml and use UserCredentialsDataSourceAdapter and its setCredentialsForCurrentThread method. Something around these lines: <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/> <property name="url" value="jdbc:jtds:sqlserver://localhost:1433;databaseName=B3;" /> <property name="targetDataSource" ref="targetDataSource"/> <property name="username" value="defaultUser"/> <property name="password" value="mypassword" /> And in your java code you would get a reference to dataSource and call setCredentialsForCurrentThread(username, password). Every time the datasource has getConnection() called on it, the credentials are checked against the current thread and those are used to get the connection.
has comment: http://stackoverflow.com/comment/122943389

http://stackoverflow.com/a/23785660
score: 0
has body: As said by the above answers in code form: String bigHexNumber = "0x6042607b1ba01d8d"; if(bigHexNumber.subString(0, 1).equals("0x") { bigHexNumber = bigHexNumber.subString(2); } long hexInLongForm = new BigInteger(bigHexNumber, 16).longValue();
type: Answer
answers question: http://stackoverflow.com/q/23785470

http://stackoverflow.com/comment/36751481
score: 4
type: Comment
type: QuestionComment
has text: Did you try to debug your program?
comment on: http://stackoverflow.com/q/23875496

http://stackoverflow.com/comment/36833871
type: QuestionComment
has text: Could you give results for M=9, N=4, for instance? Your program says the answer is 25, but when I enumerate them manually I come up with 19: {(1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9), (2,3), (2,5), (2,7), (2,9), (3,4), (3,5), (3,7), (3,8), (4,5), (4,7), (4,9)}. What am I missing/not understanding?
comment on: http://stackoverflow.com/q/23902842
score: 0
type: Comment

http://stackoverflow.com/q/23817469
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to execute a program in eclipse and I when I click run I see this in the console output: [] is an unknown syslog facility. Defaulting to [USER]. / "Failed" Any ideas?
tagged with: java
has title: Eclipse [] is an unknown syslog facility error
type: Question
has comment: http://stackoverflow.com/comment/36642034
tagged with: syslog
tagged with: eclipse
has answer: http://stackoverflow.com/a/23817909

http://stackoverflow.com/q/23932393
has title: apache camel multicast - performing aggregation in async manner
type: Question
tagged with: apache-camel
has answer: http://stackoverflow.com/a/23934106
upvote count: 3
downvote count: 0
answer count: 1
favorite count: 0
tagged with: multicast
type: UnansweredQuestion
score: 3
tagged with: java
has body: Suppose if I have a route in which I am multicasting the input to multiple processors. PRESENT BEHAVIOR: The console waits for some input from System.in stream, as soon as some input is given, the multicasting is done but the main thread waits until the aggregation is completed. EXPECTED BEHAVIOR: What I wanted to achieve is that the main thread should not wait for the aggreagation to complete but should return back and the main thread should start listening for new input from the console, as the route is InOnly type and not supposed to produce any output. I tried using parallelProcessing="true" and setExchangePattern pattern="InOnly" in the route to affect the behavior but Multicast processor always waits for the aggregation task to complete and only then the main thread picks up other input from console. <from uri="stream:in?promptMessage=Enter something: "/> <setExchangePattern pattern="InOnly"/> ${body.toUpperCase()} <to uri="stream:out"/> <to uri="stream:out"/> Is this possible with multicast or is there some other way to achieve this?

http://stackoverflow.com/comment/48891004
comment on: http://stackoverflow.com/a/26047717
score: 1
type: AnswerComment
type: Comment
has text: "How can I handle Token Timeout" - Per jwt spec you need to set the "exp" claim. Jjwt provides a convenient "setExpiration" method for this.

http://stackoverflow.com/comment/36906078
type: Comment
comment on: http://stackoverflow.com/a/23941720
has text: *the Prototype pattern puts the responsibility of copying on the object to be copied, which is not the case if the client needs to provide the deserialization and serialization code* in Java, you can add `writeObject` and `readObject` methods in the classes to define the behavior when being serialized/deserialized, so, based on your explanation, this makes serialization/deserialization process even closer to Prototype implementation.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36690659
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23843216
has text: This is a gradle based project. I have placed it under src/main/resources. It is there under build directory also (resources/main/sample.properties).
score: 0

http://stackoverflow.com/q/23898470
has answer: http://stackoverflow.com/a/23898526
type: Question
has comment: http://stackoverflow.com/comment/36796567
score: 0
accepted answer: http://stackoverflow.com/a/23898526
answer count: 1
tagged with: exception
has comment: http://stackoverflow.com/comment/36796631
has body: I have code here which runs a short series of tests to see if the last element in the array is the expected number. The code that I have to put in goes where [???] is currently. //The answer must be the shortest possible class EmptyArrayException extends RuntimeException{} class ArrayUtil{ public static Object lastElement (Object[]array)[???]{ if(array.length&gt;0)return array[array.length-1]; throw new EmptyArrayException(); } } public class Exercise{ public static void test(){ assert ArrayUtil.lastElement(new Integer[]{1,2,3}).equals(3); assert ArrayUtil.lastElement(new Integer[]{1,2}).equals(2); assert ArrayUtil.lastElement(new Integer[]{1}).equals(1); assert ArrayUtil.lastElement(new Integer[]{}).equals(1); assert false:"Code not reachable"; } public static void main(String [] arg){ try{ test();} catch(Throwable t){/*the test suit logs t on the test results: a single place for error logging.*/} } } I assume that I would write ' throws EmptyArrayException ', but this is wrong. ' throws EmptyArrayException() ' is wrong too. So what do I put in the [???] space?
linked to: http://stackoverflow.com/q/5749898
has title: How to write exceptions (class x throws y)
has comment: http://stackoverflow.com/comment/36796612
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5749898
has comment: http://stackoverflow.com/comment/36796625
tagged with: java
tagged with: throws

http://stackoverflow.com/comment/36896247
comment on: http://stackoverflow.com/q/23875038
score: 3
type: Comment
has text: I don't know who gave -1 for this question, I think it is stupid enough to do so, since this question led me to another interesting investigation about how sonar shows 100% coverage. +1 from me
type: QuestionComment

http://stackoverflow.com/q/23930019
tagged with: charts
linked to: http://stackoverflow.com/q/22447540
has answer: http://stackoverflow.com/a/24010594
has comment: http://stackoverflow.com/comment/36867105
has title: Having Custom Labels on Y axis on an XY Dataset - JFreechart
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24010594
has comment: http://stackoverflow.com/comment/36955462
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36891040
has comment: http://stackoverflow.com/comment/37004400
tagged with: java
has body: I have the following XY Chart where the X axis are days and Y axis are the IDs of the elements that i want to represent. The problem is that the IDs that I am trying to represent has a vast range, say 0-50000, but not all of the values in that range occur on the plot every time. Say an average 10-20 values in that range might be on the plot each time it is generated. But these values are spread across the range. As you look at the attached figure, majority of the values are towards the lower end of the range (100-2000) and few values above the 10000 mark, because of which the graph is looking very skewed. And also I am actually passing the IDs as it is as the Y co-ordinate for the Y axis. I just wanted to know if there's a way where i can have a custom Y axis, where i can map the actual IDs to an intermediate index (for just the 10 items which i want to display) and use the actual IDs as custom labels on the Y axis after plotting? Can this be achieved?
tagged with: jfreechart
tagged with: plot
type: Question

http://stackoverflow.com/comment/36789597
has text: have you tried adding an explicit JSP import for java.util.Map$Entry?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23894856

http://stackoverflow.com/q/23835913
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23836354
has answer: http://stackoverflow.com/a/23836148
tagged with: c++
score: 2
has comment: http://stackoverflow.com/comment/36676548
tagged with: java
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23836375
has title: Accessing parent member from child of child class
tagged with: .net
has body: Today I faced a very odd interview question. The interviewer asked me:- There is a class Parent and it has a method GetData. Class Child1 inherits Parent and Child2 inherits Child1. What you can do in Parent class so that the method "GetData" will be accessible from Child1 but not from Child2?
answer count: 3
linked to: http://stackoverflow.com/q/860339
downvote count: 0

http://stackoverflow.com/a/23878137
has comment: http://stackoverflow.com/comment/106233559
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/106233165
answers question: http://stackoverflow.com/q/23851745
has body: I've tried all the proposed solutions here and other places but there was no help for Runtime.exec(). It seems, this is an internal buffer size problem in Runtime command. I found the same problem that runtime.exec() hangs. The problem was clearly described in the java docs which I just learned. “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.” Therefore, I decided to use ProcessBuilder instead of Runtime. It completely solved my problem. Below is the code I used for my problem: String[] strArr1 = new String[]{"catdoc", docFilePath}; ProcessBuilder probuilder = new ProcessBuilder( strArr1 ); Process process = probuilder.start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); FileWriter writeoutStream = new java.io.FileWriter(file.txt); while ((line = br.readLine()) != null) { writeoutStream.write(line); writeoutStream.write('\n'); } writeoutStream.close(); br.close(); isr.close(); is.close(); //Wait to get exit value try { int exitVal = process.waitFor(); System.out.println("\n\nExit Value is " + exitVal); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } This code works perfectly fine with different type of commands (short or long) and on different size of files (large or small). My problem is completely solved.
type: Answer
upvote count: 2

http://stackoverflow.com/comment/36761954
has text: Right, I know that, but how does changing from element to index help?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23880493

http://stackoverflow.com/a/23791227
accepted answer of: http://stackoverflow.com/q/23790770
answers question: http://stackoverflow.com/q/23790770
upvote count: 1
has comment: http://stackoverflow.com/comment/36638663
has comment: http://stackoverflow.com/comment/36592640
has body: You gonna need a list of all possible backgrounds and an index to know which one is the next. I would probably do something like this: private OnClickListener chavoshipicchangerlistener=new OnClickListener() { private final static List&lt;Integer&gt; backgrounds = new ArrayList&lt;Integer&gt;(){ add(R.drawable.mohsenchavoshione); add(R.drawable.mohsenchavoshitwo); add(R.drawable.mohsenchavoshithree); }; private int idx = 0; @Override public void onClick(View arg0) { // TODO Auto-generated method stub RelativeLayout relativlayout_ref = (RelativeLayout)findViewById(R.id.RelativeLayout1); idx++; if(idx &gt;= backgrounds.size()){ idx = 0; } relativlayout_ref.setBackgroundResource(backgrounds.get(idx)); } };
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36633018
has comment: http://stackoverflow.com/comment/36599420
type: Answer
has comment: http://stackoverflow.com/comment/36604165

http://stackoverflow.com/comment/36838173
has text: Yes this method is an option, but I'm thinking if there's a better design of doing so or holding data
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23920467
type: Comment

http://stackoverflow.com/comment/36691027
type: AnswerComment
comment on: http://stackoverflow.com/a/23843290
type: Comment
has text: @user3580294 Thanks a lot for the quick help. At least the complier starts working now! The new problem is: it has problems with the line `return merge( sort(leftArray), sort(rightArray));` which I find confusing because both methods `sort` and `merge` are extended to `Comparables` at src.MergeSort.sort(MergeSort.java):23)` any idea why that might be, eclipse does not mark anything at that line but keeps complaining about an unchecked from Object[] to T[].
score: 0

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/23928036
tags question: http://stackoverflow.com/q/23860122
tags question: http://stackoverflow.com/q/23916403
type: Tag

http://stackoverflow.com/q/23846216
upvote count: 1
has comment: http://stackoverflow.com/comment/36696519
type: Question
tagged with: ejb
has body: I have a database with this structure. I am using JSP + Servlet + Entity Classes from database + Session Beans for entity classes. As you can see, my tables are normalized which in return makes it necessary to join tables to obtain the whole details of a patient/staff. As i studied the https://netbeans.org/kb/docs/javaee/ecommerce/intro.html i saw that they access the database by using the facade.find etc and etc. Considering my case, I have also tried using the same thing. For example. I have a session bean (Profile Manager) which accesses the entities and puts it in the map. public Map getPatientDetails(int patientID) { Map patientMap = new HashMap(); Patient patient = patientFacade.find(patientID); User user = userFacade.find(patient.getUserId().getId()); UserContact userContact = user.getUserContact(); Family family = familyFacade.find(patient.getFamilyId().getId()); String patientDOB = new SimpleDateFormat("MMMMM dd, yyyy").format(user.getDateOfBirth()); patientMap.put("familyRecord", family); patientMap.put("patientRecord", patient); patientMap.put("patientDOB", patientDOB); patientMap.put("userRecord", user); patientMap.put("userContactRecord", userContact); return patientMap; } As I give myself time to think about it, I thought that I can join the entities by using and setting a namedquery instead making it a single access. Which is the right way to do this? Do you think using facades to access my database is better than constructing an inner join query to acheive getting all the information at once? What would you guys suggest? Thanks!
downvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/36696550
has comment: http://stackoverflow.com/comment/36696414
has answer: http://stackoverflow.com/a/23846289
has comment: http://stackoverflow.com/comment/36696600
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36696170
has title: EJB named query preference
has comment: http://stackoverflow.com/comment/36696595
score: 1
accepted answer: http://stackoverflow.com/a/23846289
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/23839004
downvote count: 0
answers question: http://stackoverflow.com/q/23838985
score: 4
type: Answer
upvote count: 4
has body: You need to add a return statement for every possible case in the code. It can be a case in which all the ifs evaluate to false and hence, no return statement will execute. Try this: public int tortoiseMoves() { int i = tGen(); if (i &gt;= 1 &amp;&amp; i &lt;= 5) { int fastplod = 3; return fastplod; } if (i &gt;= 6 &amp;&amp; i &lt;= 8) { int slowplod = 1; return slowplod; } if (i &gt;= 9 &amp;&amp; i &lt;= 10) { int slip = -6; return slip; } return Something to return if none of the ifs is true } Althought you can change the code to this: public int tortoiseMoves() { int i = tGen(); if (i &gt;= 1 &amp;&amp; i &lt;= 5) { int fastplod = 3; return fastplod; } else if (i &gt;= 6 &amp;&amp; i &lt;= 8){ int slowplod = 1; return slowplod; } else if (i &gt;= 9 &amp;&amp; i &lt;= 10) { int slip = -6; return slip; } else { return Something if none of the ifs is true } }

http://stackoverflow.com/a/23841400
accepted answer of: http://stackoverflow.com/q/23841361
answers question: http://stackoverflow.com/q/23841361
has comment: http://stackoverflow.com/comment/36687395
type: AcceptedAnswer
has body: It works if you just pass the Icons, the option pane will create the buttons for you: Object[] options = {icoR, icoI}; So I guess if you pass the buttons it assumes that you will handle the closing of the option pane yourself. As a work around you can use the Compound Icon class to create an Icon containing text and your image. You might also want to use the Text Icon which you can also find from the above link. When you create the TextIcon you will probably need to use: setFont( UIManager.getFont("Button.font") ); to set the font of the TextIcon to be the same as the button.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36687903
has comment: http://stackoverflow.com/comment/36687407
downvote count: 0
score: 1

http://stackoverflow.com/comment/87163471
comment on: http://stackoverflow.com/q/23814439
has text: did you find any solution?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36651390
comment on: http://stackoverflow.com/a/23822711
type: AnswerComment
type: Comment
has text: This will "fail" on tabs and similar whitespace.
score: 1

ignore-case
type: Tag
tags question: http://stackoverflow.com/q/23884914
tag name: ignore-case

http://stackoverflow.com/comment/36596677
type: Comment
comment on: http://stackoverflow.com/a/23791742
has text: @CasimiretHippolyte Thank you very much for the explanation. I have a question though. At the end of the pattern after we exit the non-capturing group. Is there a need for a `[A-Z]+\1?` Don't we come out of the capturing group always a character before the hyphens? wouldn't `[A-Z]\1?` suffice?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36653484
comment on: http://stackoverflow.com/q/23823741
has text: Also, what do you mean by `doesn't work`? `HashMap` should have a proper `toString()` method...
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23831094
downvote count: 1
answers question: http://stackoverflow.com/q/23830882
score: -1
has body: The right way to create a random integer i is: Double d = Math.random()*100; int i = d.intValue();
upvote count: 0
type: Answer

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/23854328
type: Tag
tags question: http://stackoverflow.com/q/23846981
tags question: http://stackoverflow.com/q/23856618
tags question: http://stackoverflow.com/q/23851500
tags question: http://stackoverflow.com/q/23852798

http://stackoverflow.com/q/23804120
answer count: 1
downvote count: 0
favorite count: 0
has body: I tried to configure Ivy to download source code for dependencies. It works, but only for the top-level dependency. Maven will get sources for all levels of dependencies. How can I do this using Ivy? Here is my ivy.xml file: <info organisation="com.ubs" module="IMQuant"/> default,sources"> <dependency org="junit" name="junit" rev="4.11"/> <dependency org="org.apache.maven.surefire" name="common-java5" rev="2.17"/> <dependency org="com.googlecode.kevinarpe-papaya" name="kevinarpe-papaya" rev="0.0.15"/> Here is my retreive statement: <ivy:retrieve pattern="${libs.dir}/ivy/all/[artifact]-[revision]-[type].[ext]" /> Above, dependency kevinarpe-papaya requires Google Guava. I see the JAR downloaded (actually a bundle), but I don't see the sources. I checked my Ivy cache. The sources are also missing for Google Guava. Also, dependency junit requires Hamcrest (core). Again, I see the JAR downloaded, but I don't see the sources. (Also, I checked my Ivy cache.)
has answer: http://stackoverflow.com/a/34749506
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: ivy
type: Question
tagged with: ant
has title: Ant Ivy: How to retrieve source code for all levels of dependencies?

http://stackoverflow.com/comment/36753280
type: QuestionComment
has text: Yes, with the proper anottation.
score: 0
comment on: http://stackoverflow.com/q/23869829
type: Comment

http://stackoverflow.com/a/23873546
answers question: http://stackoverflow.com/q/23873341
has body: Yes, it is possible. I faced a similar situation earlier. Just follow these steps : Copy the project to the other desktop. Go to File -> Import -> General -> Existing Projects into workspace. Browse and select your project folder and import the files.
score: 0
type: Answer

http://stackoverflow.com/q/23788026
has title: Moving from Spring HTTP invoker to load balanced solution
has comment: http://stackoverflow.com/comment/36629139
upvote count: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36592787
type: UnansweredQuestion
tagged with: spring
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36650205
tagged with: http
type: Question
has body: Our application currently uses Spring's HttpInvokerProxyFactoryBean to expose a Java service interface, with POJO requests and responses handled by our single Tomcat server. This solution allows us to have a pure Java client and server, sharing the same Java interface. Due to increased load, we are now looking into the possibility of load balancing across multiple Tomcat instances. It would be nice if we could make this transition while retaining the same Java interface, as this would minimise the additional development required. Googling seems to suggest that the most common solution for Tomcat load balancing is to use Apache http server together with mod_jk, but I presume this would mean using some communication mechanism other than Spring's HTTP invoker? Is there a better solution which would allow us to retain more of our current code? If not, what would be involved in transitioning between what we have now and Apache/mod_jk? Any help would be greatly appreciated as I don't have any experience in this matter.
tagged with: load-balancing

http://stackoverflow.com/comment/36652720
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23809018
has text: Yeah.. i went to sleep and got the same idea.... will work on it... Thank you guys
type: Comment

http://stackoverflow.com/comment/36684837
type: QuestionComment
has text: Okay, nevermind then.
score: 0
comment on: http://stackoverflow.com/q/23839782
type: Comment

http://stackoverflow.com/q/23875462
type: UnansweredQuestion
tagged with: face-detection
has comment: http://stackoverflow.com/comment/36767414
type: Question
has answer: http://stackoverflow.com/a/24113293
has comment: http://stackoverflow.com/comment/36756541
favorite count: 0
upvote count: 1
answer count: 1
tagged with: opencv
has body: Im trying to make a realtime face detection programming for tracking faces in a room with a webcam. However when i am doing this it gives me not more then 4 frames per second (every 267ms). I know that other people that use OpenCV can get &lt;20ms with using TBB/OpenMP. I would like to get atleast 10 frames per second. Here are the actions I already have done to speed up the process: I am detecting faces on a grayscale of my image. I am using a scaling factor of 1.1 I have both minimum and maximum values set. My question in short is: How come my code is so slow in comparison to others? Does my code not use OpenMP or TBB? How do i get my code to use it? Is it even possible in java to use OpenMP or TBB? I am running the program on my Late 2012 MacBook (Core i7, 4Gb RAM) with windows installed. Here is my current code: public class FaceDetector { CascadeClassifier faceDetector; public FaceDetector(){ faceDetector = new CascadeClassifier(new File("haarcascade_frontalface_alt.xml").getPath()); } /** Image will be overwritten by an image with detected faces on it **/ public Rect[] getFaces(Mat image){ MatOfRect faceDetections = new MatOfRect(); Mat mGray = image; Imgproc.cvtColor(image, mGray, Imgproc.COLOR_RGBA2GRAY); // Convert to grayscale faceDetector.detectMultiScale(image, faceDetections, 1.1, 2, 2,new Size(40, 40), new Size(400, 400)); for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } return faceDetections.toArray(); } } Thanks in advance! Milan van Dijck (Student at Avans University of Applied Sciences)
tagged with: performance
score: 0
tagged with: java
downvote count: 1
has title: How do i speed up face detection in OpenCV in Java

http://stackoverflow.com/a/23918589
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23909842
score: 2
answers question: http://stackoverflow.com/q/23909842
type: AcceptedAnswer
has body: You should change .settings(play.Project.playJavaSettings) to .settings(play.Project.playJavaSettings: _*) The settings method is declared as def settings(ss: Setting[_]*), which means it takes repeated parameters of type Setting[_]. The play.Project.playJavaSettings is of type Seq[Setting[_]]. To convert one to another Scala has a special type annotation. If you are interested in details check 4.6.2 Repeated Parameters of The Scala Language Specification
downvote count: 0
type: Answer

http://stackoverflow.com/q/23832657
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36670647
has comment: http://stackoverflow.com/comment/36671704
score: 2
has body: I am a bit confused about the process to create a .bat file of a java application. I have exported the executable jar using IDE say Application.jar in C: directory. Then I have written two lines in a .txt file as stated below and saved it as .bat file in the same directory where i have my application.jar. But on double click of the .bat file, the application is not getting executed. .BAT file code javac Application.java java -cp . Application Note: I have also set the JRE and JDK path in my environment variables till bin path in My Computer properties. But it is not working. Can someone suggest me how can I fix this, because I want to execute my code by doubleclickng on a .bat file. It will be nice if someone can provide me every step I need to follow to accomplish this as I havent ever done this before. Thanks ,
has comment: http://stackoverflow.com/comment/36671994
has answer: http://stackoverflow.com/a/23833938
tagged with: java
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36670171
has answer: http://stackoverflow.com/a/23832878
has comment: http://stackoverflow.com/comment/36670225
has title: Creation of a .bat file of a java application
favorite count: 0
has comment: http://stackoverflow.com/comment/36673168
upvote count: 2

http://stackoverflow.com/comment/36596439
type: QuestionComment
comment on: http://stackoverflow.com/q/23792976
has text: Make sure to dispose of the current Graphics context before returning it
score: 0
type: Comment

google-maps
tags question: http://stackoverflow.com/q/23898964
tag name: google-maps
tags question: http://stackoverflow.com/q/23881658
tags question: http://stackoverflow.com/q/23819737
tags question: http://stackoverflow.com/q/23833326
tags question: http://stackoverflow.com/q/23883106
tags question: http://stackoverflow.com/q/23827773
tags question: http://stackoverflow.com/q/23840004
tags question: http://stackoverflow.com/q/23894579
type: Tag
tags question: http://stackoverflow.com/q/23927659
tags question: http://stackoverflow.com/q/23929229
tags question: http://stackoverflow.com/q/23857169
tags question: http://stackoverflow.com/q/23831204
tags question: http://stackoverflow.com/q/23909480

http://stackoverflow.com/comment/36675099
comment on: http://stackoverflow.com/q/23835182
score: 1
has text: @PaulG ;) As I said I am not talking about the Object that a is pointing to but the `a` variable itself. proof is in my example `a.equals(a = null)` returns false because after the call of equals() `a` is pointing to `null`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36688919
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23842227
score: 0
has text: Thank you! How would I go about getting the second leg, etc in the journey using the iterator, would that also be possible?

http://stackoverflow.com/q/23916053
answer count: 1
downvote count: 0
has title: How to change Hibernate connection.url property from java code at application startup
tagged with: hsqldb
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23916738
tagged with: properties
has body: hibernate.cfg.xml : org.hsqldb.jdbcDriver jdbc:hsqldb:file:mycustomurl sa I have a custom installation folder for my application where i want to locate my hsql database.Problem is that i initialize location in main class of my application each time on startup.How can i change jdbc:hsqldb:file:mycustomurl mycustomurl from my main application ?So i can work with user defined application directory?I woud also want to change username/password property from main class.Where i will generate password from license file each time on startup.Is there a way to do it?I have tryed many ways bud methods/tutorials that i found were deprecated.I use latest version of hibernate/hsqldb . Can i maybe generate hibernate.cfg.xml somewhere on hdd then (somehow) load it ?Whats the best way to solve this problem?
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has comment: http://stackoverflow.com/comment/36829565
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/36829854
has comment: http://stackoverflow.com/comment/36830169
has comment: http://stackoverflow.com/comment/36829525
has comment: http://stackoverflow.com/comment/36830404

http://stackoverflow.com/comment/36748153
comment on: http://stackoverflow.com/a/23872933
type: Comment
has text: Okay I put the reset just outside the try catch and it works. But I have to press play again for it to play the next song. How can I just get it to play by itself?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36578727
comment on: http://stackoverflow.com/a/23784233
score: 0
type: Comment
has text: @Abimaran, check Integer.IntegerCache. I will look for JLS and link in couple of moments - once I find it... "adjustments" like that are not on the 1st page of java doc. ;-/
type: AnswerComment

http://stackoverflow.com/q/23806565
linked to: http://stackoverflow.com/q/6546193
has title: Errors are fatal in nature.... for process or for thread?
score: 0
answer count: 1
tagged with: hsqldb
has answer: http://stackoverflow.com/a/23806676
tagged with: exception
type: UnansweredQuestion
has body: In my program there are 3 threads. Thread 1 is responsible for populating records from MYSQL database which has currently 279381 records into queue. Thread 2 and Thread 3 read and process records from queue and insert them into the HSQL database. As per my expectoration, I got OutOfMemoryError on Thread 1 but to my surprise instead of terminating my process, my Thread 3 is still running. Isn’t it a weird behavior? I always thought that Errors are fatal. They are at jvm level and program gets terminated on their occurrence. But I think that Errors are Thread specific and If program can continue even on their occurrence, why we are not allowed to catch them ? Or there is still something about which I am unaware of? I expect experts will show some light on it. I am attaching the console output. LL populated :: 558759 Rows Read from Hospital Database ::279381 Total Rows in HSQL :: 119699 8931464 In Read HSQL LL populated :: 558759Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space at java.nio.CharBuffer.wrap(CharBuffer.java:369) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:265) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129) at java.io.PrintStream.newLine(PrintStream.java:545) at java.io.PrintStream.println(PrintStream.java:807) at XXXX.readResultSet(XXXX.java:196) at java.lang.Thread.run(Thread.java:722) java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.executeQuery(Unknown Source) at YYYY.readHSQL(YYYY.java:203) at java.lang.Thread.run(Thread.java:722) Caused by: org.hsqldb.HsqlException: java.lang.OutOfMemoryError: Java heap space at org.hsqldb.error.Error.error(Unknown Source…
tagged with: java
tagged with: multithreading
tagged with: mysql
type: Question

http://stackoverflow.com/comment/36629012
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23811009
has text: I've added that inner class up at the top of my main class, then replaced that huge block of code with your getRootPane() thing(plus the other 3 directions), but I'm not getting any response for any of the 4 directions.
score: 0

http://stackoverflow.com/q/23852516
answer count: 1
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36708749
has answer: http://stackoverflow.com/a/23852535
has comment: http://stackoverflow.com/comment/36708707
has title: Java Array Object compile issue
has comment: http://stackoverflow.com/comment/36708721
has body: The following code get's an error when compiled. I know it's missing something but I just can't figure out what. public class Books { String title; String author; public static void main(String[] args) { // TODO Auto-generated method stub Books[] myBooks = new Books[3]; myBooks[0].title = "Learn Java"; myBooks[1].title = "Java Development"; myBooks[2].title = "Java Today!"; myBooks[0].author = "S"; myBooks[1].author = "Mr. S"; myBooks[2].author = "SN"; int x = 0; while (x &lt; myBooks.length) { x = x + 1; System.out.print(myBooks[x].title); System.out.print(" by "); System.out.println(myBooks[x].author); } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/36708999
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36708716
upvote count: 1
has comment: http://stackoverflow.com/comment/36708761
tagged with: object
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36708662
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/218384
type: Question

http://stackoverflow.com/comment/37008757
type: Comment
has text: @Dennis http://www.mkyong.com/hibernate/hibernate-cascade-example-save-update-delete-and-delete-orphan/ - here you can find decent information on this. Although the examples are in XML mapping, for annotation-based you should have the same properties.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23910732

hashmap
tags question: http://stackoverflow.com/q/23822776
tags question: http://stackoverflow.com/q/23828425
tags question: http://stackoverflow.com/q/23855878
tags question: http://stackoverflow.com/q/23859041
tags question: http://stackoverflow.com/q/23824684
tags question: http://stackoverflow.com/q/23827599
tags question: http://stackoverflow.com/q/23779163
tags question: http://stackoverflow.com/q/23859686
tags question: http://stackoverflow.com/q/23888438
tags question: http://stackoverflow.com/q/23797300
type: Tag
tags question: http://stackoverflow.com/q/23817269
tags question: http://stackoverflow.com/q/23849239
tags question: http://stackoverflow.com/q/23790423
tags question: http://stackoverflow.com/q/23842117
tags question: http://stackoverflow.com/q/23938070
tags question: http://stackoverflow.com/q/23851835
tags question: http://stackoverflow.com/q/23908472
tags question: http://stackoverflow.com/q/23805861
tags question: http://stackoverflow.com/q/23872945
tags question: http://stackoverflow.com/q/23780310
tag name: hashmap
tags question: http://stackoverflow.com/q/23792020
tags question: http://stackoverflow.com/q/23828358
tags question: http://stackoverflow.com/q/23841142

http://stackoverflow.com/comment/36858414
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23931485
type: Comment
has text: @user3686971 What is it that you do not know? How to add a third column to your SQL result? OR how to query things with JDBC (Admittedly I used Spring JDBCTemplate, not raw)?

http://stackoverflow.com/comment/36653280
has text: @pokerface: what does System.out.println(mList.get(0).getClass()); output?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23823166
type: AnswerComment

http://stackoverflow.com/a/23783033
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23782750
has body: Try this, if(!"".equals(your string) { // do something }

http://stackoverflow.com/q/23821606
type: Question
has comment: http://stackoverflow.com/comment/36650234
tagged with: java
tagged with: overriding
has body: In the following code snippet class Shape { public void area() { System.out.println("This is Shape"); } } class Rectangle extends Shape { @Override public void area() { System.out.println("This is Rectangle"); } } class Main { public static void main(String[] args) } Shape rect = new Rectangle(); rect.area(); // Can i force java to call Shape's area instead of Rectangle's area // This is possible in C++ if the function is not virtual. } } Can i force java to call Shape's area instead of Rectangle's area ? EDIT : No, But why has Java overlooked this feature, something that is not as dangerous as pointers ?
answer count: 2
has title: Java: Calling a base class function which is overriden,using object of inherited class?
has answer: http://stackoverflow.com/a/23821688
has comment: http://stackoverflow.com/comment/36649645
has answer: http://stackoverflow.com/a/23821883
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36970370
has text: @DavidWallace yes, confirmed.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23924963
type: Comment

http://stackoverflow.com/comment/36640419
type: QuestionComment
has text: So you're implementing a polling thread? Look into [`ScheduledExectuorService`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html).
comment on: http://stackoverflow.com/q/23816769
score: 0
type: Comment

http://stackoverflow.com/comment/36653187
score: 0
type: QuestionComment
type: Comment
has text: what is `parent`? where is it initialized
comment on: http://stackoverflow.com/q/23823648

http://stackoverflow.com/comment/36648764
type: Comment
comment on: http://stackoverflow.com/a/23821022
has text: @camickr, I have read the tutorial, but they drive me crazy, because none may put just simple example.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23791815
tagged with: spring-mvc
tagged with: foreach
tagged with: java
tagged with: hibernate
type: Question
score: 0
has answer: http://stackoverflow.com/a/23791869
answer count: 1
has title: Interation on Sets using for-each loops
type: UnansweredQuestion
has body: @Transactional public Object[] cityAgents(Province province, Set&lt;ProvinceAgents&gt; agents,Set&lt;ProvinceAgentDetails&gt; details) { province.setCityagents(agents); for(ProvinceAgents agent : agents){ for(ProvinceAgentDetails detail :details){ agent.setCityagentdetails(detail); detail.setAgent(agent); } return cityDAO.saveBoth(province, agent); } return null; } } This method is from my Service with @transactional annotation. I want to set detail for each agent. However , its setting all the details for only one agent. Is there any way out , I can make my inner for-each loop to work for 1st user only and other time when outer loop iterates , my inner loop put details corresponding to 2nd user Thanks for help appreciated

http://stackoverflow.com/comment/36617726
comment on: http://stackoverflow.com/a/23803267
type: Comment
has text: It is safe to use "Thread.sleep(...)" out of a runnable? I don't want to risk freeze the view. However, i noticed that you wrote "GameModel implements ActionListener" above. Maybe you meant "GameController" instead of "GameModel"? Ps: my GameController class is a singleton.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36787313
score: 2
comment on: http://stackoverflow.com/q/23893478
has text: When working with Spring, the bean lifecycle is managed by Spring's application context. So whenever you call `new SomeBean` you are doing it wrong. Such bean would be created outside of Spring's influence -> i.e. no relation to Spring, no autowiring, no AOP, ...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36626067
type: QuestionComment
comment on: http://stackoverflow.com/q/23809386
has text: by minimal example you mean showing what it does so far, or what it's supposed to do?
score: 0
type: Comment

http://stackoverflow.com/q/23789525
has body: I'm trying to use the onScroll event listener of a TableView component: FXML: Java Controller: @FXML void doSomething(ActionEvent event) { System.out.println("Object: " + event.getSource()); } But it does not working! What I'm doing wrong? I need to capture the vertical scroller to manually control the scroll position and fetch related data according to scroll down or up. Thanks everybody!
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23793896
type: Question
accepted answer: http://stackoverflow.com/a/23793896
upvote count: 1
answer count: 1
downvote count: 0
has title: onScroll listener does not working in TableView in JavaFX 2
favorite count: 0

http://stackoverflow.com/a/23787706
score: 5
type: AcceptedAnswer
has body: All your methods are private, this is why the default javadoc command will output only your main method (which is the only public method). In order to output also private methods, use the -private option. Here is the available operators for javadoc about visibility : -public Show only public classes and members -protected Show protected/public classes and members (default) -package Show package/protected/public classes and members -private Show all classes and members
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/23787588
answers question: http://stackoverflow.com/q/23787588
downvote count: 0

http://stackoverflow.com/q/23804094
has answer: http://stackoverflow.com/a/23806997
has body: Im using 2 different xml Files to store data i need. When starting the App i want to read those 2 resources and generate Objects from it. Let me explain, what it is i'm doing: The first resource stores event-names like this: /res/values/event_names.xml <?xml version="1.0" encoding="utf-8"?> AAAA BBBB CCCC DDDD The seconds resource stores the times, that given events kick off: /res/values/event_times.xml <?xml version="1.0" encoding="utf-8"?> 02:00 11:30 17:00 03:00 12:30 18:00 04:00 13:30 19:00 04:30 10:00 15:00 20:00 Note, that event names and times have their name in commom. On startup the App will read the event-names first and then find out their correspondent timestamps. Can i do it the way i planned this out? I'd have to read all the identifiers from the name-resource and then by that identifier get the times.
answer count: 3
has answer: http://stackoverflow.com/a/23804216
tagged with: android
has answer: http://stackoverflow.com/a/23806387
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has title: Reading custom String resources
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36615665
type: Question

http://stackoverflow.com/q/23790741
has title: smartGWT date input validator
favorite count: 0
accepted answer: http://stackoverflow.com/a/23791591
tagged with: smartgwt
has answer: http://stackoverflow.com/a/23790838
score: 1
upvote count: 1
possible better answer: http://stackoverflow.com/a/23790838
tagged with: gwt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23791591
tagged with: java
type: Question
answer count: 2
has body: I'm using DateTimeItem for my start and end dates. I don't want the user to be able to select invalid dates, like 13/44/2014: First image is a example of valid date, the second (one below) is a invalid date. How do I avoid the second one from happening?
downvote count: 0

http://stackoverflow.com/comment/36753824
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23876456
type: Comment
has text: Don't I know that `i` is an int? So can I just get rid of that?

http://stackoverflow.com/q/23934832
type: Question
tagged with: arrays
has title: Arrays and read and write text files issue - Java
tagged with: arraylist
score: 0
answer count: 1
tagged with: buffer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23934847
has body: Here is what I have to do... Input File: dishin.txt Output File: dishout.txt Time Limit: 1 second You do not like statisticians, and statisticians do not like you. Ever since that life actuary kicked sand into your ice cream when you were four, you have waged a slowly escalating war against those number-crunching jerks. But all that is about to change. After many sleepless nights you have conceived the ultimate revenge: beating them at their own game. Using your computer programming skills, you will write a freeware statistics package so thorough, so complete, that statisticians all around the world will be out of a job. It will be able to predict weather patterns, calculate life expectancies, and even play the perfect poker game. First, though, you must implement word wrap. However, this task is rather finnicky, not very mathematical in nature, and ultimately not very important. More urgently, you also need to implement some basic data analysis. Specifically, you decide to write a test program that takes a data set (a list of integers) and calculates the following measures of spread: Minimum - the smallest value in the list. For example, the minimum of the numbers {5, 6, 5, 3} is 3. Maximum - the largest value in the list. For example, the maximum of the numbers {5, 6, 5, 3} is 6. Mean (or average) - defined as the sum of everything in the list divided by the number of items in the list. For example, the mean of the numbers {5, 6, 5, 3} is (5+6+5+3)/4 = 19/4 = 4.75. However for simplicity you are asked to round all answers down to the nearest whole number. So the mean of the numbers {5, 6, 3, 3}, rounded down, is 4. Input: The first line of input will consist of a single integer n (1 <= n <= 1,000), the size of your data set. The following n lines will describe the data set. Each of these lines contains an integer between 0 and 1,000,000 inclusive. Output The output file should consist of three integers separated by spaces: the minimum, maximum and mean of the data…
tagged with: java
tagged with: file

http://stackoverflow.com/comment/36680551
has text: That would be correct according to the supplied snippet, Laambi however got the gist of what I was wanting to do and really got me on the correct path.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23837974

http://stackoverflow.com/q/23898554
has answer: http://stackoverflow.com/a/59997670
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23944074
upvote count: 7
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36809539
has body: Java newbie here, Using jdk1.8.0_05, I seem to be unable to resolve the java.nio.file.Files class import java.nio.file.Files; with the following error: The import java.nio.file.Files cannot be resolved All other java.nio.file.* Classes (Path, Paths, FileSystem, etc.) seem to resolve just fine. Based on other answers I've made sure of the following: Java build path set to JRE System Library jre8 for the project Set workspace compiler compliance level to 1.7, as high as it goes I'm using eclipse 3.7.2. Thanks for the help
tagged with: java
has comment: http://stackoverflow.com/comment/36796952
tagged with: eclipse
score: 6
answer count: 2
has comment: http://stackoverflow.com/comment/36798590
has comment: http://stackoverflow.com/comment/36800388
accepted answer: http://stackoverflow.com/a/23944074
has comment: http://stackoverflow.com/comment/36796805
has title: Error: The import java.nio.file.Files cannot be resolved
has comment: http://stackoverflow.com/comment/36797044
favorite count: 0
possible better answer: http://stackoverflow.com/a/59997670
has comment: http://stackoverflow.com/comment/36817906

http://stackoverflow.com/q/23895663
tagged with: m2eclipse
accepted answer: http://stackoverflow.com/a/23895677
type: Question
possible better answer: http://stackoverflow.com/a/23895692
has answer: http://stackoverflow.com/a/23895692
answer count: 2
has title: m2eclipse maven build parameters
downvote count: 0
favorite count: 0
has body: I am developing a spring mvc app using eclipse kepler with the m2eclipse plugin. How do I create a war file from within eclipse using the m2e plugin? Do I use run as... maven build...? If so, how do I configure it? I right clicked on the root folder for the app in the eclipse workspace and chose run as... maven build..., which resulted in the following dialog box: But I do not know what parameters to enter into the dialog box. Can anyone guide me through how to create the war file?
has answer: http://stackoverflow.com/a/23895677
tagged with: maven
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/62672138
comment on: http://stackoverflow.com/a/23890126
score: 0
type: AnswerComment
has text: That is annoying, I had path with `...\upload\...` in the comments and got the error message, so you even have to escape your comments !
type: Comment

http://stackoverflow.com/comment/36795107
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23897604
has text: I am using Jacorb with java if that's the question

http://stackoverflow.com/comment/36764664
type: QuestionComment
comment on: http://stackoverflow.com/q/23881999
score: 2
has text: Are you receiving json output in response ? Please check it first. You parsing code looks fine to me
type: Comment

http://stackoverflow.com/a/23790354
has comment: http://stackoverflow.com/comment/36590272
has body: The notified thread needs to re-acquire the lock, but that re-acquisition happens within the call to wait and the thread has the lock once it returns from the wait method, then it starts executing at line 3. Peter's answer is correct (+1). The javadoc for wait supports this, it says: The thread T is then removed from the wait set for this object and re-enabled for thread scheduling. It then competes in the usual manner with other threads for the right to synchronize on the object; once it has gained control of the object, all its synchronization claims on the object are restored to the status quo ante - that is, to the situation as of the time that the wait method was invoked. Thread T then returns from the invocation of the wait method. Thus, on return from the wait method, the synchronization state of the object and of thread T is exactly as it was when the wait method was invoked. You can test this. If the thread had to start over at the top of the block then you could get by with an if test to check the condition, because once the thread was notified it would still have to make it past the condition test. If the thread picks up where it left off you need the while loop, because the thread needs to check that the condition that made it have to wait is not still true. If you replace the while loop with an if statement and run a multi-threaded test (for instance, you could create a queue, a homegrown one where you can tamper with its put and take methods, with multiple producers and consumers where the consumers are waiting for the queue to be non-empty) then you should be able to see cases where the thread waits, then proceeds even though the condition shouldn't let it (resulting in trying to take something from an empty queue).
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23789987
answers question: http://stackoverflow.com/q/23789987
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/36849030
has text: Hi Marco, I tried your solution. But it is actually restoring the default image/grah. Something like: 1. I have a graph. 2. I zoom in multiple times. 3. on executing double zoom = (double)windowWidth/graphWidth, it is replacing with the original graph as seen in step 1.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23904224
score: 0

http://stackoverflow.com/comment/36813311
type: Comment
comment on: http://stackoverflow.com/a/23906100
has text: i tried doReturningWork() still doesnt let me to use local sql variable
type: AnswerComment
score: 0

http://stackoverflow.com/q/23817000
has answer: http://stackoverflow.com/a/23817174
tagged with: code-elimination
type: Question
has answer: http://stackoverflow.com/a/23817112
type: AnsweredQuestion
tagged with: java
score: 12
linked to: http://stackoverflow.com/q/17965562
answer count: 2
possible better answer: http://stackoverflow.com/a/23817174
favorite count: 0
tagged with: javac
has comment: http://stackoverflow.com/comment/36640704
has body: As discussed here, javac and other Java compilers may provide code elimination capabilities for if-statements where the condition is a "Constant Expression". How is this affected if my code uses a constant expression that depends on other constant expressions defined in different packages? For example, let's say I have the following classes in the respective specified packages: package foo; public class Foo { public static final boolean CONDITION = false; } and package bar; import foo.Foo; public class Bar { public void test() { if (Foo.CONDITION) { System.out.println("This line of code could be eliminated."); } else { System.out.println("This line of code will be executed."); } } } Clearly, if the foo-package is loaded at run-time from an external jar-file, the compiler can't technically just assume that Foo.CONDITION will be false and should not eliminate the true-branch of the if-statement. Whereas, if Foo and Bar were actually in the same package, the true-branch should definitely be eliminated (if the compiler supports code elimination at all). Not quite sure how to best phrase this question, but: How "close" does Foo need to be to Bar for a constant expression in Foo to also be considered constant in Bar? Would they need to be in the same file? the same package? the same jar-file? or does it not matter at all (i.e. would the compiler always consider Foo.CONDITION as constant and use the value found in the build-path during compile time)?
tagged with: constant-expression
has title: Java constant expressions and code elimination
has comment: http://stackoverflow.com/comment/36640737
accepted answer: http://stackoverflow.com/a/23817112
upvote count: 12
downvote count: 0
tagged with: dead-code

http://stackoverflow.com/comment/36874708
comment on: http://stackoverflow.com/a/23874976
score: 0
type: Comment
has text: I'm going to follow that advice and manipulate the images to achieve the effect, thank you for the tip :)
type: AnswerComment

http://stackoverflow.com/q/23827787
type: AnsweredQuestion
has body: Very weird bug I use ListPreference on android. And when using setIcon() method for it in the Samsung gio s5660 with android 2.3.3 I've got : 05-23 14:14:31.169: E/AndroidRuntime(1572): FATAL EXCEPTION: main 05-23 14:14:31.169: E/AndroidRuntime(1572): java.lang.NoSuchMethodError: android.preference.ListPreference.setIcon 05-23 14:14:31.169: E/AndroidRuntime(1572): at com.assignmentexpert.AssignmentPref.enableOnlyAssignmentProduct(AssignmentPref.java:2022) 05-23 14:14:31.169: E/AndroidRuntime(1572): at com.assignmentexpert.AssignmentPref.onResume(AssignmentPref.java:2003) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.app.Activity.performResume(Activity.java:3832) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2114) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:170) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:321) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:676) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.widget.TabHost.setCurrentTab(TabHost.java:348) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:141) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.view.View.performClick(View.java:2485) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.view.View$PerformClick.run(View.java:9080) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.os.Handler.handleCallback(Handler.java:587) 05-23 14:14:31.169: E/AndroidRuntime(1572): at android.os.Handler.dispatchMessag…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36661525
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/23827840
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23827840
has answer: http://stackoverflow.com/a/23828390
accepted answer: http://stackoverflow.com/a/23828390
has comment: http://stackoverflow.com/comment/36660651
downvote count: 5
has title: ListPreference android 2.3.3 setIcon : NoSuchMethodError
score: -4
tagged with: listpreference
tagged with: nosuchmethoderror

unique
tags question: http://stackoverflow.com/q/23919803
tags question: http://stackoverflow.com/q/23897814
tag name: unique
tags question: http://stackoverflow.com/q/23900391
type: Tag

http://stackoverflow.com/comment/36679598
comment on: http://stackoverflow.com/a/23837453
score: 0
type: Comment
has text: i get error on getString: The method getString(int, Object...) in the type Context is not applicable for the arguments (String, String). Outside the onCreate i have change string fnail LOCATION_KEY = "key": to String LOCATION_KEY = "key";
type: AnswerComment

http://stackoverflow.com/a/23896495
upvote count: 1
downvote count: 1
score: 0
has body: Date formatting in Java is a terrible pain, so it is unlikely that you will find a one-liner. However, you should be able to use a SimpleDateFormat like so (untested): String format = "yyyy-MM-dd HH:mm z"; // &lt;-- change as needed DateFormat formatter = new SimpleDateFormat(format); Timestamp timestamp = resultSet.getTimestamp("some_date"); String dateString = formatter.format(new java.util.Date(timestamp.getTime()));
answers question: http://stackoverflow.com/q/23896256
type: Answer

http://stackoverflow.com/q/23905017
has title: Error while connecting to http service using NT credentials
score: 1
tagged with: java
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/36852274
tagged with: rest
downvote count: 0
has body: I am connecting to mail server EWS(Webservice) using below code, the connection is successful But I am getting below warning, could you please help me in understanding what this warning means? "org.apache.http.client.protocol.RequestTargetAuthentication@:process NEGOTIATE authentication error: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt))." private void initializeCredentials() { Credentials credentials = new org.apache.http.auth.NTCredentials(userName, password, hostname, ""); ThreadLocalCredentialsProviderFactory.set(credentials); }
favorite count: 0
tagged with: apache-httpclient-4.x
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/23804764
has body: We are currently developing a Scala and Akka Cluster based product for medical archives. In the code there is a lot of if(logger.isDebugEnabled()) { logger.debug(expensiveFunction()) } In our previous codes with standard SQL/JPA, blocking I/O and lots of threads, this construction was more or less for free. However, today in the era of reactive programming, CPU cache synchronization and memory barriers and locks are considered expensive and should be avoided. Is the Logback isDebugEnabled() resulting in a volatile access and hence a memory barrier. If so, is having a lot of logger.isDebugEnabled() a potential performance killer? There is an excellent blogpost on the topic of CPU cache synchronization and memory barriers: http://mechanical-sympathy.blogspot.se/2013/02/cpu-cache-flushing-fallacy.html
has comment: http://stackoverflow.com/comment/36616924
has comment: http://stackoverflow.com/comment/36617344
tagged with: volatile
downvote count: 0
has answer: http://stackoverflow.com/a/23804991
has comment: http://stackoverflow.com/comment/36617080
favorite count: 0
has answer: http://stackoverflow.com/a/23805712
linked to: http://stackoverflow.com/q/4633866
has title: Is logback isDebugEnabled() slow on a multi core CPU?
tagged with: memory-barriers
type: AnsweredQuestion
score: 3
tagged with: performance
accepted answer: http://stackoverflow.com/a/24362991
tagged with: java
has comment: http://stackoverflow.com/comment/36616826
possible better answer: http://stackoverflow.com/a/23804991
type: Question
has answer: http://stackoverflow.com/a/24362991
has comment: http://stackoverflow.com/comment/36617271
has comment: http://stackoverflow.com/comment/36617141
tagged with: logback
upvote count: 3
has comment: http://stackoverflow.com/comment/36617021
answer count: 3

http://stackoverflow.com/q/23910822
has title: Pattern for configuring @BeforeClass and @Before Methods
has answer: http://stackoverflow.com/a/23911149
tagged with: java
has comment: http://stackoverflow.com/comment/36821207
type: Question
type: AnsweredQuestion
tagged with: junit4
accepted answer: http://stackoverflow.com/a/23911149
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has body: I have now a situation where I have something like the following: public class SomeTest extends AbstractMyTest { @Test public void something() { //Test something, related to the AbstractMyTest config } @Override public String getConfiguration() { return "myConfigFile.ini"; } } public abstract class AbstractMyTest { @Before public void before() { //Do some init stuff that calls getConfiguration()... } abstract String getConfiguration(); } Now, I am considering of getting rid of the AbstractMyTest Class and have something like the following: @MyTestConfig(value="myConfigFile.ini") public class SomeTest { @Test public void something() { //Test something, related to the AbstractMyTest config } } So I might have a custom Runner that does what the AbstractMyTest class was responsible for. I would love to be able to do some stuff in a @BeforeClass or @Before manner without having to do it in every TestClass. How would such a Runner be structured?
has comment: http://stackoverflow.com/comment/36820057

http://stackoverflow.com/q/23864345
tagged with: java
has comment: http://stackoverflow.com/comment/36741691
has comment: http://stackoverflow.com/comment/36732090
has answer: http://stackoverflow.com/a/47110875
upvote count: 1
has comment: http://stackoverflow.com/comment/36735688
answer count: 1
downvote count: 0
favorite count: 0
has title: Is it possible to specify the caret position of JTextPane in terms of X and Y coordinates somehow?
has comment: http://stackoverflow.com/comment/36731312
has comment: http://stackoverflow.com/comment/36732241
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36731715
has comment: http://stackoverflow.com/comment/36732104
has comment: http://stackoverflow.com/comment/36731585
has body: JtextPane setCaretPosition() takes an int as the parameter, but I need to specify the caret position in terms of x and y pixel coordinates. Is there any way in which I can achieve this? Edit: I have replaced the previous SSCCE, with some original code, to show how the data comes in, as there are no problems when doc string is hard coded. Code Snippet: import java.awt.BorderLayout; import java.awt.Point; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JTextPane; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultStyledDocument; import javax.swing.text.StyledDocument; public class Mock extends JDialog{ JFrame f = new JFrame("My mock "); JTextPane contentPlaceHolder = new JTextPane(); StyledDocument doc = new DefaultStyledDocument(); String content = "This is line 1\n"+ "This is line 2\n" + "This is line 3\n"+ "This is line 4\n" + "This is line 5\n"; int x, y; OutputStream out; InputStream in; KeyAdapter kl = new KeyAdapter() { public void keyTyped(KeyEvent e){ int c = e.getKeyChar(); try { out.write(c); } catch (Exception ex) { System.out.println("Exception occured in key Typed event:\n" + ex.getMessage()); } e.consume(); } }; private void initGUI() throws BadLocationException{ new RemoteConsumer().start(); contentPlaceHolder.addKeyListener(kl); doc.insertString(0, content, null); contentPlaceHolder.setDocument(doc); f.getContentPane().add(contentPlaceHolder, BorderLayout.CENTER); contentPlaceHolder.setVisible(true); pack(); f.setSize(400, 300); f.setVisible(true); System.out.println("Should be visible"); new RemoteConsumer().start(); } void startGUI() { Runnable r = new Runnable() { public void run() { try { initGUI(); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; SwingUtilities.invoke…
has comment: http://stackoverflow.com/comment/36731851
tagged with: jtextpane
has comment: http://stackoverflow.com/comment/36732220
tagged with: swing
type: Question
tagged with: caret
score: 1

http://stackoverflow.com/a/23936173
has body: Have you tried to run a shell script with your build with your maven command build ? For unknown reason, I had this issue after exporting a job to a new jenkins and didn't figure out. I run a shell script with the same command as the jenkins build performs and everything works fine. This answers is only a workaround as I didn't get the proper reason too... If you launch your command with -X argument, you'll also have more information on your issue.
type: Answer
answers question: http://stackoverflow.com/q/23930477
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/23930477
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23867701
has body: To call external programms in java you need the java.lang.Runtime package. If you want a more convenient API have a look at Apache Commons Exec.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23867633

http://stackoverflow.com/comment/36765679
type: Comment
has text: Try printing `json.toString()` right before doing `int success = json.getInt(TAG_SUCCESS);` and see if it matches the json you posted here
comment on: http://stackoverflow.com/q/23881999
score: 0
type: QuestionComment

http://stackoverflow.com/a/23887218
has body: I think there are 2 main options. 1) You can set a system property when you run tomcat and pass those as variables. For example you can pass the parameter -DehcachePort=xxx and then in the xml set that value as ${ehcachePort}. I cannot find a link to the documentation of this feature, but it's mentioned here 1.1) If you cannot set the system properties from the command line, you can write a tiny class that calls System.setProperty before you load the ehchache.xml. 2) Instantiate the Ehcache objects from code. It's basically the same as above, but you have to read a properties file and instantiate anything that you require. Ehcache supports fluent builders, which are quite easy to read (compared to the verbosity of XML).
answers question: http://stackoverflow.com/q/23886479
score: 0
type: Answer

http://stackoverflow.com/a/23892925
has comment: http://stackoverflow.com/comment/36786538
has body: DefaultRowSorter.toggleSortOrder( column );
answers question: http://stackoverflow.com/q/23892774
score: 0
type: Answer

http://stackoverflow.com/comment/36804096
score: 2
type: Comment
has text: @Braj Clippings kind of dangerous as you could end up painting out side of the "visible" bounds of the component onto other parts of the screen...looks really cool actually, but this is why I avoid it - just saying...
type: QuestionComment
comment on: http://stackoverflow.com/q/23902382

http://stackoverflow.com/comment/36905633
has text: Thanks all for the help. I mark this one as an answer 'cause I didn't try sending the password as null, as I set up a password for mysql before going through that, and think, perhaps, it might work with password set as null.
type: Comment
comment on: http://stackoverflow.com/a/23929839
score: 0
type: AnswerComment

http://stackoverflow.com/a/23800899
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23800647
downvote count: 0
has body: I dont think there is an option of if-else logic in web.xml faces/mydata.xhtml faces/dataexchange.xhtml If you put both the files in welcome file list as above, the container will first search for mydata.xhtml and only if not found, will the container search and return dataexchange. Alternatively, you can have a DispatcherServlet ( Either some framework provided or custom servlet with load on startup 1 ) and from the servlet you can return the xhtml you want to.
answers question: http://stackoverflow.com/q/23800647

http://stackoverflow.com/comment/36792191
comment on: http://stackoverflow.com/q/23893478
score: 0
type: Comment
type: QuestionComment
has text: Can you tell me what is what is wrong in the code, because I do not understand what you mean.

http://stackoverflow.com/comment/36783436
comment on: http://stackoverflow.com/q/23891707
score: 0
has text: sorry let me define my functions!
type: QuestionComment
type: Comment

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/23864534

cil
tags question: http://stackoverflow.com/q/23940262
type: Tag
tag name: cil

http://stackoverflow.com/a/23837514
has body: You can have a bean or processor in your route which creates the Order objects and returns them as a collection (e.g., List<Order> or similar). Splitter EIP can then be used to process each Order in that collection, one at a time by e.g. passing each order to another processor/bean that handles a single order, possibly continuing on to another endpoint as needed, etc. // Pseudocode: from(input). to(bean-which-returns-a-collection-of-orders). split(on-the-body). to(bean-which-processes-a-single-order). to(anywhere-else-needed-for-your-purposes). // etc... Or something along those lines; sorry, I use Spring DSL not Java DSL but camel docs show both. Here's some actual spring DSL code where a collection is being split to process each item in the collection: ${body} <log message="A.a1 -- splitting batches for transfer" loggingLevel="DEBUG" /> ${body.batchNumber} ${body.batchNumber}.xml <log message="A.a2 -- marshalling a single batch to XML" loggingLevel="DEBUG" /> <jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation" partClass="generated.gov.nmcourts.ecitation.NMCitationEFileBatch" partNamespace="EFileBatch" /> <log message="A.a3 -- xslt transform to add schema location" loggingLevel="DEBUG" /> <to uri="{{addSchemaLocationXsltUri}}"/> <log message="A.a4 -- ftp now initiating" loggingLevel="DEBUG" /> <log message="ftping $simple{in.header.CamelFileName}" loggingLevel="DEBUG"/> <bean ref="markFtpStatusOnTickets"/> <to uri="{{ftpOdysseyInputPath}}"/> <log message="A.a5 -- ftp now complete" loggingLevel="DEBUG" /> java.lang.Exception true <bean ref="ticketExceptionHandler" method="handleException"/>
type: Answer
answers question: http://stackoverflow.com/q/23836705
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23788850
tagged with: knn
score: 2
type: AnsweredQuestion
tagged with: jung
downvote count: 0
type: Question
tagged with: graph
tagged with: java
has body: I am trying to implement creation of kNN graph using jung library. I have came to a moment where I need to check if a link between 2 Nodes already exists in the graph. My code so far: for (int i = 0; i &lt; k; i++) { for (Iterator&lt;Node&gt; it1 = mGraph.getVertices().iterator(); it1.hasNext();) { Node n1 = (Node) it1.next(); double minDistance = 9999999; Node toConnect = null; for (Iterator&lt;Node&gt; it2 = mGraph.getVertices().iterator(); it2.hasNext();) { Node n2 = (Node) it2.next(); double currDistance = this.getDistance(n1, n2); if( currDistance &lt; minDistance &amp;&amp; mGraph.containsEdge( /* WHAT HERE */ ) ){ minDistance = currDistance; toConnect = n2; } } mGraph.addEdge(new Link(), n1, toConnect, EdgeType.DIRECTED); } } I do not know how to do this since there is only one constructor for Link without any parameters.
upvote count: 2
tagged with: distance
answer count: 3
possible better answer: http://stackoverflow.com/a/23790138
has answer: http://stackoverflow.com/a/23790138
accepted answer: http://stackoverflow.com/a/23796533
favorite count: 0
has title: How to check if DirectedSparsedGraph contains an Edge between Nodes having those 2 nodes?
has answer: http://stackoverflow.com/a/23789373
has answer: http://stackoverflow.com/a/23796533

http://stackoverflow.com/q/23815078
score: -2
has comment: http://stackoverflow.com/comment/36639148
downvote count: 2
has body: My task is to create a Java char client/server application. I always have huge problems with GUI in java. I'm currently struggling to create a simple chat log that will be able to display both colored text (specifically administrator users should appear red) and GUI elements (button to download a file that has been sent). I have tried lots of things including HTML, but everything has a flaw. For the messages, my latest solution are jpanels filled with jlabels of different color and it's all contained in jscrollpane. It's the best solution so far, but it's still really bad. JPanels are trying to fit in centre both vertically and horizontally. If there's only one message, it's in the middle of the log. Text in JPanels cannot be highlighted - so it cannot be copied out. Is there any XXXPanel that has been designed for purpose of displaying formated text? The panel with HTML did not accept either CSS or &lt;font&gt; tag attributes - so I doubt it had the capability of being colored.
tagged with: user-interface
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23815170
accepted answer: http://stackoverflow.com/a/23815170
has comment: http://stackoverflow.com/comment/36637394
linked to: http://stackoverflow.com/q/9071389
linked to: http://stackoverflow.com/q/9650992
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36637046
has title: What should I use for client-side coloured chat log?
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/36637460
type: Question

http://stackoverflow.com/q/23869417
tagged with: collections
has comment: http://stackoverflow.com/comment/36740509
type: AnsweredQuestion
tagged with: java
tagged with: tags
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23869480
has body: I'm trying to copy the elements of a String array into another, but this exception occurs. I know that the exception comes up when the ArrayLists differ in size, but i even defined the second one with the first's size in mind. Here is the code, btw i'm trying to make a program that reads a txt file and checks whether the data in it is in order, using an ArrayList as a holder for the tag names. import java.io.*; import java.util.*; public class Reader1 { public static void main(String args[]) throws IOException { FileInputStream in = null; ArrayList&lt;String&gt; tag_tester = new ArrayList&lt;String&gt;(35); tag_tester.add("ITEM"); tag_tester.add("ITEM_LIST"); tag_tester.add("ITEM_TYPE"); tag_tester.add("MODEL"); tag_tester.add("MODEL_YEAR"); tag_tester.add("MANUFACTURER"); tag_tester.add("PRICE"); tag_tester.add("SCREEN_TYPE"); tag_tester.add("DIMENSIONS"); tag_tester.add("RESOLUTION"); tag_tester.add("INTERFACES"); tag_tester.add("PIECES"); tag_tester.add("CPU_TYPE"); tag_tester.add("CAPACITY"); tag_tester.add("EXTENSIONS_NUMBER"); tag_tester.add("CPU_SPEED"); tag_tester.add("CORE_NUMBER"); tag_tester.add("CHIPSET"); tag_tester.add("RAM_TYPE"); tag_tester.add("SPEED"); tag_tester.add("HD_TYPE"); tag_tester.add("SIZE"); tag_tester.add("CONNECTION"); tag_tester.add("TECHNOLOGY"); tag_tester.add("PRINT_TYPE"); tag_tester.add("ORDER"); tag_tester.add("ORDER_LIST"); tag_tester.add("NAME"); tag_tester.add("PHONE"); tag_tester.add("NUMBER"); tag_tester.add("ORDER_DATE"); tag_tester.add("DELIVERY_DATE"); tag_tester.add("SALE"); tag_tester.add("SALES_LIST"); tag_tester.add("MODEL"); tag_tester.add("SALE_DATE"); ArrayList&lt;String&gt; tag_backup = new ArrayList&lt;String&gt;(tag_tester.size()); try { BufferedReader br = new BufferedReader(new FileReader("AVAILABLE PRODUCTS.txt")); String line; int flag; Collections.copy(tag_backup,tag_tester); line = br.readLine(); do{ flag=0; do{ for(int i=0; i&lt;tag_backup.size(); i++) { if ((line.trim().startsWith(tag_backup.get(i))) ||…
tagged with: arraylist
tagged with: io
has answer: http://stackoverflow.com/a/23869854
accepted answer: http://stackoverflow.com/a/23869854
has title: Why does Collections.copy with ArrayList produces IndexOutOfBounds exception?
possible better answer: http://stackoverflow.com/a/23869480

http://stackoverflow.com/comment/36697295
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23846479
has text: I would check in `regedit` that your ProgId appears in the list under `HKEY_LOCAL_MACHINE\SOFTWARE\Classes` sub key, if it's there then the COM object is registered properly (on a 64 bit server the 32 bit location is `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes`).

http://stackoverflow.com/comment/36833695
type: Comment
has text: Project/Clean - And if it doesn't solve, restart Eclipse
type: QuestionComment
comment on: http://stackoverflow.com/q/23917900
score: 0

http://stackoverflow.com/comment/36789678
comment on: http://stackoverflow.com/q/23894791
score: 0
type: Comment
type: QuestionComment
has text: I would suggest you look up the phrases "soundex" and "fuzzy matching" rather than try to guess what Android Studio does. e.g Fuzzy matching. FWIW, I use this feature in emacs to great benefits. http://www.georgestragand.com/dice.html

http://stackoverflow.com/a/23857944
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23857897
answers question: http://stackoverflow.com/q/23857897
type: Answer
has body: The warning is because the clone() method returns an Object, and so the compiler isn't sure that the object is an ArrayList. Instead of using clone(), I recommend either: using new ArrayList&lt;&gt;(consoles) (this is the copy constructor). creating a new ArrayList&lt;item&gt; and using the addAll method to copy the items over to the new ArrayList&lt;item&gt;. On an unrelated note, while the ArrayList does implement clone(), note that not all classes may do so, and so clone() might not work.
has comment: http://stackoverflow.com/comment/36719145
score: 4
upvote count: 4

http://stackoverflow.com/comment/36631710
has text: [Here is the IDEA result](http://take.ms/9hqrl). No compile errors, no runtime errors, no error highlighting. Sbt one looks essentially the same
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23810439
type: Comment

http://stackoverflow.com/comment/36599512
has text: @David, yes this the **reason**. I checked and indeed my java had setuid bit turned on. Why is that and how it happened is another story. I'll investigate. But once I turn off chmod -s /path/java the user.name reports proper account name.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23793449
score: 2

http://stackoverflow.com/q/23797255
has answer: http://stackoverflow.com/a/30522545
answer count: 1
downvote count: 0
has title: Android multi dex project setup
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36603651
score: 2
tagged with: classloader
has body: I am creating a multi-dex project setup by following this post: http://android-developers.blogspot.fr/2011/07/custom-class-loading-in-dalvik.html Everything goes on successfully, and next, I'd like to separate the secondary dex into a library project. primary project contents: com.example.dex.* secondary (library) project contents: com.example.dex.lib.* However, I'm unable to share the com.example.dex.LibraryInterface which is required by both primary and library project. UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/example/dex/Library Interface; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:43) Both project will need to reference the LibraryInterface, is there any way to share the class? Thanks!
upvote count: 2
type: Question
tagged with: java

http://stackoverflow.com/comment/36788049
type: AnswerComment
comment on: http://stackoverflow.com/a/23888827
type: Comment
has text: did you put all these classes in com.mypackages. If yes then please post the error.
score: 0

http://stackoverflow.com/q/23939467
answer count: 1
tagged with: bufferedreader
tagged with: string
score: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/23939522
accepted answer: http://stackoverflow.com/a/23939522
has body: I am trying to read some data from a InputStream, and then put them into a StringBuffer to print it. I put this code in the main method. My problem is that the StringBuffer is only printed when I am debugging the code, when I run it normally it isnt been printed. My code: Socket s = new Socket(); String host = ""; PrintWriter s_out = null; BufferedReader s_in = null; InputStream in = null; s.connect(new InetSocketAddress(host, 23)); //writer for socket s_out = new PrintWriter(s.getOutputStream(), true); //reader for socket s_in = new BufferedReader(new InputStreamReader(s.getInputStream())); in = s.getInputStream(); if(s.isConnected() == true &amp;&amp; s.isInputShutdown() == false &amp;&amp; s.isOutputShutdown() == false){ StringBuffer sb = new StringBuffer(); boolean found = false; char ch; int numberOfBytesThatCanBeRead = in.available(); for(int j = 0; j &lt; numberOfBytesThatCanBeRead; j++){ ch = (char) s_in.read(); //System.out.print(ch); sb.append(ch); } System.out.print(sb.toString()); s_in.close(); in.close(); s_out.close(); s.close(); The correct value of this variable is 564, but it is only returned when I debug the code, when i run normally it returns 21. int numberOfBytesThatCanBeRead = in.available(); So, my question is: Why when I debug the code, the result of StringBuffer is correct, and when I run normally it is not ? Thanks !
type: Question
type: AnsweredQuestion
has title: StringBuffer is not been printed correctly
tagged with: java
tagged with: inputstream

http://stackoverflow.com/comment/36623394
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23806410
has text: Did you check the console output of the jenkins job?
score: 0

http://stackoverflow.com/comment/36609721
type: Comment
type: QuestionComment
has text: Your Tomcat deployment is different to your java code
comment on: http://stackoverflow.com/q/23800862
score: 0

http://stackoverflow.com/comment/36716654
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23856788
type: Comment
has text: The declarations would have the same signature if run in the same class.

http://stackoverflow.com/q/23871161
has title: Getting Null Pointer Exception while running a test through TestNG
has comment: http://stackoverflow.com/comment/36743889
score: 0
has comment: http://stackoverflow.com/comment/36743686
answer count: 2
has comment: http://stackoverflow.com/comment/36743931
possible better answer: http://stackoverflow.com/a/40301996
has answer: http://stackoverflow.com/a/40301996
has answer: http://stackoverflow.com/a/23871468
tagged with: opencsv
has comment: http://stackoverflow.com/comment/36744100
has comment: http://stackoverflow.com/comment/36743920
has comment: http://stackoverflow.com/comment/36743722
has comment: http://stackoverflow.com/comment/36743654
has comment: http://stackoverflow.com/comment/36743749
has body: I am using CSV reader to fetch the data from and using this data in a test function using DataProvider. TestNG Method @Test(dataProvider = "regCSVData", dataProviderClass = LoginData.class) public void testLoginUsingCSVFile(LoginData loginData){ driver.get(appURL); Login login = PageFactory.initElements(driver, Login.class); login.loginToFwbm(loginData); } LoginData Class @DataProvider(name = "regCSVData") public static Object[][] getCSVData() throws IOException { CSVReader csvReader = new CSVReader(new FileReader( LoginData.class.getResource("/regdata.csv").getPath())); List&lt;String[]&gt;dataList = csvReader.readAll(); Object[][]data = new Object[dataList.size()][1]; List&lt;LoginData&gt; logList = new ArrayList&lt;LoginData&gt;(); for (String[] strArray:dataList){ LoginData loginData = new LoginData(); loginData.setUserName(strArray[0].trim()); loginData.setPassword(strArray[1].trim()); logList.add(loginData); } for (int i=0; i&lt;data.length;i++){ for(int j=0;j&lt;data[i].length;j++){ data[i][j] = logList.get(i); } } csvReader.close(); return data; } CSV File asdf, pa2 qwerty, pa2 john, pa2 When I run this test using TestNG, I am getting Null Pointer exception java.lang.RuntimeException: java.lang.NullPointerException at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:161) at org.testng.internal.Parameters.handleParameters(Parameters.java:429) at org.testng.internal.Invoker.handleParameters(Invoker.java:1383) at org.testng.internal.Invoker.createParameters(Invoker.java:1075) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1180) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at…
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36743725
accepted answer: http://stackoverflow.com/a/23871468
type: Question
has comment: http://stackoverflow.com/comment/36743902
tagged with: java

dxf
tags question: http://stackoverflow.com/q/23801956
tag name: dxf
type: Tag

http://stackoverflow.com/comment/36866703
has text: @hwnd: that was the last piece in the puzzle. Now, everything's working fine! Thanks to all of you for your help and patience...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23935331

http://stackoverflow.com/comment/36730861
type: QuestionComment
has text: It is: Oracle JDBC Driver version - "10.2.0.2.0"
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23863909

http://stackoverflow.com/q/23823163
tagged with: gradle
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I'm using robotium to make a small test for an app and I receive the next error when running "./gradlew androidTest" :Task 'androidTest' not found in project ':APPName'. I have the next structure: --src ---main ----androidTest -----java ------test.java (e.g.) My gradle file contains: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion '19.0.3' defaultConfig { minSdkVersion 14 targetSdkVersion 19 } signingConfigs { debug { } release { } } buildTypes { release { } } lintOptions { abortOnError false } } dependencies { androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.0.1' } task wrapper(type: Wrapper) { gradleVersion = '1.11' }
tagged with: robotium
has title: Robotium - Task 'androidTest' not found in project ':APPName'
tagged with: java
has answer: http://stackoverflow.com/a/23834650

http://stackoverflow.com/q/23843053
has answer: http://stackoverflow.com/a/23843133
has body: I have 4 Wizard pages , say page1 , page2, page3 and page4. Page1 consists of 3 radio buttons. So based on the selection of radio button, one of the 3 pages should be opened. i.e. if I select the 1st radio button and press Next , then page2 should be opened. similarly 2nd radio button- page3 3rd radio button - page4 How do I achieve this?
tagged with: jface
type: AnsweredQuestion
has title: How to render pages based on the selection made in the first page of the wizard
tagged with: java
tagged with: swt
accepted answer: http://stackoverflow.com/a/23843133
type: Question
tagged with: eclipse
score: 0
answer count: 1

http://stackoverflow.com/q/23792831
answer count: 1
type: UnansweredQuestion
tagged with: lifecycle
tagged with: jsf
type: Question
has title: JSF Jumps from Phase 1 to 6
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23805286
has comment: http://stackoverflow.com/comment/36607451
tagged with: jsf-2
score: 0
has body: My code does not write the data in my beans, I made a debug in the life cycle and found that it was jumping straight to the phase 1 to 6. I find no error in my code, could someone help me? My Bean and xHTML: package br.com.banco.controller; import javax.annotation.PostConstruct; import javax.faces.component.html.HtmlInputText; import javax.faces.component.html.HtmlOutputText; import javax.faces.event.ValueChangeEvent; import org.hibernate.Session; import br.com.banco.model.bean.Candidato; import br.com.banco.model.bean.Documento; import br.com.banco.model.bean.Endereco; import br.com.banco.model.dao.HibernateDAO; import br.com.banco.util.FacesContextUtil; @javax.faces.bean.ManagedBean (name="bBCandidato") @javax.faces.view.ViewScoped public class BBCandidato { private Candidato candidato; private Documento documento; private Endereco endereco; private java.util.List&lt;Candidato&gt; candidatos; private Session session; private HibernateDAO&lt;Candidato&gt; candidatoDAO; private HibernateDAO&lt;Documento&gt; documentoDAO; private HibernateDAO&lt;Endereco&gt; enderecoDAO; @PostConstruct public void init(){ session = FacesContextUtil.getRequestSession(); candidatoDAO = new HibernateDAO&lt;Candidato&gt;(Candidato.class, session); documentoDAO = new HibernateDAO&lt;Documento&gt;(Documento.class, session); enderecoDAO = new HibernateDAO&lt;Endereco&gt;(Endereco.class, session); candidato = new Candidato(); documento = new Documento(); endereco = new Endereco(); } public java.util.List&lt;Candidato&gt; listar(){ if(candidatos == null){ candidatos = candidatoDAO.getBeans(); } return candidatos; } public void salvar(){ System.out.println("Testandooo"); candidatoDAO.salvar(candidato); documento.setDoc_codigo(candidato.getCan_codigo()); documentoDAO.salvar(documento); endereco.setEnd_codigo(candidato.getCan_codigo()); enderecoDAO.salvar(endereco); } public void atualizar(){ System.out.println("Testandooo"); candidatoDAO.atualizar(candidato); documentoDAO.atualizar(documento); …

http://stackoverflow.com/comment/36927213
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23875209
has text: @user1359010 In that case you need to look at how much memory is used after a Full GC, and in your graph it is very little so it doesn't demonstrate your problem. You need to look at what is happening just before an OOME. You can trigger a heap dump on OOME to see what was using all the memory.

label
tags question: http://stackoverflow.com/q/23867333
tags question: http://stackoverflow.com/q/23910474
tags question: http://stackoverflow.com/q/23800121
tag name: label
type: Tag

http://stackoverflow.com/comment/36802746
score: 0
type: AnswerComment
type: Comment
has text: Thank you Elliot. I will do further research on static. That aspect of the language is definitely tripping me up.
comment on: http://stackoverflow.com/a/23901442

http://stackoverflow.com/q/23927662
linked to: http://stackoverflow.com/q/13470830
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/7670355
duplicate of: http://stackoverflow.com/q/7670355
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36890645
has answer: http://stackoverflow.com/a/23927689
has title: Java Date Conversion with Timezone
type: Question
has body: I have user input date with TimeZone "GMT +5:30". But JVM is using "GMT +0:00". I want to convert Date from "GMT +5:30" to "GMT +0:00". Thanks
has comment: http://stackoverflow.com/comment/36889935
answer count: 1
has comment: http://stackoverflow.com/comment/36851268

http://stackoverflow.com/a/23783814
downvote count: 0
type: Answer
has body: You are getting the info from the now date and not from the one you retrieved. Date dateStart = calendarEvents.getDateStart(); java.util.Calendar calendarEventStart = java.util.Calendar.getInstance(); calendarEventStart.setTime(dateStart); parseDateToCalendar.setYearStart(calendarEventStart .get(calendarEventStart.YEAR)); parseDateToCalendar.setMonthStart(calendarEventStart .get(calendarEventStart.MONTH)); parseDateToCalendar.setDayStart(calendarEventStart .get(calendarEventStart.DAY_OF_MONTH)); parseDateToCalendar.setHourStart(calendarEventStart .get(calendarEventStart.HOUR_OF_DAY)); parseDateToCalendar.setMonthStart(calendarEventStart .get(calendarEventStart.MINUTE));
answers question: http://stackoverflow.com/q/23783732
score: 1
upvote count: 1

http://stackoverflow.com/a/23876395
score: -1
type: Answer
downvote count: 1
has body: I understood that you are currently using BASE64 encoded images being represented as strings, correct? This approach is reasonable for small binaries/images and also to avoid many individual calls for each image in case of an list of images for example. Anyway - a proper way would be to use a POST or PUT request to send an image to a Java web service in form of an x-www-form-urlencoded request. This is similar to what you do in a typical upload form. Look at the example in this answer: Send image to server as binary data For the download of an image you can use a GET NSURLRequest (include required headers, authentication or other information to the request) and convert the received NSData to an image. [UIImage imageWithData:dataReceivedFromURLRequest]; Or directly create the NSData for simple http requests like this and convert it to an image: NSData *urlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://my-web-service/image.png"]]; On the server side you could create an image REST endpoint using JAX-RS for example. Please note that frameworks like AFNetworking help a lot providing convenient ways sending and receiving image/binary data.
upvote count: 0
answers question: http://stackoverflow.com/q/23876193

http://stackoverflow.com/q/23811989
has body: When I launch an Android Studio software I saw the dialog box below showing Error launching android studio The environment variable JAVA_HOME(with the value of C:\Program Files(x86)\Java\jdk1.7.0_40\bin) does not point to a valid JVM installation My JDK is placed on the location mentioned above, why Android Studio software still can't detect it?
has title: Android Studio Java JDK environment path
accepted answer: http://stackoverflow.com/a/23812028
tagged with: android-studio
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2619584
has answer: http://stackoverflow.com/a/23812028
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
duplicate of: http://stackoverflow.com/q/2619584
tagged with: android

http://stackoverflow.com/q/23908544
favorite count: 0
tagged with: redis
tagged with: key-value
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23909603
has title: Lists vs. Key-Scanning
upvote count: 1
answer count: 1
has body: I am using Redis to store Java objects. For example, I have a class User(FirstName, LastName) and each user has multiple addresses Address(Street, City). Users are stored in the database as Redis Hashes: HMSET user:0 firstname qwert lastname zuiop As addresses are each logically bound to a specific user, their key includes the user's key: HMSET user:0:addresses:0 street Teststreet city Exampletown However, I am not sure how to provide the following features: Accessing all users in the database Accessing all addresses belonging to a specific user Basically, I see two options: Using Sets: SADD user user:0 SADD user user:1 ... SMEMBERS user (to access list of users) ... SADD user:0:addresses user:0:addresses:0 SADD user:0:addresses user:0:addresses:1 SMEMBERS user:0:addresses (to access list) Using KEYS KEYS user:* (to access list of users) KEYS user:0:addresses:* (to access list of addresses) Are there any alternatives to those approaches? Which way is more "Redis"?
type: UnansweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/36847815
comment on: http://stackoverflow.com/q/23925344
score: 0
has text: The distinguishing feature of StringCoding is that it is package private ......
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/87786392
score: 0
type: AnswerComment
has text: Do you have the live example for that @eduardog3000 ?
type: Comment
comment on: http://stackoverflow.com/a/26244665

http://stackoverflow.com/comment/36789697
has text: That's exactly my question, if there is a way to reuse the same ResultMap on different SQL's, but telling Ibatis when a SQL's will not return one of the columns. Something like "setup" that property with a default/null value when a column does not exists on the SQL.
comment on: http://stackoverflow.com/q/23794944
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36753635
type: Comment
comment on: http://stackoverflow.com/a/23873115
has text: That formatting doesnt like me.. Took me 10 minutes to do that
type: AnswerComment
score: 0

metadata
tags question: http://stackoverflow.com/q/23934761
tags question: http://stackoverflow.com/q/23892122
tags question: http://stackoverflow.com/q/23780333
tag name: metadata
tags question: http://stackoverflow.com/q/23822628
type: Tag
tags question: http://stackoverflow.com/q/23822529

http://stackoverflow.com/a/24002771
has comment: http://stackoverflow.com/comment/37019635
accepted answer of: http://stackoverflow.com/q/23937885
answers question: http://stackoverflow.com/q/23937885
upvote count: 1
type: AcceptedAnswer
has body: There seems to be a problem in your application code triggered by @PostConstruct. This is the interesting part of the stacktrace: Caused by: java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:283) at com.sun.common.util.logging.LoggingOutputStream.flush(LoggingOutputStream.java:116) at java.io.PrintStream.write(PrintStream.java:482) at com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream.write(LoggingOutputStream.java:392) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104) at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185) at java.io.PrintStream.write(PrintStream.java:527) at java.io.PrintStream.print(PrintStream.java:669) at com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream.print(LoggingOutputStream.java:297) at org.apache.felix.gogo.runtime.threadio.ThreadPrintStream.print(ThreadPrintStream.java:150) Looks like you're producing more output than the stream can handle, so it's not a CDI problem after all.
has comment: http://stackoverflow.com/comment/37122042
has comment: http://stackoverflow.com/comment/49677933
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23861320
tagged with: libgdx
score: 0
has title: libGDX Character nullpointer
answer count: 1
has body: I am a beginner in programming and I am working on making an RPG using libGDX. I have some stuff set up, and for some reason when I get to the screen which is supposed to show the main character, I get the following error: Exception in thread "LWJGL Application" java.lang.NullPointerException at FirstRPG.AbstractEntity.setLinearVelocity(AbstractEntity.java:220) at FirstRPG.screens.Player.handleEvents(Player.java:138) at FirstRPG.screens.Player.draw(Player.java:193) at FirstRPG.screens.GameScreen.render(GameScreen.java:16) at com.badlogic.gdx.Game.render(Game.java:46) at FirstRPG.screens.FirstRPG.render(FirstRPG.java:20) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) I have an Abstract Class set up to combine scence2d and box2d, the error is with the setLinearVelocity method: public void setLinearVelocity(Vector2 v) { body.setLinearVelocity(v); } which is used in an event handler I have set up in the class for the Player: public void handleEvents() { this.move = Movement.IDLE; if ((Gdx.input.isKeyPressed(Input.Keys.UP)) || (Gdx.input.isKeyPressed(Input.Keys.W))) { setLinearVelocity(0.0f, 5.0f); this.setY(this.getPosition().y * PIXELS_PER_METER); this.dir = Direction.UP; this.move = Movement.WALKING; } else if ((Gdx.input.isKeyPressed(Input.Keys.DOWN)) || (Gdx.input.isKeyPressed(Input.Keys.S))) { setLinearVelocity(0.0f, -5.0f); this.setY(this.getPosition().y * PIXELS_PER_METER); this.dir = Direction.DOWN; this.move = Movement.WALKING; } else if ((Gdx.input.isKeyPressed(Input.Keys.LEFT)) || (Gdx.input.isKeyPressed(Input.Keys.A))) { setLinearVelocity(-5.0f, 0.0f); this.setX(this.getPosition().x * PIXELS_PER_METER); this.dir = Direction.LEFT; this.move = Movement.WALKING; } else if ((Gdx.input.isKeyPressed(Input.Keys.RIGHT)) || (Gdx.input.isKeyPressed(Input.Keys.D))) { setLinearVelocity(5.0f, 0.0f); this.setX(this.getPosition().x * PIXELS_PER_METE…
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36731146
has answer: http://stackoverflow.com/a/23863181

http://stackoverflow.com/comment/36860268
has text: That explains the output; but can you add a solution as well?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23932660

http://stackoverflow.com/comment/36866829
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23933393
score: 0
has text: Agree, the javadoc could be more clear on this, but this isn't the only place where the javadoc could be improved ;)

http://stackoverflow.com/comment/36663659
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23829235
has text: Alright, i'll keep it in mind. But the logic is still the same.

http://stackoverflow.com/a/23898094
type: Answer
score: -1
downvote count: 1
has body: This is what I ended up doing and it works exactly as I wanted. I ended up using a prepared statement in the while loop to make it work. connect(); try { String db = conn.getCatalog(); data.append("The current database " + db + " contains the following tables:\r\n"); } catch(Exception err) { System.out.print(err + "\r\n"); } try { ResultSet rs = null; DatabaseMetaData md = conn.getMetaData(); rs = md.getTables(null, null, "%", null); while (rs.next()) { String tbl = rs.getString(3); String query = ("SELECT COUNT(*) FROM " + tbl); PreparedStatement cnt = conn.prepareStatement(query); ResultSet ct = cnt.executeQuery(); while (ct.next()) { data.append("Table " + rs.getString(3) + " has " + ct.getString(1) + " records\r\n"); } } data.append("\r\n"); } catch(Exception err) { System.out.print(err + "\r\n"); }
upvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23874631
accepted answer of: http://stackoverflow.com/q/23874631

http://stackoverflow.com/a/24138212
accepted answer of: http://stackoverflow.com/q/23910989
score: 5
type: AcceptedAnswer
has body: What you need is a dictionary of English words. Then you basically scan your input and check if each token exists in your dictionary. You can find text files of dictionary entries online, such as in Jazzy spellchecker. You might also check Dictionary text file. Here is a sample code that assumes your dictionary is a simple text file in UTF-8 encoding with exactly one (lower case) word per line: public static void main(String[] args) throws IOException { final Set&lt;String&gt; dictionary = loadDictionary(); final String text = loadInput(); final List&lt;String&gt; output = new ArrayList&lt;&gt;(); // by default splits on whitespace final Scanner scanner = new Scanner(text); while(scanner.hasNext()) { final String token = scanner.next().toLowerCase(); if (!dictionary.contains(token)) output.add(token); } System.out.println(output); } private static String loadInput() { return "This is a 5gse5qs sample f5qzd fbswx test"; } private static Set&lt;String&gt; loadDictionary() throws IOException { final File dicFile = new File("path_to_your_flat_dic_file"); final Set&lt;String&gt; dictionaryWords = new HashSet&lt;&gt;(); String line; final LineNumberReader reader = new LineNumberReader(new BufferedReader(new InputStreamReader(new FileInputStream(dicFile), "UTF-8"))); try { while ((line = reader.readLine()) != null) dictionaryWords.add(line); return dictionaryWords; } finally { reader.close(); } } If you need more accurate results, you need to extract stems of your words. See Apache's Lucene and EnglishStemmer
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23910989

http://stackoverflow.com/comment/36869619
has text: With recent Java update (well not so recent anymore) Java stepped up the security. You'll need to sign your jars and everything.
type: QuestionComment
comment on: http://stackoverflow.com/q/23937475
type: Comment
score: 0

http://stackoverflow.com/a/23846884
answers question: http://stackoverflow.com/q/23846723
score: 0
has body: Given your log messages, launchFrames must be null. You would be able to tell that more directly by noticing that the stack trace tells you the exact line number where you are crashing. Try cleaning your project (e.g., Project > Clean in the Eclipse main menu) and see if that helps.
type: Answer
has comment: http://stackoverflow.com/comment/36709112

http://stackoverflow.com/comment/36695603
type: Comment
type: QuestionComment
score: 0
has text: Smells like a design issue. Why would you want to do that?
comment on: http://stackoverflow.com/q/23845960

http://stackoverflow.com/a/23916846
has body: To achieve this, you need to first set the channel-adapter auto-startup property to false auto-startup="false" and then using control bus start/stop the adapter See here control bus example - https://github.com/spring-projects/spring-integration-samples/tree/master/basic/control-bus
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/36900428
downvote count: 0
answers question: http://stackoverflow.com/q/23915524
type: Answer

http://stackoverflow.com/comment/36736477
comment on: http://stackoverflow.com/a/23867237
has text: Try replacing (*) with the entity alias (e.g. cd). I updated my response.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36819953
has text: Hmm..i see. In fact, my friend here told me that there are some parts in the project with hibernate. Oh yeah...what what is this "Seam" thing?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23911065

http://stackoverflow.com/a/23866854
type: Answer
answers question: http://stackoverflow.com/q/23866755
has comment: http://stackoverflow.com/comment/36735725
has comment: http://stackoverflow.com/comment/36735816
upvote count: 1
has body: The component hierarchy is not clear from your example code. First check if you have added the TabBar to the content pane of your frame. Then verify that you have added the selectionArea to your TabBar.
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23866755

http://stackoverflow.com/comment/36784452
score: 0
type: Comment
has text: Glad, it helped. You can create a new question and ask help here. If you find the answer on your own, then post it and accept it. It will help someone in future.
type: AnswerComment
comment on: http://stackoverflow.com/a/23885999

http://stackoverflow.com/comment/36719431
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23858072
has text: eclipse? my computer? 5+ each

http://stackoverflow.com/a/23861871
answers question: http://stackoverflow.com/q/23861488
score: 0
has body: Ensure that you're using the same library API version when running the code as you were when developing/compiling your code. And in the case of the remote S3 API, make sure that the version you have on the client side is compatible with the server side version.
type: Answer
has comment: http://stackoverflow.com/comment/36727323

http://stackoverflow.com/a/24124608
has comment: http://stackoverflow.com/comment/37232193
has comment: http://stackoverflow.com/comment/37229078
has comment: http://stackoverflow.com/comment/37446773
has comment: http://stackoverflow.com/comment/37451891
answers question: http://stackoverflow.com/q/23925673
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37242775
has comment: http://stackoverflow.com/comment/37693277
has body: What do you mean by taking a lot of time ? Can you give numbers (maybe comparing the numbers with your cache decorator and without it) ? It's possible that their is an overhead due to the design of RS that always executes async code from inside an Android service. Basically the round trip to get something in the cache is : SpiceManager -&gt; SpiceService -&gt; ExecutorService -&gt; Thread -&gt; CacheManager &lt;- &lt;- &lt;- &lt;- This is a little costly for sure, but that the design of RS. Usually the overhead is just of a few ms.
has comment: http://stackoverflow.com/comment/37450111
has comment: http://stackoverflow.com/comment/37221937

http://stackoverflow.com/a/54474857
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23797756
type: Answer
has body: I replaced mysql-connector.jar "mysql-connector-java-5.1.6-bin" with "mysql-connector-java-5.1.18-bin" now I am able to do transaction..
upvote count: 1

http://stackoverflow.com/a/23852703
upvote count: 3
has body: This is one of the few things for which I'd recommend (a utility method and) GroupLayout as seen in this answer.
downvote count: 0
answers question: http://stackoverflow.com/q/23852569
type: Answer
score: 3

apache-poi
tags question: http://stackoverflow.com/q/23869254
tags question: http://stackoverflow.com/q/23885116
tags question: http://stackoverflow.com/q/23802500
tags question: http://stackoverflow.com/q/23799213
tags question: http://stackoverflow.com/q/23826116
type: Tag
tags question: http://stackoverflow.com/q/23781826
tags question: http://stackoverflow.com/q/23924963
tag name: apache-poi
tags question: http://stackoverflow.com/q/23930664
tags question: http://stackoverflow.com/q/23886205
tags question: http://stackoverflow.com/q/23814579
tags question: http://stackoverflow.com/q/23789739
tags question: http://stackoverflow.com/q/23779041

http://stackoverflow.com/q/23855202
tagged with: apache-httpclient-4.x
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23856325
score: 1
tagged with: java
has title: Simple JSON-RPC call to Bitcoin wallet with Apache Http Client 4 gives "failed to respond"
has answer: http://stackoverflow.com/a/23867982
type: Question
accepted answer: http://stackoverflow.com/a/23867982
tagged with: apache-httpcomponents
has body: I'm trying to do simple JSON-RPC call to 'getinfo' method with no parameters with Apache Http-components HttpClient, but all I got is: org.apache.http.NoHttpResponseException: 127.0.0.1:33002 failed to respond My JSON RPC request is: { "method": "getinfo", "params": [], "id": 1} And the code is: CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope( "localhost" , 33002 ) , new UsernamePasswordCredentials( "loginxxx" , "passxxx" ) ); CloseableHttpClient client = HttpClients.custom() .setDefaultCredentialsProvider( credsProvider ) .build(); HttpPost request = new HttpPost( "http://127.0.0.1:33002/jsonrpc" ); request.setEntity( new StringEntity( "{\"method\":\"getinfo\",\"params\":[],\"id\":1}" ) ); HttpResponse response = client.execute( request ); Why server is not responsing? How can I improve my JSON-RPC request? Full trace log from apache: http://pastebin.com/K2HTZ4nR Edit: changing both hostnames to 127.0.0.1 or both to localhost doesn't helps. Also putting id in \"1\" doesn't helps. EntityUtils.consume also doesn't helps. Removing /jsonrpc from URL also.
answer count: 2
tagged with: json-rpc
has answer: http://stackoverflow.com/a/23856325
tagged with: bitcoin
upvote count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23875003
score: 3
answers question: http://stackoverflow.com/q/23874949
upvote count: 3
has body: This is a result of something called Type Casting EditText inherits from type View. Since you want a variable of type EditText, but findViewById returns an object of type View, you have to cast the result of findViewById to EditText To illustrate: View uncasted = findViewById(R.id.edit_message); EditText casted = (EditText)uncasted; //casting happening on right side above
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23874949

http://stackoverflow.com/a/23819532
score: 0
has body: The problem was the trailing slash on the Url, getting rid of that made it work (despite the trailing slash being returned and working in browswer).
type: Answer
answers question: http://stackoverflow.com/q/23819136
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23819136

http://stackoverflow.com/a/23874440
has body: This code was originally written in C++ for a 3D platformer. I rewrote it, but there might be some bugs. I can draw a picture later if it's difficult to understand. public void checkCollision(Rectangle rect){ if(player.intersects(rect)) { //the rectangles intersect, time to move the player out of the block if(rect.y+rect.height &gt;= player.y &amp;&amp; rect.y+rect.height-0.7f &lt; player.y) { //if the player is at most 0.7 units (you should change this!) below top side player.y = rect.y+rect.height; //set player to stand on top speed.y = 0f; //stop the movement onGround = true; } else if(rect.y+rect.height &gt; player.y &amp;&amp; rect.y &lt; player.y+player.height) { //if the playeer is on the side, but not below float xEscMinus = (float)Math.abs((rect.x+rect.width)-player.x); //find the distance to the side float xEscPlus = (float)Math.abs(rect.x-(player.x+player.width)); if(xEscMinus&lt;xEscPlus) { player.x = rect.x+rect.width; } else { player.x = rect.x-player.width; } } } }
type: Answer
answers question: http://stackoverflow.com/q/23871875
score: 0

http://stackoverflow.com/q/23932070
has body: How to convert this String the surveyÂ’s rules to UTF-8 in Scala? I tried these roads but does not work: scala&gt; val text = "the surveyÂ’s rules" text: String = the surveyÂ’s rules scala&gt; scala.io.Source.fromBytes(text.getBytes(), "UTF-8").mkString res17: String = the surveyÂ’s rules scala&gt; new String(text.getBytes(),"UTF8") res21: String = the surveyÂ’s rules Ok, i'm resolved in this way. Not a converting but a simple reading implicit val codec = Codec("US-ASCII").onMalformedInput(CodingErrorAction.IGNORE).onUnmappableCharacter(CodingErrorAction.IGNORE) val src = Source.fromFile(new File (folderDestination + name + ".csv")) val src2 = Source.fromFile(new File (folderDestination + name + ".csv")) val reader = CSVReader.open(src.reader())
score: 8
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36859279
has answer: http://stackoverflow.com/a/23932154
tagged with: java
has title: How to ensure that Strings are in UTF-8?
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/36860035
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36874941
upvote count: 8
has answer: http://stackoverflow.com/a/23932541
tagged with: utf-8

http://stackoverflow.com/q/23875883
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23875949
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/122254
has body: I have a drop down menu in my JSP and instead of hardcoding the values with text I would like to call constants from a class. Here is a snippet of my constants class called master.dao.util.MasterDataConstants //DIVISIONS FOR DROPDOWN public static final String DIVISION_TYPE_DROPDOWN_AUDIT_MANAGEMENT_GLOBAL_ID = "Audit Management - Global"; public static final String DIVISION_TYPE_DROPDOWN_CHANGE_MANAGEMENT_GLOBAL_ID = "Change Management - Global"; public static final String DIVISION_TYPE_DROPDOWN_DEA_MANAGEMENT_GLOBAL_ID = "DEA Management - Global"; public static final String DIVISION_TYPE_DROPDOWN_EHS_MANAGEMENT_GLOBAL_ID = "EH&S Management - Global"; public static final String DIVISION_TYPE_DROPDOWN_EVENT_MANAGEMENT_GLOBAL_ID = "Event Management - Global"; And here is my JSP Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <%@ page import="java.util.*"%> <%@ page import="javax.servlet.*"%> <%@ page import="master.dao.MasterDataDao"%> **<%@ page import="master.dao.util.MasterDataConstants"%>** <%@ page import="master.dto.SiteDto"%> Master Data Master Data File Site Name <jsp:useBean id="masterDao" clas s="master.dao.MasterDataDao"/> ALL <c:forEach items="${masterDao.allSites}" var="siteDto"> ${siteDto.name} </c:forEach> ** Division <jsp:useBean id="masterDaoUtil" class="master.dao.util.MasterDataConstants"/> ${MasterDataConstants.DIVISION_TYPE_DROPDOWN_AUDIT_MANAGEMENT_GLOBAL_ID} ${MasterDataConstants.DIVISION_TYPE_DROPDOWN_CHANGE_MANAGEMENT_GLOBAL_ID} ${MasterDataConstants.DIVISION_TYPE_DROPDOWN_DEA_MANAGEMENT_GLOBAL_ID} ${MasterDataConstants.DIVISION_TYPE_DROPDOWN_EHS_MANAGEMENT_GLOBAL_ID} ${MasterDataConstants.DIVISION_TYPE_DROPDOWN_EVENT_MANAGEMENT_GLOBAL_ID} ** When I execute this page I get blank values for the second dropdown labeled Division. I have copied down the portion from the…
tagged with: constants
accepted answer: http://stackoverflow.com/a/23875949
upvote count: 1
has title: calling a constant in a JSP dropdown menu
type: AnsweredQuestion

http://stackoverflow.com/comment/107596315
comment on: http://stackoverflow.com/a/38751431
type: Comment
score: 0
has text: @xman_bsn this is not configurable, real key properties order is lost by "properties.load(inputStream);" under the hood. but at this moment you can do you implementation of PropertyKeysOrderResolver code below: PropertiesToJsonConverter converter = new PropertiesToJsonConverter(); converter.setPropertyKeysOrderResolver(new PropertyKeysOrderResolver() { public List<String> getKeysInExpectedOrder(Map<String, ?> properties) { // TODO implement way how you want gather properties key order } });
type: AnswerComment

http://stackoverflow.com/a/23808376
answers question: http://stackoverflow.com/q/23798563
has body: Thrift and the drivers that support Thrift are deprecated as of C* 1.2. You should switch to the DataStax Java Driver (currently at 2.0.2). Alternately, ensure this is set properly in cassandra.yaml start_rpc: true
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37239536

http://stackoverflow.com/comment/36641857
comment on: http://stackoverflow.com/a/23817648
type: Comment
has text: And you will have a Calendar with the current date, so, it does not represent the fact that no Calendar has been set.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23825788
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/65446355
has body: The reason for the NPE is that your thread is not bound to the fragment lifecycle. Once the fragment is detached from its hosting activity, getActivity() returns null. As a solution, consider removing the thread altogether and just use postDelayed() on a Handler on the UI thread to post Runnables that do the updates you want after a delay.
type: Answer
answers question: http://stackoverflow.com/q/23825549
score: 8

http://stackoverflow.com/q/23918610
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/23921247
favorite count: 0
has body: Environment: MySql 5.6.14 Spring MVC Hibernate I'm having problems to check if 2 objects are equal, and the problem is caused by de variable Date. I'm using Hibernate and it seems to be the problem of Timestamp (nanoseconds) and Date(miliseconds). When I create the object Task date is different that when I retreived the object from database. java.util.Date date = new java.util.Date(); java.sql.Date datesql = new java.sql.Date(date.getTime()); java.util.Date stamp = new java.sql.Timestamp(date.getTime()); Date rightnow = stamp;//Calendar.getInstance().getTime(); Task t1 = new Task("My first task", "This is a task", rightnow, rightnow, category, priority, state, user, user, "okey", 0); Task t2 = new Task("My second task", "This is a task", date, rightnow, category, priority, state, user, user, "okey", 0); Task t3 = new Task("My third task", "This is a task", datesql, rightnow, category, priority, state, user, user, "okey", 0); taskDao.saveOrUpdate(t1); taskDao.saveOrUpdate(t2); taskDao.saveOrUpdate(t3); taskDao.saveOrUpdate(t4); List&lt;Task&gt; tasks = taskDao.getAllTasks(); assertEquals("Should be 4 tasks.", 4, tasks.size()); Task taskR1 = taskDao.get(t1.getIdTask()); Task taskR2 = taskDao.get(t2.getIdTask()); Task taskR3 = taskDao.get(t3.getIdTask()); //Dates before saving objects in database System.out.println("l timestamp&gt; "+rightnow.getTime()); System.out.println("l date &gt; "+date.getTime()); System.out.println("l datesql &gt; "+datesql.getTime()); //Dates from retrieved objects System.out.println("l tr1date &gt; "+taskR1.getDate().getTime()); System.out.println("l tr2date &gt; "+taskR2.getDate().getTime()); System.out.println("l tr3date &gt; "+taskR3.getDate().getTime()); Results of this code //Dates before saving objects in database l timestamp&gt; 1401298705937 l date &gt; 1401298705937 l datesql &gt; 1401298705937 //Dates from retrieved objects l tr1date &gt; 1401298706000 l tr2date &gt; 1401298706000 l tr3date &gt; 1401298706000 The problem is that whe…
tagged with: timestamp
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23142614
downvote count: 0
has title: How to compare objects with a Date variable (Hibernate)? java.util.Date vs java.sql.Timestamp
has answer: http://stackoverflow.com/a/23921247
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23951022
accepted answer: http://stackoverflow.com/a/23951022
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36841075
has comment: http://stackoverflow.com/comment/36835052
tagged with: date

http://stackoverflow.com/a/23872212
type: Answer
downvote count: 0
has body: In your activity, you set the layout file like this: setContentView(R.layout.activity_main); This means, when you write findViewById, it will look within the activity_main.xml file. Your button on the other hand is within another layout file. Just move the click event into your fragment, and access the context using getActivity like so: final Button loginButton = (Button) rootView.findViewById(R.id.connect); loginButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), LoginDisplayActivity.class); startActivity(intent); } });
score: 2
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23872008
accepted answer of: http://stackoverflow.com/q/23872008

http://stackoverflow.com/q/23810705
upvote count: 0
accepted answer: http://stackoverflow.com/a/23817028
linked to: http://stackoverflow.com/q/7645268
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/36629029
possible better answer: http://stackoverflow.com/a/23811195
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/23811195
has title: Confusion about InputStream
downvote count: 1
has answer: http://stackoverflow.com/a/23811637
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23817028
has body: I am trying to make a simple app. I have a method for returning an InputStream and then I will bind this stream to an ImageView. But it doesn't work as always. There is no exception. What am I doing wrong. How can I make this code run? String[] names; Bitmap bmp; ImageView img; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AssetManager am=getAssets(); img = (ImageView)findViewById(R.id.imageView1); try { names=am.list("myfiles"); InputStream is=bitmapStream(names[1]); bmp =BitmapFactory.decodeStream(is); img.setImageBitmap(bmp); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public InputStream bitmapStream(String name) throws FileNotFoundException { InputStream is = null; is = openFileInput(name); return is; }
type: Question

http://stackoverflow.com/comment/36748279
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23870740
type: AnswerComment
has text: `collect` seems more complicated to me, requiring a supplier, consumer, and combiner. So that's one reason to use `reduce`. Further, `collect` also seems to require a non-interfering accumulator. Does this non-interference only refer to the source collection then?

http://stackoverflow.com/a/23880863
accepted answer of: http://stackoverflow.com/q/23880401
upvote count: 2
has comment: http://stackoverflow.com/comment/36762803
answers question: http://stackoverflow.com/q/23880401
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36762834
type: Answer
score: 2
downvote count: 0
has body: You're calling myPanel.repaint() over and over within the loop over k and l, with image set to a different BufferedImage each time. The effect of that is going to be that the panel ends up with the last image that you created. In this particular case, the last image you created is the one that's all black.
has comment: http://stackoverflow.com/comment/36762862

http://stackoverflow.com/a/23908298
answers question: http://stackoverflow.com/q/23908210
score: 0
type: Answer
has body: The reason you're getting the warning is most probably because it's never actually used apart from the constructor. If you're going to use it within the class later on (with a getter method or other way), ignore the warning.

http://stackoverflow.com/comment/36831214
has text: Adding `@TransactionConfiguration` was the missing piece. Thanks.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23915934

http://stackoverflow.com/a/23855840
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36715183
answers question: http://stackoverflow.com/q/23855724
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36716009
accepted answer of: http://stackoverflow.com/q/23855724
has body: I would say you should go for hibernate. you will get the list of objects just by performing "list()" method. code for your reference List&lt;Authors&gt; al = this.sessionFactory.getCurrentSession().createQuery("from Authors").list(); Hibernare provides many other advantages too. Its definitely better option than JDBC. JDBC alternative: best practices says that u should return a DTO(Data transfer object) from DAO layer because it is advisable to get the relevant data in one go from DB so u can minimize the DB hits. Follow This: List&lt;YourDTO&gt; al = new ArrayList&lt;yourDTO&gt;(); YourDTO is: class YourDTO { private int id: private Authors authors; // getters and setters } read the data from resultSet as your doing then create the objects of Authors , set the fields , add them to ArrayList with id.

http://stackoverflow.com/comment/36609817
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23799531
has text: yes your are right , but i have managed that part pretty well.it was actually my device which was troubling me. i changed the device and it worked but that took an hour to figure out exact error.

http://stackoverflow.com/comment/36786535
type: QuestionComment
has text: Can you explain a bit more what you mean by your child objects are detached? Do you mean when you call persist, the relationship is set to null? What was there and what do you expect to happen, and how have you read in the child objects or persisted them if they are new?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23884620

http://stackoverflow.com/comment/36640466
has text: Also, I'm surprised that so many people are screaming "stack overflow!" when that's obviously not what you're asking about.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23816769

http://stackoverflow.com/q/23864434
linked to: http://stackoverflow.com/q/4205980
tagged with: post
type: Question
tagged with: http-status-code-406
upvote count: 3
has title: POST request returning 406 error
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: I am using processing to do a simple POST request on a server. I have tried with many accept header configurations and I keep getting Error - 406 Not Acceptable. However, when I do requests with postman (chrome plugin) I get no errors. I get errors with this code, which I irresponsibly tweaked from Java - sending HTTP parameters via POST method easily URL url; try { url = new URL( urlString.toString() ); } catch(MalformedURLException e) { e.printStackTrace(); url = null; } Map &lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("email", email ); params.put("mac", macAddress ); StringBuilder postData = new StringBuilder(); for ( String s : params.keySet() ) { if (postData.length() != 0) postData.append('&amp;'); postData.append(encode( s )); postData.append('='); postData.append( encode( params.get(s) ) ); } byte[] postDataBytes; try { postDataBytes = postData.toString().getBytes("UTF-8"); } catch(UnsupportedEncodingException e) { e.printStackTrace(); postDataBytes = null; } HttpURLConnection conn; try { conn = (HttpURLConnection)url.openConnection(); } catch(IOException e) { e.printStackTrace(); conn = null; } try { conn.setRequestMethod("POST"); } catch(ProtocolException e) { e.printStackTrace(); } conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); conn.setRequestProperty("Accept-Encoding", "gzip,deflate,sdch"); //conn.setRequestProperty("Accept-Charset", "UTF-8"); conn.setRequestProperty("Accept-Language", "es-ES,es;q=0.8,en;q=0.6"); conn.setRequestProperty("Accept", "*/*"); conn.setDoOutput(true); try { conn.getOutputStream().write(postDataBytes); } catch(IOException e) { e.printStackTrace(); } InputStreamReader isr; try { isr = new InputStreamReader( conn.getInputStream() ); } catch(IOException e) { e.printStackTrace(); isr = null; } BufferedReader in = new BufferedReader( isr ); try { licencia = in.readLine(); } catch(IOExcepti…
tagged with: processing
score: 3
tagged with: java

http://stackoverflow.com/comment/36807014
has text: try adding double quotes around it
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/23903907
type: Comment

http://stackoverflow.com/q/23780546
answer count: 1
tagged with: apache-felix
tagged with: osgi
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23782460
has body: I have an OSGi based (Apache Felix) Eclipse project. It depends on org.eclipse.osgi. As soon as I launch it, the following exception occurs: Auto-properties install: file:C:\programs\eclipse\plugins \org.eclipse.osgi_3.9.1.v20140110-1610.jar (java.lang.IllegalArgumentException: Start level must be greater than zero.) java.lang.ClassCastException: org.eclipse.osgi.framework.internal.core.SystemBundleActivator cannot be cast to org.osgi.framework.BundleActivator ERROR: Bundle org.eclipse.osgi [2] Error starting file:C:\programs\eclipse\plugins\org.eclipse.osgi_3.9.1.v20140110-1610.jar (org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.osgi [2].) at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4342) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2147) at org.apache.felix.framework.Felix.startBundle(Felix.java:2070) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1297) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304) at java.lang.Thread.run(Thread.java:744) So there seems to be a problem inside the org.eclipse.osgi Bundle. As I am not able to change the bundle sourcecode, how to avoid this error?
tagged with: eclipse
score: 0
has title: Eclipse OSGi SystemBundleActivator vs BundleActivator

http://stackoverflow.com/comment/36663110
has text: sorry no, i was just trying to show the equivalent - i did write it in javascript though.
type: Comment
comment on: http://stackoverflow.com/a/23828666
score: 0
type: AnswerComment

http://stackoverflow.com/q/23894373
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
tagged with: php
has body: I am trying to create a function in an Android app that sends a message to a PHP file on a webserver (in my case, localhost) and have the PHP display the text. I am able to connect with the PHP file but only read JSON data from the file. I want to send data to the file and display it. Any ideas on how I can do this? I have tried a tutorial but my app is crashing. Here is my code for this tutorial: PHP code: &lt;?php // get the "message" variable from the post request // this is the data coming from the Android app $message=$_POST["message"]; // specify the file where we will save the contents of the variable message $filename="androidmessages.html"; // write (append) the data to the file file_put_contents($filename,$message."&lt;br /&gt;",FILE_APPEND); // load the contents of the file to a variable $androidmessages=file_get_contents($filename); // display the contents of the variable (which has the contents of the file) echo $androidmessages; ?&gt; Activity: package com.yoursite.helloworld; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import java.util.ArrayList; import java.util.List; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.message.BasicNameValuePair; // import everything you need import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class HelloWorldActivity extends Activity { Button sendButton; EditText msgTextField; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // load the layout setContentView(R.layout.main); // make message text field object msgTextField = (EditText) findViewById(R.id…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36788618
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23894652
type: Question
has title: How to display message from Android to PHP?
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36788542
answer count: 1
accepted answer: http://stackoverflow.com/a/23894652
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
has comment: http://stackoverflow.com/comment/36788935

http://stackoverflow.com/comment/36689533
has text: Try it again after removing last forward slash form DB_URL.
comment on: http://stackoverflow.com/q/23842332
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39552216
type: Comment
comment on: http://stackoverflow.com/a/25365697
has text: Can you elaborate on how to do so?
score: 1
type: AnswerComment

http://stackoverflow.com/q/23811015
has answer: http://stackoverflow.com/a/23814812
has body: Directory indexDir = new SimpleFSDirectory(new File("D:" + File.separator + "testindex")); Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_45); IndexWriterConfig writerConfig = new IndexWriterConfig(Version.LUCENE_45, analyzer); writerConfig.setOpenMode(OpenMode.CREATE_OR_APPEND); IndexWriter indexWriter = new IndexWriter(indexDir, writerConfig); Document document = new Document(); Field stringField = new TextField("int1", "hello lucky boy", Store.YES); document.add(stringField); indexWriter.addDocument(document); indexWriter.close(); Term term = new Term("int1", "hello lucky boy"); IndexWriterConfig writerConfig2 = new IndexWriterConfig(Version.LUCENE_45, analyzer); IndexWriter indexWriter2 = new IndexWriter(indexDir, writerConfig2); indexWriter2.updateDocument(term, document); indexWriter2.deleteDocuments(term); indexWriter2.close(); System.out.println("......" + document); System.out.println("...跟新索引文件结束..."); the updateDocument or deleteDocuments is not working. The document is still the same. My lucene is the 4.5. Is anything wrong? I have searched many methods. It looks like the same, so can anyone help me?
answer count: 1
tagged with: lucene
has title: lucene4.5 deleteDocument and updateDocument is not working
score: 0
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/a/23812431
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36636121
has comment: http://stackoverflow.com/comment/36635946
has comment: http://stackoverflow.com/comment/36635410
has comment: http://stackoverflow.com/comment/36634449
has body: I'd bet it's meant to apply to all the fields. And for me it indeed works like this: I've got a bunch of getters and setters when I copied your example. There may be a Lombok bug for the compiler you're using. File a bug with all the details. UPDATE Chapter 8.3 of the JLS says it clearly: More than one field may be declared in a single field declaration by using more than one declarator; the FieldModifiers and Type apply to all the declarators in the declaration. It works for me with both Eclipse and Gradle. I'm using Lombok 1.12.7 (more precisely, commit e890428 from 2014-05-01), but this really shouldn't matter. I can't see any such change since 1.12.6 and I'd bet it's been always meant to work the "right" way.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23812105
type: Answer
answers question: http://stackoverflow.com/q/23812105
has comment: http://stackoverflow.com/comment/36631985
has comment: http://stackoverflow.com/comment/36631683

http://stackoverflow.com/comment/36803827
comment on: http://stackoverflow.com/q/23902248
score: 0
type: QuestionComment
has text: Are you using a GUI designer from an IDE? Can you share the code that is giving you the wrong alignments? Are you using Swing? Maybe you could update your question with this info?
type: Comment

http://stackoverflow.com/a/23911502
answers question: http://stackoverflow.com/q/23909862
score: 3
has comment: http://stackoverflow.com/comment/36823349
has comment: http://stackoverflow.com/comment/36822946
upvote count: 3
has body: I will have a look into the NPE, it should return a more helpful error message instead. Most likely, the problem is that this parameter is of type List&lt;Integer&gt;, i.e. you would need to pass a list. Alternatively, you can pass a String, which will be parsed. The following should work just fine: params.addParameter( NumberVectorLabelParser.Parameterizer.LABEL_INDICES_ID, "2"); Note that the text writer might (I have not checked this) print labels as is. So you cannot take the output as indication that it considered your data set to be 3 dimensional. The debugging handler -resulthandler LogResultStructureResultHandler -verbose should give you type output: java -jar elki.jar KDDCLIApplication -dbc.in dbpedia.gz \ -algorithm NullAlgorithm \ -resulthandler LogResultStructureResultHandler -verbose should yield an output like this: de.lmu.ifi.dbs.elki.datasource.FileBasedDatabaseConnection.load: 1941 ms de.lmu.ifi.dbs.elki.algorithm.NullAlgorithm.runtime: 0 ms BasicResult: Algorithm Step (main) StaticArrayDatabase: Database (database) DBIDView: Database IDs (DBID) MaterializedRelation: DoubleVector,dim=2 (relation) MaterializedRelation: LabelList (relation) SettingsResult: Settings (settings) In this case, my data set are coordinates from Wikipedia, along with a name each. I have a 2 dimensional DoubleVector relation, and a LabelList relation storing the object names.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23909862
type: Answer

http://stackoverflow.com/comment/36756462
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23877735
has text: What do you use to program and compile? Define your java_home there.
score: 0

weblogic8.x
tag name: weblogic8.x
tags question: http://stackoverflow.com/q/23863909
type: Tag

http://stackoverflow.com/a/23916931
upvote count: 1
has body: java.awt.Window aTopLevelGUI; // Normally referenced as a JWindow, but this is what impls setVisible(boolean) // To close the window: aTopLevelGUI.setVisible(false);
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23916855
type: Answer
accepted answer of: http://stackoverflow.com/q/23916855

http://stackoverflow.com/a/23807891
downvote count: 0
type: Answer
has body: Well you could have a List&lt;List&lt;String&gt;&gt; which you can compile into List&lt;Pattern&gt;: for(List&lt;String&gt; terms : listOfTerms) { String pattern = StringUtils.join(terms, "|"); patterns.add(Pattern.compile(pattern)); } and then check: for(Pattern p : patterns) if(!p.matches(string)) return false; return true; This should make the checking easier. For defining the initial list of terms maybe Arrays would actually work better? Something like this: String[][] terms = {{"cat", "dog"}, {"a", "b"}...}; Which could be formatted to look nice and could contain comments etc...
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23807830

http://stackoverflow.com/comment/36818849
type: AnswerComment
comment on: http://stackoverflow.com/a/23900400
has text: So how do I deal with the negatives then?
type: Comment
score: 0

hibernate
tags question: http://stackoverflow.com/q/23937165
tags question: http://stackoverflow.com/q/23849666
tags question: http://stackoverflow.com/q/23844538
tags question: http://stackoverflow.com/q/23815897
tags question: http://stackoverflow.com/q/23885579
tags question: http://stackoverflow.com/q/23898340
tags question: http://stackoverflow.com/q/23908606
tags question: http://stackoverflow.com/q/23813076
tags question: http://stackoverflow.com/q/23894184
tags question: http://stackoverflow.com/q/23905831
tags question: http://stackoverflow.com/q/23798971
tags question: http://stackoverflow.com/q/23845346
tags question: http://stackoverflow.com/q/23888835
tags question: http://stackoverflow.com/q/23908993
tags question: http://stackoverflow.com/q/23835442
tags question: http://stackoverflow.com/q/23884620
tags question: http://stackoverflow.com/q/23818345
tags question: http://stackoverflow.com/q/23935248
tags question: http://stackoverflow.com/q/23829707
tags question: http://stackoverflow.com/q/23925322
tags question: http://stackoverflow.com/q/23841856
tags question: http://stackoverflow.com/q/23819292
tags question: http://stackoverflow.com/q/23805135
tags question: http://stackoverflow.com/q/23793610
tags question: http://stackoverflow.com/q/23828073
tags question: http://stackoverflow.com/q/23795458
tags question: http://stackoverflow.com/q/23851558
tags question: http://stackoverflow.com/q/23865509
tags question: http://stackoverflow.com/q/23890687
tags question: http://stackoverflow.com/q/23865883
tags question: http://stackoverflow.com/q/23940320
tags question: http://stackoverflow.com/q/23902514
tags question: http://stackoverflow.com/q/23905902
tags question: http://stackoverflow.com/q/23888556
tags question: http://stackoverflow.com/q/23855724
tags question: http://stackoverflow.com/q/23932684
tags question: http://stackoverflow.com/q/23817225
tags question: http://stackoverflow.com/q/23862969
tags question: http://stackoverflow.com/q/23795632
tags question: http://stackoverflow.com/q/23874002
tags question: http://stackoverflow.com/q/23930776
tags question: http://stackoverflow.com/q/23799204
tags question: http://stackoverflow.com/q/23817968
tags question: http://stackoverflow.com/q/23783712
tags question: http://stackoverflow.com/q/23897367
tags question: http://stackoverflow.com/q/23867119
tags question: http://stackoverflow.com/q/23789293
tags question: http://stackoverflow.com/q/23931698
tags question: http://stackoverflow.com/q/23899430
tags question: http://stackoverflow.com/q/23869061
tags question: http://stackoverflow.com/q/23863520
tags question: http://stackoverflow.com/q/23865603
tags question: http://stackoverflow.com/q/23791838
tags question: http://stackoverflow.com/q/23889455
tags question: http://stackoverflow.com/q/23893699
tags question: http://stackoverflow.com/q/23903427
tags question: http://stackoverflow.com/q/23888255
tags question: http://stackoverflow.com/q/23905682
tags question: http://stackoverflow.com/q/23904570
tags question: http://stackoverflow.com/q/23831728
tags question: http://stackoverflow.com/q/23836961
tags question: http://stackoverflow.com/q/23854221
tags question: http://stackoverflow.com/q/23928067
tags question: http://stackoverflow.com/q/23820492
tags question: http://stackoverflow.com/q/23925186
tags question: http://stackoverflow.com/q/23792831
tags question: http://stackoverflow.com/q/23893345
tag name: hibernate
tags question: http://stackoverflow.com/q/23868933
tags question: http://stackoverflow.com/q/23920323
tags question: http://stackoverflow.com/q/23862279
tags question: http://stackoverflow.com/q/23890831
tags question: http://stackoverflow.com/q/23782304
tags question: http://stackoverflow.com/q/23868330
tags question: http://stackoverflow.com/q/23882198
tags question: http://stackoverflow.com/q/23923886
tags question: http://stackoverflow.com/q/23930151
tags question: http://stackoverflow.com/q/23843918
tags question: http://stackoverflow.com/q/23903628
tags question: http://stackoverflow.com/q/23890861

http://stackoverflow.com/q/23826574
has comment: http://stackoverflow.com/comment/37321948
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24218127
has comment: http://stackoverflow.com/comment/36658788
has comment: http://stackoverflow.com/comment/36661005
type: Question
has answer: http://stackoverflow.com/a/41907205
score: -2
has comment: http://stackoverflow.com/comment/36659392
tagged with: android-lvl
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/36659099
has title: Android License Test Response always response an ERROR_NOT_MARKET_MANAGED
has comment: http://stackoverflow.com/comment/36663207
favorite count: 0
has comment: http://stackoverflow.com/comment/36660476
tagged with: android
has body: I create my app header on Google Play. I create an application with google's LVL library. I sign into an Android device with the same account that I use to sign into my Google Play Developer Console. The LicenseChecker was using the correct public key (from Google Play app license key). Clearing my Google Play cache and not having uploaded the application, but the license server needs a response set on the license test setting page, no? when I'm running the app, the license server always responds: 3 (ERROR_NOT_MARKET_MANAGED). I wait 24 hours, but nothing happens. The response is 3. I upload the app (same version code) to the google play, but not published. I wait 24 hours again, but nothing happens. The response is 3. WTF :) Okay, just back to the beginning step by step: I create an app from the Android SDK's licensing sample. The LVL version is 2. I make a header on google play. A BASE64_PUBLIC_KEY rewrite in the sample from a google play app license. I sign in an android device with my publisher's account (after factory reset) This sample is returned 3! What's wrong with me????
has comment: http://stackoverflow.com/comment/36661389

http://stackoverflow.com/a/23790571
upvote count: 1
has body: Your first predicate uses contains(types[i]). Your second uses contains(types). So they don't do the same thing at all. The second predicate checks that the types contains the array of AddressType types, instead of checking that it contains one of the elements of the array of AddressType types.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23790514

http://stackoverflow.com/a/23838861
answers question: http://stackoverflow.com/q/23838806
has body: Have a look here http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html for the documentation of ProcessBuilder. It is important to note that everythin after the first parameter of the constructor is interpreted as an command line argument. ProcessBuilder pb = new ProcessBuilder("exe"); Process p = pb.start(); OutputStream pos = p.getOutputStream(); InputStream input = new FileInputStream(new File("input_file")); byte[] buffer = new byte[1024]; int read = 0; while((read = input.read(buffer)) != -1) { pos.write(buffer, 0, read); } input.close();
score: 2
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/23948941
has body: My bet is that you need to use http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/index/AtomicReader.html, it have all needed methods. Also take a look here - http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/index/IndexReader.html - it explain you how to create needed readers.
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23904312
type: Answer
accepted answer of: http://stackoverflow.com/q/23904312

http://stackoverflow.com/q/23922555
tagged with: 3d
type: AnsweredQuestion
has body: I'm creating a 3D game based on the book Developing Games in Java (you don't need to read or know the book to answer). To create the map I'm using a .map file that specifies the walls, floors, ceilings, and so forth. I just don't understand how the walls are created. Instead of using a begin x (coordinate) and a final x, a begin z (coordinate) and a final z, he just uses one x coordinate and one z coordinate. The commands are: # v [x] [y] [z] - Define a vertex with floating-point # coords (x,y,z). # mtllib [filename] - Load materials from an external .mtl # file. # usemtl [name] - Use the named material (loaded from a # .mtl file) for the next floor, ceiling, # or wall. # ambientLightIntensity # [value] - Defines the ambient light intensity # for the next room, from 0 to 1. # pointlight [v] - Defines a point light located at the # [intensity] specfied vector. Optionally, light # [falloff] intesity and falloff distance can # be specified. # player [v] [angle] - Specifies the starting location of the # player and optionally a starting # angle, in radians, around the y-axis. # obj [uniqueName] - Defines an object from an external # [filename] [v] OBJ file. The unique name allows this # [angle] object to be uniquely identfied, but # can be "null" if no unique name is # needed. The filename is an external # OBJ file. Optionally, the starting # angle, in radians, around the y-axis # can be specified. # room [name] - Defines a new room, optionally giving # the room a name. A room consists of # vertical walls, a horizontal floor # and a horizontal ceiling. Concave rooms # are currently not supported, but can be # simulated by adjacent convex rooms. # floor [height] - Defines the height of the floor of # the current room, using the current # material. The current material can # be null, in which case no floor # polygon is created. The floor can be # above the ceiling, in which case a # "pillar" or "block" structure is # created, rather than a "room". # ceil [height] - Define…
type: Question
accepted answer: http://stackoverflow.com/a/23923047
tagged with: dictionary
has title: Java 3d mapping
has comment: http://stackoverflow.com/comment/36842750
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/36842835
has answer: http://stackoverflow.com/a/23923047

http://stackoverflow.com/a/23870494
has comment: http://stackoverflow.com/comment/36938993
type: Answer
answers question: http://stackoverflow.com/q/23865005
has body: I think that what you need is ReversedWildcardFilterFactory. Looks like your exact use case is described here: Wildcard queries and how Solr handles them
upvote count: 1
has comment: http://stackoverflow.com/comment/36945486
score: 1
has comment: http://stackoverflow.com/comment/36855048
downvote count: 0
has comment: http://stackoverflow.com/comment/36951601
has comment: http://stackoverflow.com/comment/36856034

http://stackoverflow.com/a/23803045
score: 2
has body: Ebean API uses AND operator for unlimited number of params by default (sample): MyModel.find.where() .like("email", "john@doe.com") .like("firstName", "John") .like("lastName", "Doe") .eq("age", 123) .eq("isMaried", true) .findRowCount();
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23801050
has comment: http://stackoverflow.com/comment/76195658
type: Answer

http://stackoverflow.com/q/23806243
has comment: http://stackoverflow.com/comment/36622380
tagged with: dependencies
has body: I would like to comment on Tim's answer here (https://stackoverflow.com/a/1172805/1746310) but because of my reputation I can't, I wrote it as an answer, saying that I wanted to comment, but can't because of my reputation. That message then got deleted by ChrisF (https://stackoverflow.com/users/59303/chrisf) saying it's not an answer and I should write a comment... I can't find words for this. Whatever, this is the plugin I'm talking about: http://mojo.codehaus.org/versions-maven-plugin/ From my understanding use-latest-version will include beta versions, while use-latest-release won't. Because of that I am using use-latest-releases but it keeps updating to beta versions. I tried maven clean after changing my pom.xml back to what it was before, but still when I do run as -> maven install it updates to beta versions. Is my understanding of the used words wrong? What do I have to do to NOT get the beta versions, but the latest release version of the used dependencies?
downvote count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/36619616
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/30571
tagged with: versions-maven-plugin
has comment: http://stackoverflow.com/comment/36625800
upvote count: 1
has answer: http://stackoverflow.com/a/23812010
has comment: http://stackoverflow.com/comment/36621660
answer count: 1
tagged with: maven-3
favorite count: 0
type: UnansweredQuestion
has title: How to tell mavens versions plugin to not use beta versions?
linked to: http://stackoverflow.com/q/21088232

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/23837885
tags question: http://stackoverflow.com/q/23819282
tags question: http://stackoverflow.com/q/23936152
tags question: http://stackoverflow.com/q/23813830
tags question: http://stackoverflow.com/q/23873432
tags question: http://stackoverflow.com/q/23827757
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/23880272
tags question: http://stackoverflow.com/q/23920639
tags question: http://stackoverflow.com/q/23860245
tags question: http://stackoverflow.com/q/23782662
tags question: http://stackoverflow.com/q/23822635
tags question: http://stackoverflow.com/q/23903735
tags question: http://stackoverflow.com/q/23812921

http://stackoverflow.com/a/23831144
answers question: http://stackoverflow.com/q/23830188
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: The problem I see you're facing is that you are setting the layout to the frame. This is a problem because it means that the frame can only have on visible component at a time. That component being one of the panels. So you can put a button. The button would have to be on the one of the panels, which may be hard to maintain, in terms of navigation. So instead, have a main JPanel that has the CardLayout, and add your card panels to that main panel. Then you can add the main panel to the frame, along with buttons for navigation. Another option is to have a menu bar with option to change the cards, then that way, you can keep the card layout on the frame, because navigation is controlled by the menu options. See How to Use CardLayout if you're not really sure even how to use CardLayout, hand coding. You're going to need a reference to layout and call one of its navigation methods like show(), next(), or previous() You may also find this post interesting. It used Netbeans, but maybe you'll pick something up
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23830188

http://stackoverflow.com/comment/36822134
comment on: http://stackoverflow.com/q/23912229
type: Comment
has text: What is your project language level set at?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36668841
type: Comment
type: QuestionComment
has text: There are two enums from two different places, and this attachment can keep me from 200 cases in a switch.
comment on: http://stackoverflow.com/q/23831903
score: 0

http://stackoverflow.com/comment/139194939
type: Comment
has text: Greate I was looking for it. Thanks a lot.
comment on: http://stackoverflow.com/a/23882860
type: AnswerComment
score: 0

http://stackoverflow.com/a/23840084
has comment: http://stackoverflow.com/comment/36685059
has body: That error is because you already have the fragment added in the FragmentManager, you can't add the same fragment twice. You need implement FragmentTransaction.replace instead FragmentTransaction.add case 0: ft.replace(R.id.content_frame, fragment1); //ft.addToBackStack(null); this maybe is not necesary. break; case 1: ft.replace(R.id.content_frame, fragment2); break; case 2: ft.replace(R.id.content_frame, fragment3); break; }
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23840004
type: Answer
answers question: http://stackoverflow.com/q/23840004

http://stackoverflow.com/a/23923294
answers question: http://stackoverflow.com/q/23921697
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36920836
downvote count: 0
score: 1
has body: This situation sounds straight out of Match (or replace) a pattern except in situations s1, s2, s3 etc. Compared with other potential solutions, the regex couldn't be simpler: custom|onetomany|manytomany|atom|tomcat|tomorrow|automatic|(tom) If you want to show not just tom but the whole word it is in, such as tomahawk, change this to: custom|onetomany|manytomany|atom|tomcat|tomorrow|automatic|(\w*tom\w*) The left side of the alternation matches the words you don't want. We will ignore these matches. The right side matches and captures tom to Group 1, and we know they are the right tom because they were not matched by the expressions on the left. This program shows how to use the regex (see the results at the bottom of the online demo). It finds tom and tomahawk. import java.util.*; import java.io.*; import java.util.regex.*; import java.util.List; class Program { public static void main (String[] args) throws java.lang.Exception { String subject = "custom onetomany manytomany atom tomcat tomorrow automatic tom tomahawk"; Pattern regex = Pattern.compile("custom|onetomany|manytomany|atom|tomcat|tomorrow|automatic|(\\w*tom\\w*)"); Matcher regexMatcher = regex.matcher(subject); List&lt;String&gt; group1Caps = new ArrayList&lt;String&gt;(); // put Group 1 captures in a list while (regexMatcher.find()) { if(regexMatcher.group(1) != null) { group1Caps.add(regexMatcher.group(1)); } } // end of building the list System.out.println("\n" + "*** Matches ***"); if(group1Caps.size()&gt;0) { for (String match : group1Caps) System.out.println(match); } } // end main } // end Program Reference How to match (or replace) a pattern except in situations s1, s2, s3...

http://stackoverflow.com/comment/37255181
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23935486
has text: Please remember to identify your accepted solution, @Safi.
score: 0

http://stackoverflow.com/q/23852526
has title: Inlining reference to class names in Java
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: classname
has comment: http://stackoverflow.com/comment/36708687
has comment: http://stackoverflow.com/comment/36710722
upvote count: 1
has comment: http://stackoverflow.com/comment/36708815
type: Question
tagged with: java
tagged with: compilation
has body: Let's consider the following statement: final String s = mypackage.X.class.getName(); This will cause at runtime the loading of the class "mypackage.X" I am looking for an alternative mechanism preventing the loading of this class (for instance inlining the class same at compile time). Note, the straightforward approach consisting in replacing the overall statement by a string literal at source level does not work for what i am trying to achieve. final String s = "mypackage.X"; Thanks,
has answer: http://stackoverflow.com/a/23853624

http://stackoverflow.com/comment/36627475
has text: Please, any direction would be much appreciated!
comment on: http://stackoverflow.com/q/23797400
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23851935
has comment: http://stackoverflow.com/comment/36707902
upvote count: 1
answers question: http://stackoverflow.com/q/23851835
downvote count: 1
type: Answer
has body: You can use Timer class in java. For a demo refer this site .http://www.tutorialspoint.com/java/util/timer_schedule_period.htm Or else, create a hashMap and add an object as key and the time you add as value. Then have a method called as delete which takes the time in milliseconds. Have a count down timer function and if the timer reaches zero, it should return true. Within the if condition in delete method, check if the IF condition is true, if it is true, set a variable initialTime which is currentTime - milliseconds that user passed to the delete method. then iterate hashmap which matches with initialTime and delete it. This is the rough algo public void delete(Time inMilliSeconds){ if(countDownTimer()){ initialTime = CurrentTimeInstance - inMilliSeconds; //Iterate HashMap and delete all values which is equal to initialTime; } } public boolean countDownTimer(inMilliSeconds){ //Timer that reduces to 00:00:00. After running down to zero return true. }
has comment: http://stackoverflow.com/comment/36707935
has comment: http://stackoverflow.com/comment/36707663
score: 0

http://stackoverflow.com/q/23899410
tagged with: java
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/23902136
possible better answer: http://stackoverflow.com/a/30607645
tagged with: threadpoolexecutor
favorite count: 0
tagged with: retrofit
has body: OkHttp 2.0.0-RC1 uses ThreadPoolExecutor defined in Dispatcher#getExecutorService: executorService = new ThreadPoolExecutor( 0, Integer.MAX_VALUE, 60, TimeUnit.SECONDS, new LinkedBlockingQueue&lt;Runnable&gt;(), Util.threadFactory("OkHttp Dispatcher", false));` which is essentially implementation of Executors#newFixedThreadPool. On the other hand Retrofit uses Executors.newCachedThreadPool defined in Platform#defaultHttpExecutor which boils down to: executorService = new ThreadPoolExecutor( 0, Integer.MAX_VALUE, 60, TimeUnit.SECONDS, new SynchronousQueue&lt;Runnable&gt;(), someThreadFactory); Anyone has any ideas why OkHttp uses Executors#newFixedThreadPool and Retrofit Executors#newCachedThreadPool?
tagged with: okhttp
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/30607645
has title: Difference in ThreadPoolExecutor usage in OkHttp and Retrofit for async operations
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/23902136

http://stackoverflow.com/q/23817524
type: Question
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/36644508
has comment: http://stackoverflow.com/comment/36708262
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/36642980
has title: How to replace UsernamePasswordAuthenticationFilter in Spring Security
downvote count: 0
has body: Using XML configuration would be like &lt;custom-filter position="FORM_LOGIN_FILTER" ref="SCAAuthenticationFilter" /&gt;. Without XML would be like: httpSecurity.addFilter(new SCAAthenticationFilter()) It seems that spring doesn't replace UsernamePasswordAuthenticationFilter, but adds my filter before.
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/38984938
has answer: http://stackoverflow.com/a/25787389
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/36832045
has text: Yes. It is mirrored in my Maven Nexus proxy.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23873041

http://stackoverflow.com/a/24223174
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23845710
answers question: http://stackoverflow.com/q/23845710
type: AcceptedAnswer
downvote count: 0
has body: This is because your eclipse is 64 bit but your pointing to the 32 bit VM. Please correct the version issue and it will be resolved. Make sure that a 32 bit Eclipse points to a 32 bit VM or, a 64 bit Eclipse points to a 64 bit VM.
type: Answer

http://stackoverflow.com/q/23842357
type: AnsweredQuestion
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/23842448
has comment: http://stackoverflow.com/comment/36689685
has title: StringBuilder lost data when convert to String
tagged with: java
has answer: http://stackoverflow.com/a/23842459
type: Question
has answer: http://stackoverflow.com/a/23842693
upvote count: 4
downvote count: 0
tagged with: string
accepted answer: http://stackoverflow.com/a/23842693
score: 4
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36689137
tagged with: android
has body: here what's the problem I have problem when I tried to get String from my StringBuilder BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()), 128 * 1024); StringBuilder dataResponseSB = new StringBuilder(); String line ; while ((line = reader.readLine()) != null) { dataResponseSB.append(line); if (DataFactory.DEBUG_MODE) { // all data here are complete Log.i("===LoadDataActivity","line: "+line); } } String rawdata = new String(dataResponseSB); // dataResponseSB.toString(); also not work if (DataFactory.DEBUG_MODE) { // data here are lost Log.i("===LoadDataActivity","rawdata: "+rawdata); } (-) I receive a huge data from BufferedReader .readLine() (-) I use Log to check and sure that I got about 5 line of 8000 Buffer Size per line and I am very sure that I have receive all data properly (1) I append each line to StringBuilder Here (-) after I append all the line to StringBuilder (2) I try to convert it back to String (-) Now, the problem, the when I check to new String here, the data have only 8192 (it should contain at least 30,000 or more) What is the problem ? I am not sure it lost when it append to StringBuilder(1) or it lost when it convert back to String (2) I add the code that I have tried below here ,, I have tried both UTF8 and without UTF8 HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); //params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, ); params.setParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 128 * 1024); HttpClient client = new DefaultHttpClient(params); // HttpClient client = new DefaultHttpClient(new BasicHttpParams()); HttpPost httppost = new HttpPost(DataFactory.REQUEST_API_URL + "?id=" + DataFactory.USER_ID ); // Depends on your web service HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit HttpConnectionParams.setSocketBufferSize(client.getParams(), 128 * 1024); HttpResponse response = client.execute(…
has comment: http://stackoverflow.com/comment/36689005
has comment: http://stackoverflow.com/comment/36689037
possible better answer: http://stackoverflow.com/a/23842448

http://stackoverflow.com/q/23800685
has answer: http://stackoverflow.com/a/23811771
has comment: http://stackoverflow.com/comment/36725999
has comment: http://stackoverflow.com/comment/36723969
tagged with: encryption
has comment: http://stackoverflow.com/comment/36722499
type: AnsweredQuestion
tagged with: javacard
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/41043080
type: Question
has title: list of algorithms that supported by the card?
answer count: 2
has comment: http://stackoverflow.com/comment/36714666
upvote count: 1
possible better answer: http://stackoverflow.com/a/41043080
has comment: http://stackoverflow.com/comment/36762881
favorite count: 0
accepted answer: http://stackoverflow.com/a/23811771
has comment: http://stackoverflow.com/comment/36725848
score: 0
tagged with: smartcard
downvote count: 1
has body: I have a java card. How I can find the algorithms that the card support and use for it's cryptography? What happens when I click on the authenticate button in jcmanager (for example)? How I can authenticate with APDUs? This is output of jcmanager when I clicked on Authenticate : Open terminal ... EstablishContext(): ... Wait for card in a certain reader ... Pick reader ... ********************** Selecting Card Manager *********************** -&gt; 00 A4 04 00 08 A0 00 00 00 03 00 00 00 &lt;- 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF 90 00 ************ Init Update ************* -&gt; 80 50 00 00 08 D3 90 22 B2 C5 7C D4 DD &lt;- 00 00 11 60 01 00 7F 8B 0A F9 02 02 00 99 3E 01 33 1B 3F 8E 33 BA E4 AD 82 6E 3C C1 90 00 HostChallenge: D3 90 22 B2 C5 7C D4 DD CardChallenge: 3E 01 33 1B 3F 8E Card Calculated Card Cryptogram: 33 BA E4 AD 82 6E 3C C1 Derivation Data is 01 82 00 99 00 00 00 00 00 00 00 00 00 00 00 00 Host Cryptogram Data (to encrypt) 00 99 3E 01 33 1B 3F 8E D3 90 22 B2 C5 7C D4 DD 80 00 00 00 00 00 00 00 Card Cryptogram Data (to encrypt for verification) D3 90 22 B2 C5 7C D4 DD 00 99 3E 01 33 1B 3F 8E 80 00 00 00 00 00 00 00 S_ENC: CE 69 1B 1E C8 EC DB B0 0A 9B 18 4A 53 58 04 BB CE 69 1B 1E C8 EC DB B0 The Current session MAC key is F8 85 4D 94 19 BC 83 4C 99 BA E9 94 15 00 A6 B8 The Current session DEK key is 6D 72 48 D4 23 BF 3B 1C 7C 2F 1F BC 7C 04 E9 F6 Encrypted CardCryptoGram is 58 20 23 4E 14 8B FE AA F8 6D 14 20 3D 41 18 E4 33 BA E4 AD 82 6E 3C C1 Encrypted HostCryptoGram is 07 D0 B3 EB 0F 1B 7E 54 84 34 08 6C 5F D9 E5 55 4B 5F 0D F6 87 52 99 2E -&gt; 84 82 03 00 10 4B 5F 0D F6 87 52 99 2E 17 29 AA 68 12 98 CE 2D &lt;- 90 00 Authenticated Is this right : I send a random 8 byte number to the card: -> 80 50 00 00 08 D3 90 22 B2 C5 7C D4 DD and in the answer of my command, card give me a random numbers + the encrypted random number that I sent to the card. What happens next? my card and my reader with which algorithm encrypt and decrypt rando…
has comment: http://stackoverflow.com/comment/36725632

http://stackoverflow.com/q/23927671
tagged with: active-directory
type: Question
has title: Is it possible to get the Active directory password expiration date using spring LDAP?
downvote count: 0
has comment: http://stackoverflow.com/comment/87536978
tagged with: spring-ldap
favorite count: 0
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has body: I am new to Spring LADP . But , I have some real time experience Spring MVC . Now my requirement is to check when the password is going to expire in active directory ? I have searched in google and found some of the post to manage Active directory and those are very old (appx 2 to 5 years older). I didn't find solution for my requirement in http://docs.spring.io/spring-ldap/docs/2.0.2.RELEASE/reference/ Hope you people will help me to get the solution. Suggestions are always welcome.Thanks.
tagged with: jndi
tagged with: java

http://stackoverflow.com/comment/36859299
score: 0
comment on: http://stackoverflow.com/q/23931816
type: Comment
type: QuestionComment
has text: @Pshemo Yes, it works like a *setter*, but it [**doesn't return anything. Nor `void`**](http://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html).

http://stackoverflow.com/a/23835656
upvote count: 3
score: 1
accepted answer of: http://stackoverflow.com/q/23835508
has comment: http://stackoverflow.com/comment/36755191
answers question: http://stackoverflow.com/q/23835508
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36755416
has comment: http://stackoverflow.com/comment/36707108
has comment: http://stackoverflow.com/comment/36754345
downvote count: 2
type: Answer
has body: You can use the classloader directories for that. I would use the directory classes (you might need to create) under $WEBSPHERE_HOME/AppServer/classes and drop your properties there. You should than be able to find them from any of your applications / servers. Check the Class loaders page.

http://stackoverflow.com/comment/36807852
comment on: http://stackoverflow.com/q/23904391
score: 0
has text: @user979349 I did everything, but my question is why second works and why first doesn't?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23819095
possible better answer: http://stackoverflow.com/a/23824070
accepted answer: http://stackoverflow.com/a/24155769
tagged with: java
has answer: http://stackoverflow.com/a/23824070
tagged with: servlets
score: 0
linked to: http://stackoverflow.com/q/23698639
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24155769
downvote count: 1
tagged with: jsp
favorite count: 0
has title: I can't add a Servlet on my project
has body: I'm trying to add a servlet on my project. But it seems not to work. The first, I inserted the and tags in web.xml file. And the I tried to accesss the address "/App/newrmt?~~". But the browser showed 404 error message. I think the system don't recognize the mapping pattern I described. Is there anything I should do to add a new servlet and a pattern before insert tags in web.xml files? It's original web.xml code is below. action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 1 HttpReceiver myProject.HttpReceiver 1 RmtlImg myProject.ImageServlet dir /APP/WAS/FILES/A/ action *.do HttpReceiver *.http RmtlImg /rmtlimgdown Then, I changed the code like below action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 1 HttpReceiver myProject.HttpReceiver 1 RmtlImg myProject.ImageServlet dir /APP/WAS/FILES/A/ ** NewRmtlImg myProject.ImageServlet dir /APP/WAS/FILES/A/ ** action *.do HttpReceiver *.http RmtlImg /rmtlimgdown ** NewRmtlImg /newrmt ** When I change just pattern in the tag like below, It works well. It means servlet-class itself is well coded. Just the WAS don't understand the pattern. NewRmtlImg /newrmt ===> NewRmtlImg /rmtlimgdown Anyboday helps me!
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: web.xml
has comment: http://stackoverflow.com/comment/36645618
type: Question

http://stackoverflow.com/q/23855664
has answer: http://stackoverflow.com/a/23855808
has comment: http://stackoverflow.com/comment/36714624
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/11932037
possible better answer: http://stackoverflow.com/a/23855692
has answer: http://stackoverflow.com/a/23855692
upvote count: 3
tagged with: java
has title: unable to understand the working of interface in java
type: Question
has answer: http://stackoverflow.com/a/23855786
downvote count: 0
has comment: http://stackoverflow.com/comment/36714649
has body: I have declared an interface public interface A { public void print(); } another interface public interface B extends A { public void print(); } Then class public class C implements A,B { @Override public void print() { System.out.println(B.i); } } Kindly tell me why there is no compile time error when both the interfaces have methods with same name and how does compiler determine which interface's method is being implemented?? thanks in advance
answer count: 3
linked to: http://stackoverflow.com/q/2598009
accepted answer: http://stackoverflow.com/a/23855786
favorite count: 0
duplicate of: http://stackoverflow.com/q/2598009

http://stackoverflow.com/comment/36655619
score: 0
type: Comment
type: QuestionComment
has text: note: the service class makes the http call, checks status codes and all that jazz, and loads the returned JSON into a class via gson and hands it off to the on the fly implemented `task` class.
comment on: http://stackoverflow.com/q/23824684

http://stackoverflow.com/comment/36707125
comment on: http://stackoverflow.com/q/23851203
type: QuestionComment
type: Comment
has text: Sorry for not making it clear. But I've added the class in the code. Main() belongs to the: interfacetest class. Also I use eclipse.
score: 0

http://stackoverflow.com/a/23903153
type: Answer
upvote count: 1
score: 1
has body: As greg-449 already commented, that when the code is with user, it can be hacked in one way or the another. If Encryption of secure data is not going to help, you can move the secure data on your server. Impact would be, it is available only when the user is online. Another solution, a bit complex one: Don't store High Score at all. Store/ log the user's activities to calculate high score. make the logs encrypted to add more security. Use salt, timestamp and secure key while encryption and a checksum to prevent manual changes to the file.
has comment: http://stackoverflow.com/comment/36840042
downvote count: 0
answers question: http://stackoverflow.com/q/23858164
has comment: http://stackoverflow.com/comment/40029923

http://stackoverflow.com/a/23823023
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23815897
has comment: http://stackoverflow.com/comment/36686368
has body: You can have the Java side as: @Enumerated(EnumType.ORDINAL) @Column(name = "user_type") private UserType userType; public enum UserType { CLIENT, ADMIN; } and the SQL side: CREATE TABLE user ( id bigint PRIMARY KEY, user_type bigint NOT NULL ); CREATE TABLE enum_user_type ( id bigint PRIMARY KEY, name varchar(255), desc text ); ALTER TABLE user ADD CONSTRAINT user_type_fk FOREIGN KEY (user_type) REFERENCES enum_user_type(id); INSERT INTO enum_user_type (id, name, desc) VALUES ( 0, 'CLIENT', 'This is a client'); INSERT INTO enum_user_type (id, name, desc) VALUES ( 1, 'ADMIN', 'This is an admin'); So in java you always set: user.setUserType(UserType.ADMIN); In the user table the enum is stored using the ordinal. Since you already have an enum associate table, you can use it in SQL JOINs with native queries. If you find that you need to use HQL to fetch the enum name or description than maybe the enum should be promoted to an Entity.
upvote count: 1
has comment: http://stackoverflow.com/comment/36681749

http://stackoverflow.com/q/23877330
has body: I want to write function in my android application that will confirm that picture was taken by specific mobile device. Today I can tell, if the picture was taken by specific model. (like galaxy s3). But,I want more than that. I would like to get from image EXIF unique id and compare it to the device unique id. Thanks for help.
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36756203
has answer: http://stackoverflow.com/a/23877471
tagged with: exif
score: 2
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36832886
has comment: http://stackoverflow.com/comment/36755607
has title: How to confirm that image was taken with specific device?
tagged with: image

http://stackoverflow.com/a/23932055
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36862741
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23931520
has body: Change com.google.android.ads to com.google.android.gms.ads In your main activity and your manifest because you're using the old ads, use the .gms change your xml too, to the .gms adview.

http://stackoverflow.com/q/23894601
linked to: http://stackoverflow.com/q/18299898
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23894704
has title: I can't use Notification
favorite count: 0
tagged with: sdk
tagged with: android
upvote count: 0
duplicate of: http://stackoverflow.com/q/18299898
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: netbeans-6.9
score: -1
linked to: http://stackoverflow.com/q/18856264
has body: i'm developing a software and i need to create a notification.. Well seeing a lot tutorial, i can't follow one, because my import NotificationCompat don't show. I updated ALL my SKD Manager and I did jar download (android-support-v4.jar), don't work @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) { if (resultCode == RESULT_OK) { //Notification Here! } } }

http://stackoverflow.com/q/23900172
has answer: http://stackoverflow.com/a/23900252
upvote count: 4
has comment: http://stackoverflow.com/comment/36801004
type: AnsweredQuestion
downvote count: 0
has title: How to get localhost network interface in java or scala
has body: I'm trying to get the MAC address for my machine inside a scala application. There are several results when searching, but they all use something like the following, involving InetAddress.getLocalHost() followed by NetworkInterface.getByInetAddress(...): Get MAC address on local machine with Java My problem is that the result ends up being null: val localhost = InetAddress.getLocalHost println(s"lh: $localhost") val localNetworkInterface = NetworkInterface.getByInetAddress(localhost) println(s"lni: $localNetworkInterface") &gt;&gt;lh: ubuntu/127.0.1.1 &gt;&gt;lni: null
favorite count: 0
accepted answer: http://stackoverflow.com/a/23900337
type: Question
tagged with: scala
answer count: 2
linked to: http://stackoverflow.com/q/6164167
score: 4
tagged with: java
possible better answer: http://stackoverflow.com/a/23900252
has answer: http://stackoverflow.com/a/23900337

http://stackoverflow.com/a/23891766
type: Answer
score: 1
has body: You should definitly use org.apache.commons.io.IOUtils.closequietly when dealing with streams and APIs you are not sure about
upvote count: 1
answers question: http://stackoverflow.com/q/23891562
downvote count: 0

http://stackoverflow.com/comment/36665871
type: AnswerComment
has text: Oracle? Java was originally designed, developed, maintained and guarded by Sun Microsystems. Oracle only bought the blame.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23829864

http://stackoverflow.com/comment/36846256
score: 0
has text: any body used hama before, plzzzzzzzzzzzzzz help
type: Comment
comment on: http://stackoverflow.com/q/23912772
type: QuestionComment

http://stackoverflow.com/comment/36851010
score: 0
comment on: http://stackoverflow.com/q/23911217
has text: @Roman C..I specified 3 countries in 1st combobox. <s:combobox label="SelectCountry" headerKey="-1" headerValue="SELECT" list="#{'India':'India','Tamil eelam':'Tamil eelam','USA':'USA'}" name="country" label="Country"/> also specified 6 states in 2nd <s:combobox label="Selectstate" headerKey="-1" headerValue="SELECT" list="#{'TamilNadu':'TamilNadu','punjab':'punjab','yaazh':'yaazh','vanni':'vanni','New york':'New york','Washington':'Washington'}" name="state" label="State"/>.... if i click country(Tamil eelam) in 1st combobox,In 2nd combobox it should display(yaazh,vanni) only.How to do this?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23859691
tagged with: java
has body: I want to run my android junit test case from my java class. Can I do that using JUnitCore class run method or is there some other way possible.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36722896
has title: How to run Android Junit Test from inside my java application
tagged with: junit
tagged with: activityunittestcase
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/36722636

http://stackoverflow.com/comment/36694488
type: QuestionComment
has text: Just a class that holds ImageIO.read command. It is now in the question.
score: 0
comment on: http://stackoverflow.com/q/23817482
type: Comment

http://stackoverflow.com/a/23837343
has body: The trick is to communicate the depth of the subtree back to the higher level of the stack, but doing so only when both right and left depths are the same. You can do it with a simple recursive function: int eqDepth(Node n) { if (n == null) return 0; // This is a leaf, its subtree depth is zero int dLeft = eqDepth(n.left); // Make two recursive calls int dRight = eqDepth(n.right); // If one of the depths is negative, or the depths are different, // report it by returning negative 1: if (dLeft &lt; 0 || dRight &lt; 0 || dLeft != dRight) return -1; return 1+dLeft; // It's the same as dRight } With this function in hand, you can code allAtSameLevel in one line: public boolean allAtSameLevel(Node root) { return eqDepth(root) &gt;= 0; } Here is a demo on ideone. It starts off with an unbalanced tree and gets a -1 a / \ b c / \ / \ d e f - then adds the missing node a / \ b c / \ / \ d e f g and gets a positive result.
accepted answer of: http://stackoverflow.com/q/23837218
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36682334
type: Answer
has comment: http://stackoverflow.com/comment/36683596
has comment: http://stackoverflow.com/comment/36682562
upvote count: 1
answers question: http://stackoverflow.com/q/23837218
score: 1

http://stackoverflow.com/q/23843437
has comment: http://stackoverflow.com/comment/36691053
has comment: http://stackoverflow.com/comment/36691090
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/36691176
score: 0
has body: My Mysql table structure is like this id category name This is the way to show in jsp &lt;c:forEach items="${parentList}" var="test"&gt; &lt;ul style="max-width: 300px;" class="nav nav-pills nav-stacked"&gt; &lt;li class="active"&gt;&lt;a href="#" value="${test.id}-${test.category}" id="${parent.id}" onclick="return getQuestions(this);"&gt; &lt;input type="checkbox" value="${test.id}"&gt;${test.name }&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/c:forEach&gt; parentList is obtained from the below method List&lt;Parent&gt; parentList = (List&lt;Parent&gt;) serviceClientServiceImpl.getParents("Parent",Long.valueOf(clientId)); this is my serviceClientServiceImpl.getParents public List&lt;Parent&gt; getParents(String entityName,Long clientId) { List&lt;Parent&gt; parentsList = null; try { parentsList = (List&lt;Parent&gt;) serviceClientDaoImpl.getParents(entityName,clientId); } catch(Exception e) { } return parentsList; } and this is my serviceClientDaoImpl.getParents public List&lt;Parent&gt; getParents(String entityName,Long cId) { String queryString=""; queryString="select p FROM "+entityName+"p WHERE category=default or category=client and p.cid="+cId; Query query=entityManagerUtil.getQuery(queryString); query.setParameter("cId", cId); return query.getResultList(); } The problem is I do not see any thing in the html.So can any body tell me whats the mistake
has answer: http://stackoverflow.com/a/23843802
accepted answer: http://stackoverflow.com/a/23843802
has title: How to get username from a table
has comment: http://stackoverflow.com/comment/36690979
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/23863401
favorite count: 0
upvote count: 1
tagged with: spring
has body: I have a Spring MVC + Hibernate + JPA app. I hava a defaultPersistance unit, that is defined in persistence.xml: org.hibernate.ejb.HibernatePersistence <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" /> <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://localhost:1433;databaseName=B3;" /> <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver" /> <property name="hibernate.connection.username" value="hiber1" /> <property name="hibernate.connection.password" value="hiber1" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> I have an entityManagerFactory and transactionManager wired in mvc-dispatcher-servlet.xml: <property name="entityManagerFactory" ref="entityManagerFactory" /> <tx:annotation-driven transaction-manager="transactionManager"/> So my question is: how can I change hibernate connection properties (eg. hibernate.connection. username) during runtime?
has comment: http://stackoverflow.com/comment/36729950
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36733171
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36732126
has answer: http://stackoverflow.com/a/23866052
has comment: http://stackoverflow.com/comment/36730127
type: Question
has comment: http://stackoverflow.com/comment/36729987
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/36731783
has title: Changing persistenceUnit properties during runtime
accepted answer: http://stackoverflow.com/a/23866052
answer count: 1
score: 1

http://stackoverflow.com/q/23904391
has comment: http://stackoverflow.com/comment/36807816
has title: Scanner vs System.console( ).write( )
answer count: 2
has comment: http://stackoverflow.com/comment/36843193
has answer: http://stackoverflow.com/a/23904482
has comment: http://stackoverflow.com/comment/36807965
has body: I tried to print out a string that includes Spanish accents on the screen. I get different answer with the same input, but with different approaches. My first approach is to read a string that includes Spanish accents via Scanner class //input is a á e é i í o ó u ú A Á E É I Í O Ó U Ú Ñ ñ Scanner sc = new Scanner(System.in); System.out.println("Enter some spanish chars next: "); String spanishLine = sc.nextLine(); try { System.out.println("Output from Scanner: " + spanishLine); System.console().writer().println(spanishLine); } catch (Exception e) { } My second apporche is which I found from this webiste: http://www.rgagnon.com/javadetails/java-0046.html String s = "a á e é i í o ó u ú A Á E É I Í O Ó U Ú Ñ ñ"; try { System.out.println("Output from System.console: " + s); System.console().writer().println(s); } catch (Exception e) { } My out come is as follows Enter some spanish chars next: a á e é i í o ó u ú A Á E É I Í O Ó U Ú Ñ ñ output from Scanner: a � e � i � o � u � A � E � I � O � U � � � output from System.console: a á e é i í o ó u ú A Á E É I Í O Ó U Ú Ñ ñ Can anyone explain why I get two different answers from the same input. How can I fix up my first approach to have same result as the second one?
tagged with: string
has comment: http://stackoverflow.com/comment/36807852
favorite count: 0
has comment: http://stackoverflow.com/comment/36807817
has comment: http://stackoverflow.com/comment/36807797
has comment: http://stackoverflow.com/comment/36807771
has comment: http://stackoverflow.com/comment/36808084
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36808379
score: 2
possible better answer: http://stackoverflow.com/a/23904482
has comment: http://stackoverflow.com/comment/36807896
downvote count: 3
has comment: http://stackoverflow.com/comment/36808187
type: Question
has answer: http://stackoverflow.com/a/23923431
accepted answer: http://stackoverflow.com/a/23923431
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36808798
has comment: http://stackoverflow.com/comment/36807788

http://stackoverflow.com/a/23815700
has body: import java.awt.BorderLayout; import java.awt.Color; import java.awt.ComponentOrientation; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.TitledBorder; public class DiffuserCalc { //create the class data fields private double qts; private double qes; private double vas; private JFrame programBounds = new JFrame(); private JLabel label1= new JLabel("Qts"); private JLabel label2= new JLabel("Qes"); private JLabel label3= new JLabel("Fs"); private JLabel label4= new JLabel("BL"); private JLabel label5= new JLabel("Xmax"); private JLabel label6= new JLabel("Fs"); private JLabel label7= new JLabel("Vas"); private JLabel label8= new JLabel("Diameter"); private JLabel label9= new JLabel("Pmax (RMS)"); private JTextField qtsParam = new JTextField("Value"); private JTextField qesParam = new JTextField("Value"); private JTextField fsParam = new JTextField(""); private JTextField bLParam = new JTextField(""); private JTextField xmaxParam = new JTextField(""); private Font myFont = new Font("Tahoma", Font.BOLD, 20); DiffuserCalc() { programBounds.setTitle("Box Designer"); JPanel parameterMenu = new JPanel(); JPanel labelPanel = new JPanel(); JPanel fieldInputs = new JPanel(); // LAYOUT programBounds.setLayout(new BorderLayout()); parameterMenu.setLayout(new BorderLayout()); fieldInputs.setLayout(new FlowLayout(FlowLayout.LEFT)); fieldInputs.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); labelPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); labelPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); programBounds.add(parameterMenu, BorderLayout.NORTH); parameterMenu.add(labelPanel, BorderLayout.NORTH); parameterMenu.add(fieldInputs, BorderLayout.SOUTH); // programBounds.add(fieldInputs); programBounds.setSize(1280,720); Border lineBdr = BorderFact…
has comment: http://stackoverflow.com/comment/36680372
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36680586
answers question: http://stackoverflow.com/q/23814551

http://stackoverflow.com/comment/36580993
score: 0
type: Comment
has text: Exactly and they must be the last rows inserted in table B that point to the row in table A. However, I don't want to see state of table B between the two transactional steps 1 and 2.
type: AnswerComment
comment on: http://stackoverflow.com/a/23785373

http://stackoverflow.com/a/23831105
has body: don't use regex for date parsing, use the date parser, E.g SimpleDateFormat.parse()
answers question: http://stackoverflow.com/q/23830972
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/23940533
score: 0
has body: If you just want to set/get the time from milliseconds, you can do this with a C# TimeSpan: private TimeSpan time public void setMs(long ms) { this.time = TimeSpan.FromMilliseconds(ms); } public long getMs() { return this.time.TotalMilliseconds; }
type: Answer
answers question: http://stackoverflow.com/q/23940124

http://stackoverflow.com/comment/36698693
comment on: http://stackoverflow.com/q/23847379
has text: Marco Acierno that is for C# not for java.
score: 0
type: Comment
type: QuestionComment

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/23826707
tag name: grouplayout
tags question: http://stackoverflow.com/q/23811340

http://stackoverflow.com/comment/36636444
type: QuestionComment
has text: The application is at my work computer, ill edit this post tomorrow with logcat.
comment on: http://stackoverflow.com/q/23812169
score: 0
type: Comment

http://stackoverflow.com/comment/36803796
type: Comment
type: QuestionComment
has text: The problem is, I'm trying to guess what `this.getX` and `this.getY` mean, to me, they mean component locations, but that might not be true
comment on: http://stackoverflow.com/q/23902159
score: 0

http://stackoverflow.com/comment/36666474
type: Comment
has text: @M.Deinum I understand _why_ I'm seeing 1, but I'm calling that a concurrency bug. I think reads should always return the actual value at the time that the read was initiated. If the reads and writes during step 2 had been locked to prevent interleaving, step 3 would have shown the correct result. My point is that I assumed the cache annotations would implement that locking for me, and it looks like that assumption is wrong.
type: QuestionComment
comment on: http://stackoverflow.com/q/23830193
score: 0

http://stackoverflow.com/q/23880453
type: Question
downvote count: 0
tagged with: selenium-grid
answer count: 1
has answer: http://stackoverflow.com/a/23883902
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: selenium-grid2
has title: Getting remote node IP address in Selenium Grid env
score: 2
has body: I need to get the remote node IP which is connected with Selenium grid hub. We are using multiple os platforms (Linux, Mac, Windows). Any have idea of getting remote node IP in selenium Grid env using java programming?
tagged with: java
tagged with: webdriver

http://stackoverflow.com/comment/36690780
score: 0
type: AnswerComment
has text: ya its connecting to db after refresh and displaying desired result but not connecting from very first time of session
type: Comment
comment on: http://stackoverflow.com/a/23842325

http://stackoverflow.com/q/23852451
answer count: 2
tagged with: xa
accepted answer: http://stackoverflow.com/a/23863759
score: 0
possible better answer: http://stackoverflow.com/a/23985705
tagged with: teradata
has answer: http://stackoverflow.com/a/23863759
type: AnsweredQuestion
has title: Global Transaction with Teradata
tagged with: transactions
has answer: http://stackoverflow.com/a/23985705
tagged with: java
has body: I am using Oracle and Teradata both databases in my Java based project. I want to setup global transaction so that I can perform operations on both the Database under one transaction. For global transactions such as JTA or atomikos database must have XA driver support. But as my findings Teradata doesn't have XA driver. So now how could I setup the global transaction and performance operations on both database under 1 transaction?
tagged with: spring-transactions
type: Question

http://stackoverflow.com/q/23934543
linked to: http://stackoverflow.com/q/982814
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/24951729
tagged with: jstl
has comment: http://stackoverflow.com/comment/36873536
downvote count: 0
has comment: http://stackoverflow.com/comment/36900048
tagged with: jsp
possible better answer: http://stackoverflow.com/a/33379697
accepted answer: http://stackoverflow.com/a/24951729
has body: I have a file form.jsp with a form, that submit to test.jsp. form.jsp test.jsp this is a test <c:import url="/anotherpage" /> I'm using SpringMvc. Here is the controller: @RequestMapping(value="/form", method=RequestMethod.GET ) public String form(){... } @RequestMapping(value="/test", method = RequestMethod.POST ) public String test(){ ... } @RequestMapping(value="/anotherpage", method = RequestMethod.GET ) public String anotherpage(){ ... } When submit button is clicked, the tag <c:import url="/anotherpage" /> does not work. However if i change the method to get :@RequestMapping(value="/test", method = RequestMethod.GET ) and it works correctly. Why <c:import url="/anotherpage" /> only work with method GET? Edit: I'm using: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
has answer: http://stackoverflow.com/a/33379697
type: Question
has comment: http://stackoverflow.com/comment/36901519
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36870924
favorite count: 0
has title: Using <c:import> with method post doesn't work
has comment: http://stackoverflow.com/comment/36892906
answer count: 2
upvote count: 1
tagged with: spring

http://stackoverflow.com/comment/36678619
type: QuestionComment
score: 0
has text: Use a proper benchmarking framework which prevents loads of uncertain things, or this simply isn't valid or serious. Start with investigating JMH or Caliper.
comment on: http://stackoverflow.com/q/23828392
type: Comment

http://stackoverflow.com/a/23829303
score: 0
answers question: http://stackoverflow.com/q/23829219
type: Answer
has body: I haven't touched Java Swing for years, but have you tried something like this? public void actionPerformed(ActionEvent evt) { int currentCols = txt.getColumns(); txt.setColumns(currentCols + 5); } What I'm trying to do here is increasing the columns of the JTextBox by 5, everytime the button is clicked I'm not sure if this works, but I hope I helped you

http://stackoverflow.com/a/28688938
has body: getConfig().getConfigurationSection("effected mobs").getKeys(false).toArray(); You should read the wiki more carefully xD
answers question: http://stackoverflow.com/q/23860122
score: 0
type: Answer

http://stackoverflow.com/q/23929601
has answer: http://stackoverflow.com/a/23929842
type: Question
linked to: http://stackoverflow.com/q/2995054
has answer: http://stackoverflow.com/a/23929814
has comment: http://stackoverflow.com/comment/36854836
has comment: http://stackoverflow.com/comment/36854804
score: 0
answer count: 3
tagged with: jdbc
has answer: http://stackoverflow.com/a/23929839
accepted answer: http://stackoverflow.com/a/23929839
has title: JDBC Access denied error
possible better answer: http://stackoverflow.com/a/23929814
type: AnsweredQuestion
tagged with: java
has body: I am trying to deploy my application to another server, and while the JDBC connection worked in my machine, I couldn't get it to work with this mysql server. Some information about the mysql server: select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ mysql&gt; show variables where Variable_name="port"; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3306 | +---------------+-------+ There is no password to login into the mysql with user localhost (mysql -u root will be enough to login) I used the following statement to connect to the database DriverManager.getConnection( "jdbc:mysql://localhost:3306/database_name", "root", "")); But, It throws the following error java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) Any suggestions? Thanks.
tagged with: mysql

http://stackoverflow.com/a/23883268
has body: You can do one thing : Go to program files '\Program Files (x86)\Weka-3-6' and then RunWeka.ini. Open it in notepad and change the line in the middle of the file 'maxheap = 512m' to 'maxheap = 2000m'.
type: Answer
has comment: http://stackoverflow.com/comment/36767490
score: 0
answers question: http://stackoverflow.com/q/23883014

http://stackoverflow.com/q/23829913
has comment: http://stackoverflow.com/comment/36664726
tagged with: android
tagged with: android-actionbar
has answer: http://stackoverflow.com/a/23830088
has comment: http://stackoverflow.com/comment/36664767
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36664712
tagged with: java
has comment: http://stackoverflow.com/comment/36664971
type: Question
accepted answer: http://stackoverflow.com/a/23830088
tagged with: containers
score: 0
has body: I am trying to add action bar on top, and two containers below the action bar, each of the containers I want to have 80% of width and 20% of width. Here is my XML file which is not working:
answer count: 1
has comment: http://stackoverflow.com/comment/36664715
has title: Adding containers and action bar to an Android Activity.

http://stackoverflow.com/comment/44604046
type: QuestionComment
type: Comment
has text: @CiroSantilli I don't see the added value of linking that question. What are you trying to say?
score: 0
comment on: http://stackoverflow.com/q/23899353

http://stackoverflow.com/q/23885042
has answer: http://stackoverflow.com/a/23885816
tagged with: apache-commons-fileupload
tagged with: java
has answer: http://stackoverflow.com/a/42852485
has comment: http://stackoverflow.com/comment/36771199
has body: Here my requirement is to upload the file and to store it in the disk. I have no problem in storing it in disk, but getting the extension of the file. The problem is when I click on upload and processing the file to store in disk, it is saved as a temp file with following name "/tmp/multipartBody6238081076014199817asTemporaryFile" here the file doesn't have an extension. So any of the following libraries doesn't help me get the extension of the file. FileNameUtils.getExtension() or Files.getFileExtension(path) I've even tried to get it through it's attributes, but it doesn't have an option to get the file extension. Path path = Paths.get("/**/**/filepath"); BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class); HTML code: &lt;input type="file" name="fileInput" class="filestyle" data-classIcon="icon-plus" data-classButton="btn btn-primary" &gt; Get file object from Play framework: MultipartFormData body = request().body().asMultipartFormData(); FilePart fileInput = body.getFile("fileInput"); File file = fileInput.getFile(); Any help to extract file extension is highly appreciated. Thanks,
has title: Get file extension from uploaded file
tagged with: playframework
downvote count: 0
has comment: http://stackoverflow.com/comment/36773229
favorite count: 0
has comment: http://stackoverflow.com/comment/36770568
possible better answer: http://stackoverflow.com/a/23885816
accepted answer: http://stackoverflow.com/a/23891415
answer count: 4
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36770697
has comment: http://stackoverflow.com/comment/36770784
upvote count: 2
has answer: http://stackoverflow.com/a/23891415
has comment: http://stackoverflow.com/comment/36770504
type: Question
has comment: http://stackoverflow.com/comment/36770834
has answer: http://stackoverflow.com/a/65158716

http://stackoverflow.com/a/23816737
type: Answer
has comment: http://stackoverflow.com/comment/36658429
upvote count: 1
has body: Based on your comment, I understand your questions as a performance question. Saving and using an int in resources instead of a float should not be noticeable in the performance at all. By that note I think saving an int and then dividing by 100 all the time would be silly, when you could just as well save a float. Also noting that when you divide your int it will get implicitly converted to a double anyway. You say that you use the value for an alpha value, and you might only need the precision 1 to 100, using a float for that kind of precision is very reasonable, and also reasonable for an alpha value. You might want to read Float or Double?
score: 1
accepted answer of: http://stackoverflow.com/q/23793527
answers question: http://stackoverflow.com/q/23793527
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25693862
has comment: http://stackoverflow.com/comment/63099150
type: Answer
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/80851237
has body: Try: import org.kohsuke.args4j.spi.StringArrayOptionHandler; @Option(name = "-p", handler = StringArrayOptionHandler.class, required = true) private List&lt;String&gt; list; which should allow -p arg1 arg2 ...
accepted answer of: http://stackoverflow.com/q/23800070
score: 15
answers question: http://stackoverflow.com/q/23800070
type: AcceptedAnswer

http://stackoverflow.com/q/23896706
type: UnansweredQuestion
has body: I'm reading messages from a TCP connection. The sender is sending a byte array but the BufferedReader reads it as a string. How can I convert the message to a byte array so I can then convert it to the actual message? Say I want to send "hello". I use String message = "hello" byte[] byteData = message.getBytes(); I then send the message. It's received as a string of, say, 0Bf3f3. I need to convert it back to "hello".
has answer: http://stackoverflow.com/a/23896794
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23896786
has answer: http://stackoverflow.com/a/23896759
score: 0
answer count: 3
has title: convert a string holding byte array values to byte array

http://stackoverflow.com/comment/36764837
score: 0
has text: Both the actual values as well as the error messages are part of the model so those are there. You can use the form tags to show the values/errors as you like. If they aren't there you are doing something in your code to destroy a proper (normal) working of the controllers.
type: Comment
comment on: http://stackoverflow.com/q/23875257
type: QuestionComment

http://stackoverflow.com/comment/36592047
score: 1
comment on: http://stackoverflow.com/q/23791242
type: Comment
type: QuestionComment
has text: A "singleton pattern" may be better, because it lets you control the access better--one reason to avoid `public static` variables is that they can be assigned at any time, anywhere in your app. But I think you need one or the other, since there's no other good way to pass data between activities, other than small amounts in `Intent#putExtra`.

http://stackoverflow.com/q/23916902
linked to: http://stackoverflow.com/q/9043170
tagged with: inner-classes
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/2808501
has body: How to call the callback function of outter class without using a helper variable like i did in my example below. Please note that the solution described in Calling outer class function from inner class probably won't work. public abstract class Job { public void callback(); } public abstract class ExtendedJob extends Job { protected void handleResult() { // workaround for accessing the outter class final ExtendedJob outter = this; new ExtendedJob { public void callback() { // can i do the same without the outter variable? outter.callback(); } } } }
duplicate of: http://stackoverflow.com/q/9043170
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36831391
has comment: http://stackoverflow.com/comment/36831631
has comment: http://stackoverflow.com/comment/36831798
tagged with: anonymous-class
has answer: http://stackoverflow.com/a/23917073
has comment: http://stackoverflow.com/comment/36831329
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23917073
type: AnsweredQuestion
has title: call function of outter class from inner anonymous class (same class as outter)

http://stackoverflow.com/q/23918836
tagged with: android
has body: I am trying to find out current latitude and longitude of android device but I am getting java.lang.nullpointerexception and app is force closing.even though i get refrence from here and used the code from the answer which was accepted as correct: How to get Android GPS location my code is: try{ LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String bestProvider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(bestProvider); double latit=location.getLatitude(); double longit=location.getLongitude(); Toast.makeText(getApplicationContext(),"Your Location is:\nLatitude:\t"+latit+"\nLongitude:\t"+longit,Toast.LENGTH_LONG).show(); }catch(Exception ex){ Toast.makeText(getApplicationContext(), "Error:"+ex,Toast.LENGTH_LONG).show(); }
type: UnansweredQuestion
tagged with: locationmanager
has comment: http://stackoverflow.com/comment/36835006
has comment: http://stackoverflow.com/comment/36835402
type: Question
linked to: http://stackoverflow.com/q/16498450
tagged with: java
score: 0
answer count: 1
has title: Getting error in the location manager
has comment: http://stackoverflow.com/comment/36835491
has comment: http://stackoverflow.com/comment/36834892
has comment: http://stackoverflow.com/comment/36835116
has answer: http://stackoverflow.com/a/23919014

http://stackoverflow.com/comment/36685176
comment on: http://stackoverflow.com/a/23819052
type: AnswerComment
score: 0
type: Comment
has text: I added a runnable example and correct some wrong method calls, it should `isIcon` and `setIcon`

http://stackoverflow.com/q/23862514
answer count: 2
tagged with: 3d
downvote count: 0
tagged with: javafx-8
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27698040
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/25144483
has body: I am currently working on a 3d visualisation project using javafx 8. As having too many points is slow when rotating the camera around, I decided to hide those points(3d boxes in my case) not displayed on the scene. The problem is when I call box.localToScreen(0, 0, 0), the coordinates seems not correct some times. e.g, sometimes the point is still displayed on the screen, but its coordinates returned by localToScreen(0, 0, 0) can be negative. Have I missed something? or have I misused this method? Here are some codes I have: // where I build these boxes from points for (point p : mergedList) { Box pointBox = new Box(length, width, height); boxList.add(pointBox); pointBox.setTranslateX(p.getX()); pointBox.setTranslateY(p.getY()); pointBox.setTranslateZ(p.getZ()); ... // where I call localToScreen to get its coordinates for (Box b : boxList) { Point2D p = b.localToScreen(0, 0, 0); // I have also tried b.localToScreen(b.getTranslateX(), b.getTranslateY(), b.getTranslateZ()) double x = p.getX(), y = p.getY(); System.out.println(x); System.out.println(y); } Thanks in advance.
has title: In Javafx 8, how can I get the correct screen position of a 3d Node?
type: Question

file
type: Tag
tags question: http://stackoverflow.com/q/23923771
tags question: http://stackoverflow.com/q/23934832
tags question: http://stackoverflow.com/q/23835393
tags question: http://stackoverflow.com/q/23780333
tags question: http://stackoverflow.com/q/23808440
tags question: http://stackoverflow.com/q/23793343
tags question: http://stackoverflow.com/q/23860003
tags question: http://stackoverflow.com/q/23876368
tags question: http://stackoverflow.com/q/23878992
tag name: file
tags question: http://stackoverflow.com/q/23828708
tags question: http://stackoverflow.com/q/23920316
tags question: http://stackoverflow.com/q/23897305
tags question: http://stackoverflow.com/q/23819282
tags question: http://stackoverflow.com/q/23846028
tags question: http://stackoverflow.com/q/23848409
tags question: http://stackoverflow.com/q/23815552
tags question: http://stackoverflow.com/q/23938532
tags question: http://stackoverflow.com/q/23932478
tags question: http://stackoverflow.com/q/23845480
tags question: http://stackoverflow.com/q/23838253
tags question: http://stackoverflow.com/q/23880008
tags question: http://stackoverflow.com/q/23816356
tags question: http://stackoverflow.com/q/23795140
tags question: http://stackoverflow.com/q/23819786
tags question: http://stackoverflow.com/q/23877684
tags question: http://stackoverflow.com/q/23791141
tags question: http://stackoverflow.com/q/23791142
tags question: http://stackoverflow.com/q/23856935
tags question: http://stackoverflow.com/q/23878647
tags question: http://stackoverflow.com/q/23836873
tags question: http://stackoverflow.com/q/23815676
tags question: http://stackoverflow.com/q/23932930
tags question: http://stackoverflow.com/q/23786286
tags question: http://stackoverflow.com/q/23788077
tags question: http://stackoverflow.com/q/23786277
tags question: http://stackoverflow.com/q/23928288
tags question: http://stackoverflow.com/q/23797016
tags question: http://stackoverflow.com/q/23878391

http://stackoverflow.com/a/23780073
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23779841
score: 2
has body: See the javadoc here getElementsByTagName() returns all descendants, and since you call doc.getElementsByTagName() you get all descendants of doc which match the element name, rather than all descendants of your application element
downvote count: 0

http://stackoverflow.com/a/23838525
downvote count: 0
has comment: http://stackoverflow.com/comment/36681690
upvote count: 3
has comment: http://stackoverflow.com/comment/36681799
answers question: http://stackoverflow.com/q/23838481
has body: Do you have any context around what you're doing? Is there a reason that you're storing a comma delimited String with numbers, rather than, say, an Array or List of numbers? If you used one of those, the removal would be much simpler. But again, I don't know the context of what you're doing.
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/36681731

http://stackoverflow.com/comment/36634261
has text: lol...now I understand :D...nice one!
score: 0
comment on: http://stackoverflow.com/q/23787254
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/65633320
has text: A bit incorrect. You cannot run the class using the usual way. But you can write a custom loader that executes the modified main.
type: Comment
comment on: http://stackoverflow.com/a/23856777
type: AnswerComment
score: 0

http://stackoverflow.com/q/23845346
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36694701
type: Question
accepted answer: http://stackoverflow.com/a/23845585
has answer: http://stackoverflow.com/a/23845585
upvote count: 1
has comment: http://stackoverflow.com/comment/36694404
answer count: 1
has body: I want to create a table in postgresql which is not exists. hibernate.cfg.xml <hibernate-configuration> org.postgresql.Driver toor jdbc:postgresql://localhost:5432/hibernatedb postgres org.hibernate.dialect.PostgreSQLDialect thread update true <mapping class="org.firsthibernatproject.dto.Person"/> </hibernate-configuration> Enity : @Entity @Table (name="PERSON_DETAILS") public class Person { @Id @Column (name="id") private int id; @Column (name="first_name") private String firstName; @Column (name="last_name") private String lastName; private Date joinedDate; private String adresse; private String description; public String getAdresse() { return adresse; } public void setAdresse(String adresse) { this.adresse = adresse; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getJoinedDate() { return joinedDate; } public void setJoinedDate(Date joinedDate) { this.joinedDate = joinedDate; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } And this is the code I tried to create the new table : public class HibernateTest { public static void main (String args[]) { Person person = new Person(); person.setId(3); person.setFirstName("Orihime"); person.setLastName("Inoue"); person.setAdresse("Karakura Town"); person.setJoinedDate(new Date()); person.setDescription("She has a unique power."); SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(person); session.getTransaction().commit(); } } As you can see in the hbm2dll.auto property I used the value update which will create the table if…
favorite count: 0
tagged with: postgresql
has title: create a table if not exits in Hibernate
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/36785774
comment on: http://stackoverflow.com/a/23892564
type: Comment
score: 0
type: AnswerComment
has text: Then you need a reference to an Activity class that has the getApplication() method. So pass it in the constructor. Just as degand59 suggested.

http://stackoverflow.com/q/23877735
has comment: http://stackoverflow.com/comment/36756645
has answer: http://stackoverflow.com/a/34553638
tagged with: windows
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23877858
has comment: http://stackoverflow.com/comment/36756514
possible better answer: http://stackoverflow.com/a/28316153
has comment: http://stackoverflow.com/comment/36756462
has answer: http://stackoverflow.com/a/38670154
score: 6
has answer: http://stackoverflow.com/a/38911297
has comment: http://stackoverflow.com/comment/36756408
upvote count: 6
has answer: http://stackoverflow.com/a/23877858
type: AnsweredQuestion
tagged with: java
has title: Cannot use Java 7 installation if Java 8 is installed
type: Question
has answer: http://stackoverflow.com/a/28316153
has answer: http://stackoverflow.com/a/23877861
answer count: 6
has body: I normally still use Java 7 for all my coding projects (it's a company "politics" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it seems I cannot have Java 8 installed in Windows 7 x64, and still use Java 7 by default: C:\&gt;"%JAVA_HOME%\bin\java.exe" -version java version "1.7.0_55" Java(TM) SE Runtime Environment (build 1.7.0_55-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode) C:\&gt;java.exe -version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) As you can see, JAVA_HOME is completely ignored. I also have Java in the path, using "%JAVA_HOME%\bin", which resolve correctly to Java 7 when I check the path in a DOS box, but it still makes no difference. I checked in the "Java Control Panel" (not sure if this affects the default command-line Java version). Under the "Java" tab, the "View..." button, you get to see "registered" Java versions. I can add all the versions under the "User" tab, but under "System" there is only Java 8, and no way to change it. Am I missing something, or did Oracle just make it impossible to use Java 7, unless I de-install Java 8? I don't want to have to specify the "source" and "target" everywhere, and I don't even know if it is possible for me to specify it everywhere, where Java is used. EDIT: What I did is I de-installed all Java. Then installed the latest Java7 (both 86 and x64), and then the latest Java8 (both 86 and x64). After I did that, I noticed that the x64 JDK was gone. It seems Java8 killed it. So I re-installed the JDK 7 x64, after the JDK 8 x64. Still, JDK7 x64 did not seem to "replace" the "java.exe" which is copied into the "Windows" directory itself (I assume THAT is the problem).

http://stackoverflow.com/q/23864284
type: Question
has comment: http://stackoverflow.com/comment/36731426
has title: Exception in thread "main" org.hibernate.LazyInitializationException: could not initialize proxy - no Session
has body: I am trying to print details from database. Here I am fetching data from multiple tables and printing it on at BillNewActions main method for last line it is showing Exception org.hibernate.LazyInitializationException: could not initialize proxy - no Session to resolve this I set lazy=false at in BillProductDetails.hbm.xml but this is not resolving this problem. What change should I make to run it properly. public Map fetchAll(int start, int pageSize) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List<BillDetails> obj = null; long count = 0; try { count = (Long) session.createQuery("select count(*) from BillDetails").uniqueResult(); String hql = "from BillDetails as bd " + "left join fetch bd.customerDetails as cd " + "left join fetch bd.billProductDetailses as bpd " + "left join fetch bpd.productDetails"; Query query = session.createQuery(hql).setFirstResult(start).setMaxResults(pageSize); obj = query.list(); tx.commit(); } catch (HibernateException e) { if (tx != null) { e.printStackTrace(); tx.rollback(); } } finally { session.close(); } Map data = new HashMap(); data.put("list", obj); data.put("count", count); return data; } Printing the details public class BillNewAction{ public static void main(String[] s) { BillDAO dao = new BillDAO(); Map m = dao.fetchAll(0, 10); List<BillDetails> billList = (List<BillDetails>) m.get("list"); for (BillDetails d : billList) { System.out.println("bill no "+d.getBillNo() + " paymentType " + d.getPaymentType()); System.out.println("name "+d.getCustomerDetails().getName() + " address " + d.getCustomerDetails().getAddress() + " dob " + d.getCustomerDetails().getDob() + " anni " + d.getCustomerDetails().getAnniversery()); List<BillProductDetails> bpd = d.getBillProductDetailses(); System.out.println("bpd size is " + bpd.size()); for (BillProductDetails cd : bpd) { System.out.println("qty "+cd.getQty() + " sp " + cd.getSellingPrice() + " up " + cd.getUnitPrice());//…
score: 0
has comment: http://stackoverflow.com/comment/36731829
has comment: http://stackoverflow.com/comment/36731945
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36731801
has comment: http://stackoverflow.com/comment/36731519
answer count: 0
has comment: http://stackoverflow.com/comment/36732159
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23787170
type: Question
upvote count: 1
duplicate of: http://stackoverflow.com/q/7911776
has comment: http://stackoverflow.com/comment/36583947
tagged with: java
has comment: http://stackoverflow.com/comment/36583975
downvote count: 3
has answer: http://stackoverflow.com/a/23787693
has title: how i = i++ is returning 10 and when doing k = i++ the value of i returns 11 where i=10 and k=0?
has body: I want to know that when i=10 and k=0 then and when i am trying to print the value of i when i am doing like this : case 1 : i = i++; It's printing i=10 where case 2 : k = i++; It's printing i = 11; I want to know how exactly doing this operation? because in both cases i++ is doing and after then i am printing the value of i? if in the second case i am getting i=11; then i should get 11 in case 1 also. Please someone explain me the process? The Code is like this : public class Case1{ public static void main(String[] a){ int i = 10; i = i++; System.out.println(i); } } It's giving ans : 10; and public class Case1{ public static void main(String[] a){ int i = 10; int k = 0; k = i++; System.out.println(i); } } Here the ans is coming as 11. Now please explain me both the cases like how it's doing in the first program i = 10 and in second program 11 as ans.
answer count: 4
has answer: http://stackoverflow.com/a/23787273
has answer: http://stackoverflow.com/a/23787281
has answer: http://stackoverflow.com/a/23788005
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36592710
linked to: http://stackoverflow.com/q/5413548
has comment: http://stackoverflow.com/comment/36583930
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/36583961
linked to: http://stackoverflow.com/q/7911776
has comment: http://stackoverflow.com/comment/36583934

http://stackoverflow.com/q/23789206
has answer: http://stackoverflow.com/a/23789618
accepted answer: http://stackoverflow.com/a/23789618
has answer: http://stackoverflow.com/a/23789308
has body: I have one activity with one view. The purpose of this view is to show a squared grid. The square sides will equal to the screen width divided by the number of squares that exist horizontally. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getValues(); createLayout(); } public static int top; public static int side; private void getValues() { top = 5; //squares horizontally side = 6; //squares vertically } private void createLayout() { BoardView bv = new BoardView(this); bv.setBackgroundColor(Color.BLUE); setContentView(bv); bv.createGuideLines(); } I already struggled to create a view with custom height, I did this: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); squareSide = MeasureSpec.getSize(widthMeasureSpec)/top; setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),squareSide*side); } public void createGuideLines() { for(int c = 1; c&lt;=side; ++c) { path.moveTo(c*squareSide, 0); path.lineTo(c*squareSide, squareSide*top); } for(int l = 1; l&lt;=side; ++l) { path.moveTo(0, l*squareSide); path.lineTo(side*squareSide, l*squareSide); } invalidate(); } The problem is, when I debug, squareSide variable has value 0. I tought that maybe onMeasure() is being called after createGuideLines(). If I called it before, would it solve my problem? I read on the documentation that there is a method requestLayout() that calls onMeasure() method, but I have no clue on how to implement it. Thanks for your time.
has title: How can I invoke onMeasure method? - Android
score: 0
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/23789254
tagged with: onmeasure
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23789254
type: Question

http://stackoverflow.com/comment/36789469
type: Comment
comment on: http://stackoverflow.com/q/23892962
type: QuestionComment
has text: @LuiggiMendoza - Then you do whatever you need to do. But don't try to justify it by claiming it's a "pattern" -- admit that it's a kluge and get on with life. (And note that if you cannot modify the code then you can't implement most of the other schemes -- clone, deserialize, etc -- either, unless the existing code accidentally supports them.)
score: 0

http://stackoverflow.com/a/23911243
has comment: http://stackoverflow.com/comment/36860402
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36859425
has comment: http://stackoverflow.com/comment/36860337
has comment: http://stackoverflow.com/comment/36866155
has comment: http://stackoverflow.com/comment/36839583
has body: A plain Junit test (without the spring runner) will ensure the class is not configured. you can then use mock objects (see Mockito) to satisfy any dependencies.
answers question: http://stackoverflow.com/q/23911180
upvote count: 1
has comment: http://stackoverflow.com/comment/36857433
type: Answer

http://stackoverflow.com/comment/36827648
type: Comment
comment on: http://stackoverflow.com/a/23911735
score: 0
type: AnswerComment
has text: @user3683532 That wouldn't be a good practice for most "hand-coded" classes, because a lot of efficiency, both in terms of the memory use and the CPU, would be lost. You could go with something like that for "cookie-cutter" classes, though, such as data transfer and data access object covers for rows in a database.

http://stackoverflow.com/comment/36673754
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23834496

http://stackoverflow.com/comment/36609141
score: 0
comment on: http://stackoverflow.com/a/23799813
type: Comment
type: AnswerComment
has text: which version of the jdk should we download. when i ran the above command <servpro41:~ administrator$ javac -version No Java runtime present, requesting install. > and when we ran "which java" we get <servpro41:~ administrator$ which java /usr/bin/java>.

http://stackoverflow.com/q/23849497
accepted answer: http://stackoverflow.com/a/23849510
has answer: http://stackoverflow.com/a/23849709
has title: Externally visible but not modifiable, but internally modifiable?
answer count: 2
downvote count: 0
tagged with: variables
possible better answer: http://stackoverflow.com/a/23849709
linked to: http://stackoverflow.com/q/5770852
favorite count: 0
has answer: http://stackoverflow.com/a/23849510
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36703326
upvote count: 1
tagged with: global-variables
type: Question
linked to: http://stackoverflow.com/q/376427
has comment: http://stackoverflow.com/comment/36702811
has body: Before I get on with the question, in all my searches I cannot seem to find this, so I am sorry if it is a dupe. Now to the question: Is there a modifier to make a variable visible but not modifiable outside of it's class without changing it's modifiable inside it's class? So basically to other classes it would be a public final but to the class it resides in it's just public. I found this and this, but neither one quite answers my question. Again, sorry if this is a duplicate question and thanks ahead of time.

http://stackoverflow.com/comment/36666638
has text: Oh I thought that it should be able to import sub-packages and that my IDE was acting up. Anyway thank you I will do it this way.
comment on: http://stackoverflow.com/a/23830591
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36780277
has text: Ok.Added that too.Thanks.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23889832
type: Comment

http://stackoverflow.com/comment/37053862
comment on: http://stackoverflow.com/q/23934953
has text: Patching a web application is not a great practice as it is rarely repeatable. You're better off building and shipping an entire new WAR file with a new version.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23934205
has comment: http://stackoverflow.com/comment/36863376
accepted answer of: http://stackoverflow.com/q/23934069
upvote count: 3
answers question: http://stackoverflow.com/q/23934069
score: 3
type: AcceptedAnswer
downvote count: 0
has body: .* is greedy so it will try to find maximal possible match meaning that (.*) will match abc(foo)def(bar)ghi ^^^^^^^^^^^ If you want to make it find minimal possible match abc(foo)def(bar)ghi ^^^ ^^^ make * reluctant by adding ? after it String regex = "new SingleSizeProduct((.*?))"; Also you need to escape ( and ) because as you know they represent start-end of capturing groups. String regex = "new SingleSizeProduct\\((.*?)\\)"; BTW. Another solution would be using instead of .*? [^)]* which means, everything except ) String regex = "new SingleSizeProduct(([^)]*))";
type: Answer

http://stackoverflow.com/a/23931602
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23925988
score: 3
answers question: http://stackoverflow.com/q/23925988
has body: You should use a DataNode for adding scripts or styles. script.after(new DataNode("&lt;script&gt;" + old_configString + "&lt;/script&gt;", "http://domain.tld/path"));
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/q/23900336
score: 3
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
has title: JavaFX ComboBox: difference between methods of adding listeners/event handlers
has body: I am using the ComboBox and ChoiceBox controls, and have been trying to figure out the difference between the methods of executing an action when an item is selected. What is the difference between the following? ComboBox&lt;String&gt; comboBox = new ComboBox( FXCollections.observableArrayList( "Hi", "Hello", "Test"); comboBox.getSelectionModel().selectedItemProperty().addListener( (observable, oldValue, newValue) -&gt; System.out.println(newValue)); comboBox.valueProperty().addListener( (observable, oldValue, newValue) -&gt; System.out.println(newValue)); comboBox.setOnAction( event -&gt; System.out.println(comboBox.getValue())); A ChoiceBox doesn't have the onAction property, but it does have the others, both which appear to do the same thing. Which is recommended and what is the difference? I would also like to know whether it is better to set the StringConverter or the CellFactory for a ComboBox; a ChoiceBox necessitates the usage of StringConverter, but I've been using the setCellFactory(Callback&lt;ListView&lt;T&gt;, ListCell&lt;T&gt;&gt;) method for my ComboBoxes (it's necessary for at least one, since the internal labels have ImageViews set as the graphic). One last thing – I have a number of 'refresh' methods in my application which are run on the execution of an action (for instance, the selection of an item from the ComboBox or ChoiceBox). Would it be better to use binding instead? I'm not quite sure if this is possible, since my code isn't using wrapped values (properties/ObservableValue). I've tried searching for the answers to these questions, but I haven't quite found it yet.
upvote count: 3
tagged with: javafx-8
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23912720
type: UnansweredQuestion
tagged with: combobox

http://stackoverflow.com/q/23841064
has comment: http://stackoverflow.com/comment/36686896
tagged with: user-interface
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/6476289
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36686921
tagged with: swing
has title: Removing all components of JPanel
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/6476289
type: Question
upvote count: 0
has body: I've done a lot of research and tried a lot of things but my aim is to do this: I have three buttons at the moment. For button 1 - the Play button, I want to click it and the result is to remove ALL buttons on the screen. Here is my code at the moment public class Menu extends JFrame implements ActionListener { //Variables here public void createUI() { frame = new JFrame(); frame.setTitle("Maze Game"); frame.setSize(500, 500); frame.setVisible(true); panel.setLayout(new GridLayout(3, 1, 0, 19)); panel.setVisible(true); JButton b = new JButton("Play"); b.setSize(20, 10); b.setBackground(new Color(59, 89, 182)); b.setForeground(Color.WHITE); b.setFocusPainted(false); b.setFont(new Font("Tahoma", Font.BOLD, 12)); panel.add(b); JButton b0 = new JButton("Help"); b0.setBackground(new Color(59, 89, 182)); b0.setForeground(Color.WHITE); b0.setFocusPainted(false); b0.setFont(new Font("Tahoma", Font.BOLD, 12)); b0.addActionListener(this); panel.add(b0); JButton b1 = new JButton("Quit"); b1.setBackground(new Color(59, 89, 182)); b1.setForeground(Color.WHITE); b1.setFocusPainted(false); b1.setFont(new Font("Tahoma", Font.BOLD, 12)); b1.addActionListener(this); panel.add(b1); frame.getContentPane().add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } Now my problem is this: public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Quit")) { frame.dispose(); } else if (e.getActionCommand().equals("Help")) { JFrame j1 = new JFrame(); j1.setSize(200, 200); j1.setVisible(true); } else if (e.getActionCommand().equals("Play")) { //panel.removeAll(); //revalidate(); //repaint(); //frame.getContentPane().remove(panel); } } I want it so when I click the "Play" button it removes the button as well as the Help button and Quit button. I've tried the commented bits of code but with no success. Hopefully I've made things clear. To reiterate, I want to remove all the buttons (basically a blank window) after I click play.
score: -1
has comment: http://stackoverflow.com/comment/36686848
has answer: http://stackoverflow.com/a/23841121

http://stackoverflow.com/a/23862635
has comment: http://stackoverflow.com/comment/36729161
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36728729
upvote count: 1
has comment: http://stackoverflow.com/comment/36728684
has comment: http://stackoverflow.com/comment/36760585
answers question: http://stackoverflow.com/q/23862344
has body: Based on your layout.. you are using almost same layout that Android provided as a default, however the android:id is critical in placing the text from array to the view. so to fast fix this, I would use Android layout directly and remove your custom layout. to use the default layout change the setting adapter line to the following: ArrayAdapter&lt;String&gt; myAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.simple_list_item_1, club_names); android.R.simple_list_item_1 this is the path to the default layout. if you still want to use your layout, then you need to change the android:id to android:id="@android:id/text1" hope this works for you.
type: Answer

http://stackoverflow.com/comment/36807364
type: Comment
type: QuestionComment
has text: what relationship between `Question` & `Parent`, and uni or bidirectional? Can you show us entity class details for that classes? I think `ParentQuestion` entity may not be required.
comment on: http://stackoverflow.com/q/23904030
score: 0

http://stackoverflow.com/comment/37084275
has text: Thanks for your reply, I am tempted. I have tried the procedure given in the comment above but unfortunately it isn't working. All I need is the classes, so do you know any other source from where I could download the jar file or its corresponding classes.
type: Comment
comment on: http://stackoverflow.com/a/23978154
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36826335
type: Comment
has text: Are you sure there isn't a leading space or some other character in the String you are attempting to parse. I wrote up a quick sample using the same DateFormat as you and it worked without issue
comment on: http://stackoverflow.com/q/23914287
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36666269
score: 0
comment on: http://stackoverflow.com/q/23830657
type: Comment
type: QuestionComment
has text: Whatever it is, it is the line 50 on your Record.java class.

http://stackoverflow.com/comment/36823918
score: 0
type: AnswerComment
has text: it always return true that might be because they are equal and We just can hope that he overrided the equals method. And yes he equals always boolean so he should not test with true
comment on: http://stackoverflow.com/a/23913038
type: Comment

http://stackoverflow.com/comment/36632769
comment on: http://stackoverflow.com/a/23813026
score: 0
type: AnswerComment
type: Comment
has text: Of course, but is there a utility that could do this for me in `Guava` or `Apache Commons`?

http://stackoverflow.com/q/23833561
has answer: http://stackoverflow.com/a/23835458
score: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23833724
has title: Can you perform an equals comparison on most but not all class members with GSON's JsonElement
upvote count: 2
has body: I am writing an unit test with JUnit and I'm wondering if there is a way to perform an assertEquals comparison on it. I have two JsonElement classes that I would like to compare but I would like to ignore a field in an array property inside the JSON. My JSON looks like this: { "name":"Jon", "arrayProps":[ { "careAbout":"123", "doNotCareAbout":"blablabla" }, { "careAbout":"456", "doNotCareAbout":"blablabla" }, { "careAbout":"789", "doNotCareAbout":"blablabla" } ] } I want to compare all fields apart from the doNotCareAbout elements. Is this possible with GSON when I call: JsonElement element1 = ...; JsonElement element2 = ...; assertEquals(element1, element2); If it is not, can anybody recommend a suitable library where I can do this type of comparison where I would like exclude some elements?
linked to: http://stackoverflow.com/q/27329227
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/36595271
type: Comment
type: QuestionComment
score: 0
has text: getTaxi?id=2 return {"taxi_city_id":[55000001,67000001],"taxi_id":1113,"taxi_name":"zxcv","taxi_phone":"+73812999997"}
comment on: http://stackoverflow.com/q/23792928

capturing-group
tags question: http://stackoverflow.com/q/23919042
type: Tag
tag name: capturing-group

http://stackoverflow.com/q/23895908
has title: env.getProperty not working Spring PropertyPlaceholderConfigurer
score: 8
has answer: http://stackoverflow.com/a/23895972
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23895972
tagged with: spring-4
downvote count: 0
linked to: http://stackoverflow.com/q/11415711
upvote count: 8
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/23900931
answer count: 2
favorite count: 0
has body: I am loading properties file using spring <property name="locations" value="classpath:/sample.properties" /> <property name="ignoreUnresolvablePlaceholders" value="true"/> when i am getting property value using @Value("${testkey}") its working fine. but when i am trying to get using env @Resource private Environment environment; environment.getProperty("testkey") // returning null
tagged with: spring
has answer: http://stackoverflow.com/a/23900931

http://stackoverflow.com/comment/36680685
type: QuestionComment
type: Comment
has text: Does `doNothing().when(mock).myFunction(anyString())` work for you?
score: 4
comment on: http://stackoverflow.com/q/23838023

http://stackoverflow.com/q/23874795
has comment: http://stackoverflow.com/comment/36752293
tagged with: java
tagged with: javafx
has body: i'm trying put a TableView in a Pagination, i was adapt a sample of this for FXML and an hour it's ok, working but now show this Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = TableRow@4a034b[styleClass=cell indexed-cell table-row-cell]'null' at javafx.scene.Parent$2.onProposedChange(Parent.java:458) at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:115) at com.sun.javafx.scene.control.skin.TableRowSkinBase.updateCells(TableRowSkinBase.java:507) at com.sun.javafx.scene.control.skin.TableRowSkinBase.checkState(TableRowSkinBase.java:593) at com.sun.javafx.scene.control.skin.TableRowSkinBase.computePrefHeight(TableRowSkinBase.java:528) at javafx.scene.control.Control.computePrefHeight(Control.java:543) at javafx.scene.Parent.prefHeight(Parent.java:924) at javafx.scene.layout.Region.prefHeight(Region.java:1438) at com.sun.javafx.scene.control.skin.VirtualFlow.resizeCellSize(VirtualFlow.java:1782) at com.sun.javafx.scene.control.skin.VirtualFlow.addLeadingCells(VirtualFlow.java:1146) at com.sun.javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1099) at javafx.scene.Parent.layout(Parent.java:1076) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Scene.doLayoutPass(Scene.java:576) at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2386) at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:321) at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:319) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:319) at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:348) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:479) at com.sun.javafx.tk.quantum.QuantumToolki…
type: Question
has answer: http://stackoverflow.com/a/50303331
has title: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = TableRow@adc848
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36752281
has comment: http://stackoverflow.com/comment/36750648
type: UnansweredQuestion

http://stackoverflow.com/comment/36582305
comment on: http://stackoverflow.com/q/23783716
score: 0
type: Comment
type: QuestionComment
has text: When you say the name is "wrong", how exactly are you verifying this? Which tool are you using to inspect the ZIP file, and are you sure that that tool is using the same encoding to interpret the file names as you used when you created them?

http://stackoverflow.com/a/23945008
has comment: http://stackoverflow.com/comment/36974970
has comment: http://stackoverflow.com/comment/36965085
type: Answer
has comment: http://stackoverflow.com/comment/36993677
has comment: http://stackoverflow.com/comment/36917338
accepted answer of: http://stackoverflow.com/q/23902577
has body: Sorry guys, I wasn't completely honest with you. Of course my system is much more complex. It's like my ClockWidget class has another method that is being called in the constructor. I didn't know that this could cause the issue. Here is how the full ClockWidget.class would look like: public class ClockWidget extends Widget implements TimeoutListener, DummyInterface { private ArrayList&lt;ActivityListeners&gt; activityListeners; public ClockWidget() { super(); System.out.println("ClockWidget constructor."); lookupActivityListeners(); } @Override public String getWidgetName() { return "Clock widget"; } @Override public void onTimeout() { System.out.println("Timeout!"); } @Override public void dummyMethod() { // Does nothing. } private void lookupActivityListeners() { activityListeners = new ArrayList&lt;&gt;(); try { BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); Collection&lt;ServiceReference&lt;ActivityListener&gt;&gt; serviceReferences = context.getServiceReferences(ActivityListener.class, null); for (ServiceReference&lt;ActivityListener&gt; serviceReference : serviceReferences) { ActivityListener activityListener = (ActivityListener) context.getService(serviceReference); if (activityListener != null) { activityListeners.add(activityListener); } } } catch (Exception e) { e.printStackTrace(); } } } As you can see, the method lookupActivityListeners searches for all ActivityListeners installed in OSGi and adds them in an array list. I've commented the line ActivityListener activityListener = (ActivityListener) context.getService(serviceReference); and the constructor was called once. So I had to change the lookupActivityListeners(); calling to another place instead of the constructor. Now everything is fine. However, I still don't know why that would be the source of the problem. Thanks for the answers anyway.
answers question: http://stackoverflow.com/q/23902577
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36755679
comment on: http://stackoverflow.com/q/23877401
type: QuestionComment
type: Comment
has text: Pass a reference of the outer class to the inner class. Don't create a static inner class
score: 1

http://stackoverflow.com/a/23878104
has body: you can use fromHtml method Like this : String styledText = "This is simple."; textView.setText(Html.fromHtml(styledText));
answers question: http://stackoverflow.com/q/23877719
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23877719
type: Answer
upvote count: 7

http://stackoverflow.com/comment/40656884
has text: Also, if I have a `@UiField Element foo`, and in my UiBinder class I do ``, that gives me an error in intellij that `expected: Element, found: java.lang.Object` (paraphrased).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25942154
score: 0

http://stackoverflow.com/a/23859451
answers question: http://stackoverflow.com/q/23859413
score: 1
upvote count: 1
downvote count: 0
has body: If the player has an action to do next, the simpler way is to deactivate the button when is pressed first time and after in the next action activated again. You can do this adding background.setEnabled(false); in your anonymous class listener and after add background.setEnabled(true); in player's next action.
type: Answer

http://stackoverflow.com/q/23863527
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36729777
has answer: http://stackoverflow.com/a/23863584
tagged with: keyword
has answer: http://stackoverflow.com/a/23864063
has title: InstanceOf keyword doesn't working in java applet
has comment: http://stackoverflow.com/comment/36729840
has body: can someone please tell mo why this code generating false rather then to generate true.... Is there any fault in the code.. I am trying to use instanceof keyword?? import java.awt.*; import java.applet.*; import java.awt.event.*; public class CheckInstanceOf extends java.applet.Applet { TextField print; public void init() { print=new TextField(check_forInstance()); add(print); } public String check_forInstance() { if(print instanceof TextField) { return "true"; } else { return "false"; } } }
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23863590
has comment: http://stackoverflow.com/comment/36729923
tagged with: applet
has answer: http://stackoverflow.com/a/23863582
score: 0
has comment: http://stackoverflow.com/comment/36730143
has comment: http://stackoverflow.com/comment/36730377
answer count: 4
tagged with: instanceof
has comment: http://stackoverflow.com/comment/36729812

http://stackoverflow.com/comment/36574611
score: 0
type: Comment
type: QuestionComment
has text: I think you misunderstood. In `JSF` forms each fields has its own validator method . Did you aware of that one?
comment on: http://stackoverflow.com/q/23780474

http://stackoverflow.com/comment/36820322
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23902552
has text: OP is talking about Android-class, not Java-`SimpleDateFormat`.
score: 0

http://stackoverflow.com/a/23842299
has body: try this playersInArenas.values().retainAll(Collections.singleton(5)); Set&lt;String&gt; strings = playersInArenas.keySet();
upvote count: 1
has comment: http://stackoverflow.com/comment/36692643
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23842241
score: 1

http://stackoverflow.com/comment/71300399
score: 0
comment on: http://stackoverflow.com/q/23928758
type: Comment
type: QuestionComment
has text: @user3686724, I've got similar issue. Have you solved one? Can you share your solution, please?

http://stackoverflow.com/a/23866876
downvote count: 0
has comment: http://stackoverflow.com/comment/36737543
answers question: http://stackoverflow.com/q/23866452
type: Answer
has comment: http://stackoverflow.com/comment/36962023
has body: CronTrigger cronTrigger = newTrigger() .withIdentity("trigger1", "testJob") .startAt(startDate) .withSchedule( CronScheduleBuilder.cronSchedule(" * * * */2 * ?") .withMisfireHandlingInstructionDoNothing() ).build(); So you need to replace 1/2 with */2. Here * means each day and */2 mean every second day. UPDATE CronTrigger can not be use to run every 2 days interval as it will always start at 1st day of every month even though last jab execution was on 31, it will run at 1st day of month instead if 2nd day of month. You can set it in to run after 48 hours in place of every 2 days. Please look if this will help you: trigger = newTrigger() .withIdentity("trigger3", "group1") .startAt(tomorrowAt(15, 0, 0) // first fire time 15:00:00 tomorrow .withSchedule( simpleSchedule() .withIntervalInHours(2 * 24) // interval is actually set at 48 hours' worth of milliseconds .repeatForever() ).build(); for more information please refer This link
has comment: http://stackoverflow.com/comment/36736356
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23866452
has comment: http://stackoverflow.com/comment/36736295
type: AcceptedAnswer

http://stackoverflow.com/comment/36760068
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23879414
has text: @Paul Hicks Yes the compiling error has been fixed! but now I am having problem with execution. I have mentioned it in EDIT!

http://stackoverflow.com/comment/36740472
score: 1
has text: How much RAM space you have?
comment on: http://stackoverflow.com/q/23869475
type: Comment
type: QuestionComment

android-activity
tags question: http://stackoverflow.com/q/23834220
tags question: http://stackoverflow.com/q/23790770
tag name: android-activity
tags question: http://stackoverflow.com/q/23856388
tags question: http://stackoverflow.com/q/23790278
tags question: http://stackoverflow.com/q/23856931
tags question: http://stackoverflow.com/q/23859666
tags question: http://stackoverflow.com/q/23856841
tags question: http://stackoverflow.com/q/23846498
tags question: http://stackoverflow.com/q/23851962
tags question: http://stackoverflow.com/q/23853585
type: Tag

http://stackoverflow.com/comment/36970065
has text: And were you able to see an object returned from `sheet.getRow(r)` in that case? (Sorry, this is really hard to do, without being in the same room as your computer).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23924963

http://stackoverflow.com/a/23929654
has comment: http://stackoverflow.com/comment/36854914
has body: As per you comments I think it is an issue with the memory management. I found this link very helpful. You can follow the same wherever it is applicable to make your program block memory. After optimizing aslo if you get the same error message, you can go through this link to learn how to increase the heap size.
answers question: http://stackoverflow.com/q/23929388
has comment: http://stackoverflow.com/comment/36855168
type: Answer
has comment: http://stackoverflow.com/comment/36855034
score: 0

http://stackoverflow.com/q/23905826
answer count: 1
tagged with: wsdl
has title: Not able to invoke werservice from client
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23906492
tagged with: web-services
has body: I am new to webservices and have developed a very basic webservice for the class as below : @WebService public class Hello { public String helloName(String Name){ return "hello there " + Name; } } The webservice is deployed and I can access the wsdl file on browser. But when I invoke the service through a client, it gives an error as java.net.UnknownHostException I observed in the wsdl file is that the soap:address tag still shows address location localhost:8080 even after the service is deployed on the server. Not very sure if this can be a source of error. &lt;wsdl:service name="HelloService"&gt; &lt;wsdl:port name="HelloPort" binding="tns:HelloServiceSoapBinding"&gt; &lt;soap:address location="http://localhost:8080/HAYServer/Hello"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt;
type: Question
score: 0

http://stackoverflow.com/comment/36830336
type: AnswerComment
score: 0
type: Comment
has text: So that while inside my for (int i=0) etc?
comment on: http://stackoverflow.com/a/23916079

http://stackoverflow.com/a/23827225
has body: As you've not put your JAVA file and unable to post logcat, I'm showing the similar APP I've developed couple of weeks back with the same/similar concept. Please read through.. Simple_Maths Activity public class Simple_Maths extends Activity { TextView tv_Output; Button Addition, Subtract, ClearTot; int counter = 0; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView (R.layout.maths_activity); tv_Output = (TextView) findViewById(R.id.tv_Display); Addition = (Button) findViewById(R.id.btn_Add); Subtract = (Button) findViewById(R.id.btn_Sub); ClearTot = (Button) findViewById(R.id.btn_Clear); Addition.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; tv_Output.setText("Your Total is : " + counter); } }); Subtract.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter--; if (counter &lt; 0) { counter = 0; } tv_Output.setText("Your Total is : " + counter); } }); ClearTot.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter = 0; tv_Output.setText("Your Total is cleared"); } }); } } maths_activity.xml file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/LightOrange" android:orientation="vertical" android:padding="10dp" &gt; &lt;TextView android:id="@+id/tv_Display" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:background="@color/Variety" android:gravity="center" android:hint="@string/tv_Display" android:textSize="35sp" /&gt; &lt;LinearLayout android:layout_width=…
answers question: http://stackoverflow.com/q/23826874
score: 0
type: Answer

http://stackoverflow.com/a/23850920
has body: You need to add a foreign key column in History entity/table to create the relationship between the two tables as below. @Entity public class History implements Serializable { @Id @GeneratedValue private long id; @Column(name="WINE_ID", updateable=false, insertable=false) private long wineId; @Column private int oldAmount; @Column private int newAmount; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name="WINE_ID", referencedColumnName="ID") private Wine wine; //getters &amp; setters }
type: Answer
has comment: http://stackoverflow.com/comment/36712801
upvote count: 1
has comment: http://stackoverflow.com/comment/36711962
has comment: http://stackoverflow.com/comment/36712169
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23850872

http://stackoverflow.com/comment/36754010
has text: @Calaquessir: That sounds like a separate question, so please ask it separately (making sure to provide enough information to make it answerable).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23876465

http://stackoverflow.com/comment/36639395
type: Comment
comment on: http://stackoverflow.com/a/23797943
has text: I'd separate most of it, the specific editor and render could be inner classes. The DefaultLookup call is fine, it should compile, it's just warning you. I stole it from the DefaultListCellRenderer
score: 1
type: AnswerComment

http://stackoverflow.com/q/23858164
answer count: 1
has answer: http://stackoverflow.com/a/23903153
tagged with: java
has title: Eclipse plugin: How to secure sensitive data?
has body: I'm currently building an Eclipse plugin which creates and stores sensitive data, let's say "highscores". As users can simply unpack the jar file, they are able to see the source code of the project. Thus they are able to cheat and create a faked highscore file by either changing the data in the file itself or writing to the highscore file (as they know how the data is encrypted from the source code). Can I encrypt my jar file so that users cannot read the source code, but the plugin is still working properly?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36731191
tagged with: sensitive-data
has comment: http://stackoverflow.com/comment/36719909
type: UnansweredQuestion
tagged with: security
type: Question
has comment: http://stackoverflow.com/comment/36722893
score: 0
tagged with: plugins

http://stackoverflow.com/a/24266355
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: The problem turned out to be quite trival. The app was doing a lot of forward/dispatches as a part of somehwat normal request handling. It turned out that the my filter was called (so far, so good) then another filter down the chain was doing forward/dispatch which then did actual request processing. Default filter setup catches only plain requests and you need additional configuration (web.xml) to also filter forwards/dispatches. I just did that and that solved the problem.
accepted answer of: http://stackoverflow.com/q/23917048
answers question: http://stackoverflow.com/q/23917048
upvote count: 1

http://stackoverflow.com/comment/36851279
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23926864
has text: yes you are correct in crux what you mentioned was my problem thanks
type: AnswerComment

http://stackoverflow.com/comment/36588350
type: Comment
comment on: http://stackoverflow.com/a/23789307
has text: so in my case it would be: `panel.add(SubnetPanel);` ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36793310
type: Comment
has text: you shouldnt use a absolut path anyway since it will start looking on linux in / and on windows in C:\ depending on which disk drive you are starting it.
comment on: http://stackoverflow.com/a/23896875
type: AnswerComment
score: 0

http://stackoverflow.com/q/23824123
has title: Android onScroll event giving bad values
has body: I'm trying to implement a custom 2-way scroll with the Android canvas and a GuestureDetector.SimpleOnGestureListener but I'm having some issues. It seems like the first scroll event with it always gives a huge inaccurate jump. For example, if I click in the middle of the canvas and scroll a tiny bit, I will see scroll events like this (rounded slightly): scroll x: -352 scroll y: -373 scroll x: -4 scroll y: 3 scroll x -4 scroll y: 3 The first value of the scroll is always a huge jump that I'm not remotely performing with my finger I'm scrolling with. It seems like it's treating my first scroll motion as if I moved my finger from a corner of the canvas to the place the finger actually is? Here's my actual listener: public class BoardScrollListener extends GestureDetector.SimpleOnGestureListener { private GameService gameService = GameService.getInstance(); private UiService uiService = UiService.getInstance(); @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { Log.d("scroll", "scroll x: " + distanceX + " scroll y: " + distanceY); if (distanceX &gt; -150 &amp;&amp; distanceY &gt; -150) { Game game = gameService.getGame(); game.setxPixelOffset((int) (game.getxPixelOffset() - distanceX)); game.setyPixelOffset((int) (game.getyPixelOffset() - distanceY)); uiService.getGameboardActivity().getGameboard().invalidate(); } return true; } @Override public boolean onDown(MotionEvent e) { return true; } } I tried wrapping it in that if check to see what happened, and that actually fixes the problem most of the time, but it obviously isn't a real solution. Can anyone tell me why the motion event is inaccurate, and a good way to make it accurate or ignore the first motion event of a scroll? I'm using the v4 support activity fragments, so I also tried switching to GestureDetectorCompat, but that doesn't change anything. (This is on a KitKat device.)
downvote count: 0
tagged with: android-canvas
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/42443396
has comment: http://stackoverflow.com/comment/61780900
answer count: 4
upvote count: 3
has answer: http://stackoverflow.com/a/28401654
has answer: http://stackoverflow.com/a/23833009
type: Question
linked to: http://stackoverflow.com/q/12465540
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/23824272

http://stackoverflow.com/comment/36838070
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23905436
has text: `libstreaming` examples work, but none involves WifiDirect.
score: 0

http://stackoverflow.com/q/23789739
answer count: 0
type: UnansweredQuestion
score: 2
tagged with: apache-poi
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: ms-word
has body: I'm writing an application that takes a .docx file with a bunch of empty paragraphs and tables and fills them programmatically using Apache POI with data from a db. The .docx model I've been provided with also has a serie of pictures in it: my problem is I'd like to remove the ones I don't need (again, programmatically). I see there is a method for adding pictures to a XWPFRun (addPicture()) but not one for removing them. Can this be done? How do you remove a picture from a .docx file with POI? Thanks in advance!!
has title: Apache poi: remove Picture in XWPFDocument
favorite count: 0

http://stackoverflow.com/q/23793485
has title: How to design an Auto-Nested Fragment Class
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I'm trying to do something like this: public class MyFancyFragment&lt;T&gt; extends Fragment { ... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ... getChildFragmentManager().beginTransaction() .add(R.id.fancy_fragment_layout_id, new T(), "whatever") .commit(); ... } ... } And later specify to the MyFancyFragment class which inner Fragment it's supposed to be using via, e.g. ...new MyFancyFragment&lt;FancyInnerFragmentType&gt;()... But of course Java won't let me create a new T because that's not how generics work. There's a reason I'm trying to do it that way. If you do it the way you'd normally be tempted, i.e.: public class MyFancyFragment&lt;T&gt; extends Fragment { ... Fragment toShow; public void setFragment(Fragment toShow) { this.toShow = toShow; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ... getChildFragmentManager().beginTransaction() .add(R.id.fancy_fragment_layout_id, toShow, "whatever") .commit(); ... } ... } You'll be fine at first, but the issue comes down to the Android Fragment architecture. If you use MyFancyFragment on a fragment backstack, android could at any time destroy the Fragment, and then go to recreate it later via its public empty constructor. When it does this, it's not going to know to call setFragment() for you. I could go the ViewPager design route and set an Adapter to generate the Fragment on demand; but I'm now actually really confused about ViewPager - if the ViewPager fragment is destroyed and recreated via backstack operations, won't it forget about its Adapter? I also thought maybe I could take a Fragment type when I create MyFancyFragment the first time (so pass a Class instead of a Fragment to setFragment() above), create an instance using it on the fly in onCreateView(), and try to marshal that class type to my bundle in onSaveInstanceState() for later if I need to onCreateView() again: but I …
score: 2
answer count: 0
downvote count: 0
tagged with: android-fragments
tagged with: java
type: Question
upvote count: 2
tagged with: android-nested-fragment

http://stackoverflow.com/comment/36675398
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23828608
has text: Also in the lambda version: listOfSteps = FXCollections .observableArrayList(actionStep-> { return new Observable[] { actionStep.}; }); How does it know that actionStep is of type ActionStep? Content assist tells me that actionStep is being treated as a POJO, so none of the methods from the ActionStep class are visible.
type: AnswerComment

http://stackoverflow.com/q/23802043
score: 0
has comment: http://stackoverflow.com/comment/36612096
has comment: http://stackoverflow.com/comment/36612338
has comment: http://stackoverflow.com/comment/36612124
has comment: http://stackoverflow.com/comment/36612013
tagged with: android
has answer: http://stackoverflow.com/a/23802362
has answer: http://stackoverflow.com/a/23802164
has comment: http://stackoverflow.com/comment/36612586
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23802098
accepted answer: http://stackoverflow.com/a/23802098
tagged with: java
has answer: http://stackoverflow.com/a/23802256
tagged with: switch-statement
type: Question
has title: switch condition not working in Android
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/23802164
has body: so i have this code: package com.sunil.phpconnect; import java.io.BufferedReader; import java.io.InputStreamReader; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { Button nao; Button foto; Button novamen; TextView ola; HttpClient httpclient1, httpclient; HttpGet request1, request; HttpResponse response1, response; String url,iduser, urlmensagens; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Bundle extras = getIntent().getExtras(); iduser= extras.getString("userid"); TextView result = (TextView) findViewById(R.id.tvResult); //String g = result.getText().toString(); // String h = "valor"; urlmensagens = ("http://mywebsite.php?iduser="+iduser); novamen = (Button) findViewById(R.id.mensagens); //cenas da net try { httpclient1 = new DefaultHttpClient(); request1 = new HttpGet(urlmensagens); response1 = httpclient1.execute(request1); } catch (Exception e){ } try{ BufferedReader dr = new BufferedReader(new InputStreamReader( response1.getEntity().getContent())); String mensage = ""; mensage = dr.readLine(); String check_sms = mensage; Toast.makeText(getApplicationContext(), check_sms, Toast.LENGTH_LONG).show(); //novamen.setText(check_sms + " Mensagens por ler!"); switch(check_sms) { case "b": novamen.setVisibility(View.GONE); break; case "a": novamen.setVisibility(View.VISIBLE); break; default: novamen.setVisibility(View.GONE); } } catch (Exception e) { // Code to handle exception } url = ("http://mywebsite.php?action=requestuserdata&amp;userid="+iduser); try { httpclient = new DefaultHttpClient(); request = n…
has comment: http://stackoverflow.com/comment/36612061

http://stackoverflow.com/q/23802268
has comment: http://stackoverflow.com/comment/36616043
favorite count: 0
has comment: http://stackoverflow.com/comment/36617022
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36616173
tagged with: spring
has comment: http://stackoverflow.com/comment/36615514
linked to: http://stackoverflow.com/q/20464595
has comment: http://stackoverflow.com/comment/36624533
tagged with: spring-mvc
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36614846
has comment: http://stackoverflow.com/comment/36618849
type: Question
linked to: http://stackoverflow.com/q/19190592
has answer: http://stackoverflow.com/a/23804669
tagged with: validation
answer count: 1
has body: There is a grid which has multiple rows. Each row has the two same text fields. I am using JSR 303 to validate these fields and the validation is happening alright. However the issue is that multiple error messages are being shown(one for each row) which is not desirable. Is there a way to display only one error message per field for all the rows? public ModelAndView insert(@Valid @ModelAttribute("proposalwiseselectionform")ProposalWiseSelectionForm proposalwiseselectionformobj, BindingResult result, HttpServletRequest request, HttpServletResponse response) { if (result.hasErrors()) { if (formBeanObj == null) { formBeanObj = proposalwiseselectionformobj; } mav = new ModelAndView("proposalwiseselection"); mav.addObject("proposalwiseselectionform", formBeanObj); } } public class ProposalWiseSelectionForm { private String txtLineOfBusiness; private String txtProduct; private String btn; private String clickedGo="N"; private List arrLineOfBusiness=new ArrayList(); private List arrProduct=new ArrayList(); @Valid private ArrayList documentList=initiateDocumentList(); private String txtPageMode="I"; private String enableDiscardBtn="N"; private String enableInsertBtn="N"; public ArrayList initiateDocumentList(){ ArrayList arr=new ArrayList(); for(int i=0; i&lt;1;i++){ arr.add(new ProposalWiseSelectionChildForm(i)); } return arr; } } public class ProposalWiseSelectionChildForm { private String numProposalWiseSelection; private String txtTransactionType; private String txtTransactionTypeCode; @NotEmpty(message="Transaction Type cannot be empty") private String txtTransactionDesc; @NotEmpty(message="Document Type cannot be empty") private String txtPolicyDocument; private String ynChkBox="0"; } JSP snippets are as follows, form:form action="/proposalwiseselection" commandName="proposalwiseselectionform" method="POST" id="proposalwiseselection"/ form:errors path="*" cssClass="errorblock" element="div"/ form:input path="documentList[${docStatus.index}].txtTransactionDesc" cssCla…
downvote count: 0
has title: How to show only one validation error message for multiple rows in JSR 303 with spring?

http://stackoverflow.com/q/23798402
duplicate of: http://stackoverflow.com/q/9767952
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36605450
accepted answer: http://stackoverflow.com/a/23799552
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36605410
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36605549
has body: I saw a form (https://aptransport.in/CFSTONLINE/Reports/VehicleRegistrationSearch.aspx) in web, if i give Select Search Element: as Registration No and Enter Search Element: as AP31BF2942 ,and if i click on get data button, then i am getting my vehicle Details. I want to do this in HttpsURLConnection. I have seen parameter names as ctl00$OnlineContent$ddlInput and ctl00$OnlineContent$txtInput in the source of url. But i am unable to get required data.Please check the url import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import javax.net.ssl.HttpsURLConnection; public class TestAPHttp { private final String USER_AGENT = "Mozilla/5.0"; public static void main(String[] args) throws Exception { TestAPHttp http = new TestAPHttp(); System.out.println("\nTesting - Send Http POST request"); http.sendPost(); } // HTTP POST request private void sendPost() throws Exception { String url = "https://aptransport.in/CFSTONLINE/Reports/VehicleRegistrationSearch.aspx"; URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); //add reuqest header con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); String urlParameters = "ctl00$OnlineContent$ddlInput=R&amp;ctl00$OnlineContent$txtInput=AP31BF2942"; // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null)…
has comment: http://stackoverflow.com/comment/36607145
has answer: http://stackoverflow.com/a/23799552
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/9767952
has title: How to send Post Data to https server via HttpsURLConnection
tagged with: httpsurlconnection

http://stackoverflow.com/q/23913481
has body: I have this RDF file: &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:j.0="http://relation/" &gt; &lt;rdf:Description rdf:about="http://Group/row100"&gt; &lt;j.0:Codice&gt;VC&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Vercelli&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;Piemonte&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://Group/row63"&gt; &lt;j.0:Codice&gt;MT&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Matera&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;Basilicata&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://Group/row30"&gt; &lt;j.0:Codice&gt;CA&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Cagliari&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;Sardegna&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://Group/row57"&gt; &lt;j.0:Codice&gt;LU&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Lucca&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;Toscana&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://Group/row71"&gt; &lt;j.0:Codice&gt;PD&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Padova&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;Veneto&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://Group/row14"&gt; &lt;j.0:Codice&gt;TN&lt;/j.0:Codice&gt; &lt;j.0:Nome&gt;Trento&lt;/j.0:Nome&gt; &lt;j.0:Regione&gt;TrentinoAltoAdige&lt;/j.0:Regione&gt; &lt;/rdf:Description&gt; &lt;/rdf:RDF&gt; How I can do interlinking my file with other external Dataset as DBPEDIA? I would like to use automated tools in Java code. I studied "Silk" but, it wants an ontology in input, while I don't want to provide an ontology in input. Thanks in advance.
tagged with: dbpedia
tagged with: linkage
tagged with: http://stackoverflow.com/tag/rdf
has answer: http://stackoverflow.com/a/23913598
has title: RDF Interlinking with other dataset
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23913598
answer count: 1
downvote count: 0
tagged with: dataset
favorite count: 0

http://stackoverflow.com/comment/36715081
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23855912
has text: I don't see anything wrong; this should work and do basically what you want.

http://stackoverflow.com/q/23865115
score: 0
has title: Inserting in the sqlite with exesql
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23865157
possible better answer: http://stackoverflow.com/a/23865132
type: Question
has answer: http://stackoverflow.com/a/23865132
tagged with: java
answer count: 2
has body: i need a tip here , here i have a code to insert into sqlite database: Thread t = new Thread(new Runnable() { @Override public void run() { String sqlCreate = "CREATE TABLE IF NOT EXISTS " + name + " (ID INTEGER PRIMARY KEY AUTOINCREMENT," + " Type TEXT," + " Text TEXT," + " OtherFormats TEXT," + " Date TEXT," + " Image TEXT," + " RealName TEXT)"; db.execSQL(sqlCreate); //(String Type, String Text ,String name,String OtherFormats,String Itime,String RealName) String sqlInsert= "INSERT INTO " + "'"+name+"'" + " VALUES ("+"'"+ID+"'"+","+"'"+Type+"'"+","+"'"+Text+"'"+","+ "'"+OtherFormats+"'"+","+"'"+Date+"'"+" ,"+"'"+Image+"'"+","+"'"+RealName+"')"; db.execSQL(sqlInsert); } }); t.start(); the question is as you u see my ID is auto increment, but for executing it well, i need to put a value there,what value should i put so it database does the increament itself? thanks 05-26 03:56:33.018: E/AndroidRuntime(23809): android.database.sqlite.SQLiteException: near "VALUES": syntax error (code 1): , while compiling: INSERT INTO 'new' (Type,Text,OtherFormats ,Date,Image,RealName VALUES('m','hey','n','03:56','j','s')
tagged with: sqlite
has answer: http://stackoverflow.com/a/23865157

http://stackoverflow.com/comment/36723765
has text: Thx Juvanis, compact code but does exactly what I want. Thx again.
comment on: http://stackoverflow.com/a/23845992
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36668280
comment on: http://stackoverflow.com/a/23831021
score: 0
type: AnswerComment
has text: This still does not loop the program :/
type: Comment

http://stackoverflow.com/comment/36721753
comment on: http://stackoverflow.com/a/23859056
has text: in last edited code example HandlerN "knows" about mapper (invoking concrete Handlers method). it means that "tail wags the dog" and it's completely wrong. unfortunately i can't see according solution in obj-c for now, thanks for the suggestion anyway.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23861941
answers question: http://stackoverflow.com/q/23861882
score: 0
type: Answer
has body: To your first question "How do I test that when I call write("hello"), System.out.println("hellow") is called?" You can use Mockito and follow the instructions in this answer: Mockito : how to verify method was called on an object created within a method? To your second question "is this unit test even worth it?" As the test is, no, it doesn't make sense. However you can use this as a template, checking in the future if any method was called.

http://stackoverflow.com/comment/36600057
type: Comment
comment on: http://stackoverflow.com/a/23793456
score: 0
has text: Thats possible indeed but I think most developers don't have an own server due to the high maintainance costs caused by the huge mass of players. I'm not sure how the compromise of not storing purchases thus not providing the restore option exactly looks like but I think its not worth the effort to set up a server etc... I think it strongly depends on what the general situation is, but I think most games do not provide such a restore option...
type: AnswerComment

http://stackoverflow.com/a/23915864
has comment: http://stackoverflow.com/comment/36863770
has comment: http://stackoverflow.com/comment/36829210
has comment: http://stackoverflow.com/comment/36829080
has body: You can use partial heapsort. Construct a minheap having 1st 300 elements. Then as you traverse the array further, check whether the current element is greater than the root element of the heap. If it is greater, then delete the root element and add this new element. After you finish with the entire array, your minHeap will have the largest 300 elements. Extract the root element one by one. The elements will pop out in ascending order. Note: The heap will always contain k(300) elements irrespective of the value of N, so heap operations shall be O(logk) in this case. Hence order of complexity of this algorithm is O(Nlogk) where N is the size of array. Space Complexity - O(k) EDIT: If you want the lowest 300 elements, then similar algorithm can be followed using a maxheap instead of minheap.
has comment: http://stackoverflow.com/comment/36829730
upvote count: 4
answers question: http://stackoverflow.com/q/23915723
downvote count: 0
has comment: http://stackoverflow.com/comment/36829128
score: 4
has comment: http://stackoverflow.com/comment/36829550
has comment: http://stackoverflow.com/comment/36829605
has comment: http://stackoverflow.com/comment/36829047
has comment: http://stackoverflow.com/comment/36829940
type: Answer
has comment: http://stackoverflow.com/comment/36829448
has comment: http://stackoverflow.com/comment/36829666
has comment: http://stackoverflow.com/comment/36829567

http://stackoverflow.com/comment/36728259
comment on: http://stackoverflow.com/a/23862180
type: AnswerComment
score: 0
type: Comment
has text: It's not clear to me why it's "not particularly safe". Remember, I can assume only one thread reads/writes at a time, so triggering the memory barriers should be enough. Make sure to read erickson's quote - all writes to the hash multimap should be flushed by `writeMainMemory`. Or if I'm missing something please clarify.

http://stackoverflow.com/a/23905418
has body: I think serialize and deserialize instance is OK. If class is changed unit test will still be valid, you need to compare original and deserialized objects
has comment: http://stackoverflow.com/comment/36810095
has comment: http://stackoverflow.com/comment/36810176
answers question: http://stackoverflow.com/q/23905244
has comment: http://stackoverflow.com/comment/36809662
has comment: http://stackoverflow.com/comment/36809822
score: 0
type: Answer

http://stackoverflow.com/q/23911244
has answer: http://stackoverflow.com/a/23911366
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36820247
has answer: http://stackoverflow.com/a/23921329
has comment: http://stackoverflow.com/comment/36820404
has answer: http://stackoverflow.com/a/60648875
tagged with: java
tagged with: nio
type: Question
score: 0
has title: How to move file one directory to another directory using in java
has comment: http://stackoverflow.com/comment/36820385
answer count: 3
tagged with: io
has body: How to move file one directory to another directory using in java? Please let me know if any alternative solution to do this in java. public class FileTransform { public static void copyFile(File sourceFile, File destFile) throws IOException { if (!destFile.exists()) { destFile.createNewFile(); } System.out.println("Copy File Method"); FileChannel source = null; FileChannel destination = null; try { source = new FileInputStream(sourceFile).getChannel(); System.out.println("Destination File :"+destFile); destination = new FileOutputStream(destFile).getChannel(); // previous code: destination.transferFrom(source, 0, source.size()); // to avoid infinite loops, should be: long count = 0; long size = source.size(); while ((count += destination.transferFrom(source, count, size - count)) &lt; size); } finally { if (source != null) { source.close(); } if (destination != null) { destination.close(); } } } public static void main(String[] args) throws IOException { FileTransform ft = new FileTransform(); File src= new File("C:/File/File1/A10301A0003174228I_20140528080958095/A10301A0003174228I.xml"); File dest= new File("E:/FileDest/File1"); ft.copyFile(src,dest); } } Above code i am getting exception is Exception in thread "main" java.io.FileNotFoundException: E:\FileDest\File1 (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at FileTransform.copyFile(FileTransform.java:22) at FileTransform.main(FileTransform.java:48) I am getting File not found exception, Please let me know how to do this in java

http://stackoverflow.com/comment/36572803
comment on: http://stackoverflow.com/q/23781104
type: Comment
type: QuestionComment
has text: ypu must have returnval beteen `` and ``
score: 3

http://stackoverflow.com/comment/48890882
has text: "How can I prevent token theft" - I can't think of anything but SSL
comment on: http://stackoverflow.com/a/26047717
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23828390
upvote count: 1
has body: You minising for me. ok. But it's better to give some available solutions to the problem. But it is easier to place minuses. This is solution for the ListPreference, workable for lower then HoneyComb android too : public class IconPreference extends ListPreference { private Drawable mIcon; public IconPreference(Context context, AttributeSet attrs) { this(context, attrs, 0); } public IconPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs); setLayoutResource(R.layout.icon_pref); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconPreference, defStyle, 0); mIcon = a.getDrawable(R.styleable.IconPreference_icon); } @Override public void onBindView(View view) { super.onBindView(view); ImageView imageView = (ImageView) view.findViewById(R.id.icon); if (imageView != null &amp;&amp; mIcon != null) { imageView.setImageDrawable(mIcon); } } public void setIcon(Drawable icon) { if ((icon == null &amp;&amp; mIcon != null) || (icon != null &amp;&amp; !icon.equals(mIcon))) { mIcon = icon; notifyChanged(); } } public Drawable getIcon() { return mIcon; } }
downvote count: 0
type: AcceptedAnswer
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23827787
answers question: http://stackoverflow.com/q/23827787

http://stackoverflow.com/comment/36832690
type: Comment
has text: Are you sure the component you're drawing the image on is big enough to display it?
comment on: http://stackoverflow.com/q/23917518
score: 1
type: QuestionComment

http://stackoverflow.com/a/23920746
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23920684
has body: Your friend is ZipFile or ZipInputStrem class.

http://stackoverflow.com/q/23936280
tagged with: regex
has answer: http://stackoverflow.com/a/23936453
type: AnsweredQuestion
has body: String camelCasePattern = "([a-z][A-Z0-9]+)+"; boolean val = "camelCase".matches(camelCasePattern); System.out.println(val); The above prints false. I'm trying to match a camelCase pattern starting with lower case letter. I have tried to tweak it a bit, without no luck though. Is the pattern wrong for camelCase?
score: 7
tagged with: java
upvote count: 7
accepted answer: http://stackoverflow.com/a/23936368
type: Question
has answer: http://stackoverflow.com/a/61204361
has title: Matching "camelCase" to a regular expression in java
has answer: http://stackoverflow.com/a/23937606
has answer: http://stackoverflow.com/a/73345434
has comment: http://stackoverflow.com/comment/36867153
has answer: http://stackoverflow.com/a/65284609
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/36867142
favorite count: 0
possible better answer: http://stackoverflow.com/a/23937040
has answer: http://stackoverflow.com/a/23936368
has answer: http://stackoverflow.com/a/23937040

http://stackoverflow.com/comment/36607988
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23799045
has text: Thanks Brother working like charm.Another question will this is best approach which used above or it we will be good we create our own implementation for cache and refresh cache data time to time when we needed Please guide me?Actully I have Valid table and i want when Server will start all data should be load in cache and then i will use that data and it will refresh automatically every 24hours.
type: AnswerComment

http://stackoverflow.com/comment/36739049
comment on: http://stackoverflow.com/q/23865976
score: 0
has text: @Raghu i have added the output in my question..sorry for the delay
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23898964
tagged with: android
has comment: http://stackoverflow.com/comment/36798176
tagged with: mercator
has body: I want to find out the pixels coordinates of a lat/lng on an static map. For example i've downloaded an image from: Link to Image What I want is from a lat/lng long to be able to map that latlng to pixel coordinates. I've searched a bit and found that mercator projection can solve my problem. However I could not find any proper way of doing it. Can somebody please help me. Also I've zoomed to 9 when as shown in the URL.
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36781518
has answer: http://stackoverflow.com/a/27307204
tagged with: java
has title: Getting pixel coordinated from google static maps
type: Question
answer count: 2
tagged with: google-maps
has comment: http://stackoverflow.com/comment/36841288

http://stackoverflow.com/comment/36822940
type: QuestionComment
score: 0
has text: I don't see a reason to do the initialization on the `EDT`. Just make sure everything that concerns the `GUI` is done on the `EDT` but the rest can be done in another thread if needed.
comment on: http://stackoverflow.com/q/23912610
type: Comment

http://stackoverflow.com/q/23894184
has answer: http://stackoverflow.com/a/23894290
tagged with: java
tagged with: hibernate-criteria
has comment: http://stackoverflow.com/comment/36788773
has title: Will Hibernate findByCriteria cause Java heap memory issue?
type: Question
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36788193
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/55222942
type: UnansweredQuestion
has body: I have little knowledge about Hibernate. I am calling findByCriteria(DetachedCriteria criteria) method, but I noticed that it returns a List. My worry is if it will cause Java heap memory issue when the database returns very large result. In my next code, I am looping through this returned list and do something on reach record. I noticed that findByCriteria(DetachedCriteria criteria) is internally calling findByCriteria(criteria, -1, -1). Could someone enlighten me?

http://stackoverflow.com/a/23894434
type: Answer
has body: How do I allow two components to be visible in the same area at the same time in a JFrame? You can still use layout managers. How do you think a GUI is built? There is always a hierarchy of components. Each parent component has a child component. JLabel child = new JLabel("Child Label"); JPanel parent = new JPanel(); parent.add( child ); frame.add( parent ); Now you have a hierarchy of frame -> content pane -> parent -> child. Depending on the layout managers you use at each level you can achieve different effects. You can always use a BorderLayout on each component to that the component you add to it will take up all the space. Of course when you start adding panels on top of one another you need to use setOpaque(false) so all the components can be seen. The key point from your other 4 postings is that unless your components have a preferred size, the layout can't lay out the components properly.
answers question: http://stackoverflow.com/q/23893623
score: 0

http://stackoverflow.com/comment/36845093
type: AnswerComment
has text: @user3672215 Don't...don't change the layout. Use one layout for this `Activity` then change activities when you need to. It sounds like you have a design problem which explaining here will get too complicated. To get the best help, accept the answer which helped solve this problem then post a new question with the relevant information, code, and errors.
type: Comment
comment on: http://stackoverflow.com/a/23923708
score: 0

http://stackoverflow.com/q/23816711
has comment: http://stackoverflow.com/comment/36657637
has comment: http://stackoverflow.com/comment/36640215
answer count: 0
type: UnansweredQuestion
has body: I have a web service application (Apache, Tomcat, JAVA, Spring, MyBatis, jndi, jtds stack) that does many database queries. Recently, we've been having DB server overload issues, where a complex query that normally takes 10-20 seconds is now taking 60+ seconds. Aside from just being slow, what has started to happen is that when the query pushes the 90 second mark (almost exactly), the MyBatis layer pukes with the error: "java.sql.SQLException: I/O Error: Socket closed; SQL []; I/O Error: Socket closed; nested exception is java.sql.SQLException: I/O Error: Socket closed" I know the best fix is the make SQL faster; we're working on that. In the meantime, any idea where the 90 second socket time-out is coming from? From reading around it looks like the socket timeout for a jtds connection is default to 0. I'm trying to set it to 10 minutes with this, but it does not change the error happening at 90 seconds: url="jdbc:jtds:sqlserver://mydatabaseserver:1433;DatabaseName=mydatabase;sendStringParametersAsUnicode=false;socketTimeout=600" Where else I can look to get rid of this timeout? Thanks
upvote count: 1
score: 1
tagged with: java
tagged with: jtds
tagged with: timeout
type: Question
downvote count: 0
tagged with: mybatis
has title: MyBatis issue with MSSQL, JTDS running in Tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36692212
tagged with: sockets

http://stackoverflow.com/q/23876193
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
has title: Sending Image between IOS and Java
type: Question
possible better answer: http://stackoverflow.com/a/23876395
has answer: http://stackoverflow.com/a/23876395
tagged with: ios
has body: Currently I am sending images between an IOS app and Java web service as Strings - is there a better way to do this and if so what method is it - the Strings to represent images are huge and its quite hard to manage. Thanks
has answer: http://stackoverflow.com/a/23876211
answer count: 2
downvote count: 0
tagged with: string
linked to: http://stackoverflow.com/q/2323709
favorite count: 0
accepted answer: http://stackoverflow.com/a/23876211
type: AnsweredQuestion

http://stackoverflow.com/comment/36709657
comment on: http://stackoverflow.com/q/23851315
has text: Interesting. Where's that in Eclipse?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36666682
type: Comment
has text: just add a cast (int)
comment on: http://stackoverflow.com/q/23830882
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36765204
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23851658
has text: @invariant no problem. To each their own! (By the way: WebSphere Portal was just an example.)

http://stackoverflow.com/q/23895511
score: 1
tagged with: java
tagged with: thread-safety
type: Question
has title: Java 8, collect method, creating a new arraylist and mutation
linked to: http://stackoverflow.com/q/22350288
has comment: http://stackoverflow.com/comment/36791050
has answer: http://stackoverflow.com/a/23895890
accepted answer: http://stackoverflow.com/a/23895890
upvote count: 1
answer count: 1
has body: I just want to clarify something regarding the code below: public static void ageOverTen(final List&lt;Human&gt; man) { final List&lt;Human&gt; byAge = man.stream() .filter(age -&gt; age.getAge() &gt; 10) .collect(ArrayList::new, ArrayList::add, ArrayList::addAll); System.out.println("People over 10 years: " + byAge); } In the Java world we all know ArrayList is not thread safe and it's mutable, so when you create a stream and use a collect() method, and in it we create an ArrayList. How does the library affect ArrayList thread safety and mutation, to make it comply with functional programming concept of immutability?
favorite count: 0
tagged with: java-8
duplicate of: http://stackoverflow.com/q/22350288
type: AnsweredQuestion
tagged with: java-stream
downvote count: 0

http://stackoverflow.com/q/23864472
tagged with: tomcat
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36734005
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/4192364
has comment: http://stackoverflow.com/comment/36739516
type: Question
linked to: http://stackoverflow.com/q/4845219
has title: Eclipse Kepler fails to start Tomcat 7
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36733468
upvote count: 1
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/36731920
answer count: 1
has answer: http://stackoverflow.com/a/38548432
has body: I'm using Eclipse Kepler and Tomcat 7 and Ubuntu 12.04. When Tomcat starts it after 45 seconds it says Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor. I increased the timeout, reinstalled Eclipse and Tomcat but still the problem is not solved. In debug mode I get this error. &lt;terminated, exit value: 143&gt;/usr/lib/jvm/java-7-openjdk-amd64/bin/java (May 26, 2014, 12:26:09 PM) My console says: May 26, 2014 12:26:10 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib May 26, 2014 12:26:10 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] May 26, 2014 12:26:10 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] May 26, 2014 12:26:10 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 995 ms May 26, 2014 12:26:10 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina May 26, 2014 12:26:10 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.54 May 26, 2014 12:26:11 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] May 26, 2014 12:26:11 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] May 26, 2014 12:26:11 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 804 ms

sorting
tags question: http://stackoverflow.com/q/23807894
tags question: http://stackoverflow.com/q/23891380
tags question: http://stackoverflow.com/q/23783052
tags question: http://stackoverflow.com/q/23810614
tags question: http://stackoverflow.com/q/23936123
tags question: http://stackoverflow.com/q/23907134
tags question: http://stackoverflow.com/q/23884454
tags question: http://stackoverflow.com/q/23851030
tags question: http://stackoverflow.com/q/23788630
tags question: http://stackoverflow.com/q/23888438
tags question: http://stackoverflow.com/q/23939937
type: Tag
tags question: http://stackoverflow.com/q/23876483
tags question: http://stackoverflow.com/q/23834049
tags question: http://stackoverflow.com/q/23848410
tags question: http://stackoverflow.com/q/23790396
tags question: http://stackoverflow.com/q/23911857
tags question: http://stackoverflow.com/q/23930221
tag name: sorting
tags question: http://stackoverflow.com/q/23784348
tags question: http://stackoverflow.com/q/23872945
tags question: http://stackoverflow.com/q/23915723
tags question: http://stackoverflow.com/q/23932811
tags question: http://stackoverflow.com/q/23787525

http://stackoverflow.com/comment/36723898
score: 0
has text: Call super.paintComponent and let the paint chain deal with it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23860287

http://stackoverflow.com/comment/36793562
type: AnswerComment
has text: What possible problems do you see with a generified solution? With the somewhat cluttered type restrictions mentioned above I get a usable interval implementation ... I do not want to put too much functionality into it; only what I wrote in my question ...
comment on: http://stackoverflow.com/a/23876074
type: Comment
score: 1

http://stackoverflow.com/a/23833917
has body: PreparedStatement has a setCharacterStream() method which take a Reader object. Now you could use a StringReader to read your string value into the database through setCharacterStream(). Hope that helps!
type: Answer
answers question: http://stackoverflow.com/q/23833140
upvote count: 1
has comment: http://stackoverflow.com/comment/36737481
score: 1
downvote count: 0

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/23907413
tags question: http://stackoverflow.com/q/23917774
tags question: http://stackoverflow.com/q/23875629

http://stackoverflow.com/comment/36860266
comment on: http://stackoverflow.com/a/23932660
type: AnswerComment
has text: Thank you, so this is basiaclly the method solving itself after it has reached the base case?
score: 0
type: Comment

http://stackoverflow.com/comment/37239536
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23808376
has text: Does titan use/plan to use the datastax drivers? As I am using the titan API to connect to C*, I am dependent on the stack.
type: AnswerComment

http://stackoverflow.com/q/23913284
has body: I have a String array in Android (Java) with 175 elements which contains addresses. Now I need to sort the five closest addresses and make it to a list, I have got it to work with one element and a Spinner. This is my code: for(String sa: stringarray) { addresses = geocoder.getFromLocationName(sa, maxInput); } what this does is that it run through the loop and replace every element. So if I then run Address address = addresses.get(0); I will get the last element in the string array. Is there any way to store an element in like a Hashmap and compare that value to my position which I get from Googles API - getLastLocation in onConnected? Best regards Antiderive
answer count: 0
type: UnansweredQuestion
tagged with: geolocation
has title: Get the five closest addresses from String Array
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36825298
tagged with: arrays
has comment: http://stackoverflow.com/comment/36824821
tagged with: android

http://stackoverflow.com/q/23940855
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23940941
score: 21
tagged with: java
has title: Is there a shortcut to execute something only if its not null?
type: Question
has answer: http://stackoverflow.com/a/23940880
has comment: http://stackoverflow.com/comment/36875887
possible better answer: http://stackoverflow.com/a/23940941
has answer: http://stackoverflow.com/a/23940909
duplicate of: http://stackoverflow.com/q/271526
has body: I find myself constantly writing this statement MyObject myObject = something.getThatObject(); if( myObject !=null &amp;&amp; myObject .someBooleanFunction()){ } in order to prevent a null pointer exception. Is there a shortcut to this in Java? I'm thinking like myObject..someBooleanFunction()?
upvote count: 21
has comment: http://stackoverflow.com/comment/36876020
favorite count: 0
has answer: http://stackoverflow.com/a/23942022
accepted answer: http://stackoverflow.com/a/23942022
linked to: http://stackoverflow.com/q/271526
has comment: http://stackoverflow.com/comment/36875942
answer count: 4

http://stackoverflow.com/comment/36752875
has text: Now I can no longer reproduce the error. Looks like you magically solved my problem ;) By using `event.getSource().getClass()` I get `class org.eclipse.core.internal.resources.Workspace`. Which method would you have proposed for checking?
comment on: http://stackoverflow.com/q/23875766
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23829093
has comment: http://stackoverflow.com/comment/36729368
has body: It's pretty clear the error message : Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. You could try something like this : public class FillThread extends AsyncTask&lt;Void, Void, DataItem&gt; { @Override protected DataItem doInBackground(Void... params) { return new DataItem(); } @Override protected void onPostExecute(DataItem dataItem) { // call an update method that adds the dataItem and notifies the adapter } }
answers question: http://stackoverflow.com/q/23828349
score: 0
type: Answer

http://stackoverflow.com/comment/36603415
type: Comment
type: QuestionComment
has text: So clearly you'll need to iterate through one of the maps, look up the keys you find in the other map, do some kind of subtraction, then store the result. Which of these four things do you not know how to do?
comment on: http://stackoverflow.com/q/23797300
score: 0

http://stackoverflow.com/comment/36682714
comment on: http://stackoverflow.com/q/23838700
has text: Robustness. If the thread's manage the file create it, lock it on start, and delete it on destroy/close. What's going on is really in your face. Getting the next slot is something you can optimise in several ways, and you wouldn't get any responsiveness issues unless you maxed out your slots. If you got the thread to request a slot from the server, and to release it back....
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23811949
accepted answer of: http://stackoverflow.com/q/23797596
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23797596
has body: Thank you all. The problem was very Trivial, I had not marked the library as a library project. I did that, and added it to my own project's build path, and it works.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24079831
score: 0
answers question: http://stackoverflow.com/q/23811559
type: Answer
has body: You haven't stated what version of JacORB you are using. It should generate a number of classes in the build directory. It can either run the entire client/server automatically or you can run it manually. Add that build/classes to you classpath and then execute the demo by jaco demo.hello.Server and then jaco demo.hello.Server I would recommend asking any JacORB questions on the jacorb-developer mailing list http://www.jacorb.org/contact.html

http://stackoverflow.com/q/23897117
has comment: http://stackoverflow.com/comment/36794311
has comment: http://stackoverflow.com/comment/36794248
has comment: http://stackoverflow.com/comment/36794208
answer count: 0
has title: How to write a P6 ppm
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36794066
tagged with: ascii
score: 0
tagged with: ppm
has comment: http://stackoverflow.com/comment/36795426
has comment: http://stackoverflow.com/comment/36794111
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: binary
has body: I understand how to read and write a P3 ppm file, and that it is in ASCII. I know that in P6 ppm it is written in binary, but I have no idea how to write one of my own. Of course I know how to write in binary, but I've seen P6 ppm files with weird characters like this: ÿ. I don't understand what that has to do with binary. Can someone explain?
has comment: http://stackoverflow.com/comment/36793886
type: UnansweredQuestion

http://stackoverflow.com/comment/37419927
comment on: http://stackoverflow.com/q/23937578
type: QuestionComment
has text: @mixable no, I'm still having this problem.
score: 0
type: Comment

http://stackoverflow.com/q/23815344
has body: Code in Java public class A { int x; public A() { x = 0; } public void print() { System.out.println("This is A"); } } public class B extends A { int x; public B() { x = 1; } public void print() { System.out.println("This is B"); } } B b = new B(); A a = b; System.out.print(a.x);----------------&gt;0 a.print();----------------&gt;This is B I am very confused. I create object b for B class, although I assign b to a, I think b should still point the class B. Why the "a.x" will return 0 instead of 1? Why a.x point to the x in A, but a.print() point to the print() method in B?
upvote count: 3
has answer: http://stackoverflow.com/a/23815385
type: Question
has answer: http://stackoverflow.com/a/23815392
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23815385
possible better answer: http://stackoverflow.com/a/23815392
answer count: 2
linked to: http://stackoverflow.com/q/2464222
downvote count: 0
duplicate of: http://stackoverflow.com/q/2464222
has title: confused in Inheritance, could anyone help me?
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/36778171
score: 0
type: Comment
has text: i know the difference between jsp and js , but my question was more focused on if we can use js for rendering pages.
type: QuestionComment
comment on: http://stackoverflow.com/q/23888930

http://stackoverflow.com/a/23896511
has comment: http://stackoverflow.com/comment/36792806
answers question: http://stackoverflow.com/q/23896432
upvote count: 2
has comment: http://stackoverflow.com/comment/36793187
has body: -&gt; is used to access instance variables, the same way it's used to access member variables of a pointer in C or C++. In the code you provided, you declared configuration as an instance variable. If you wanted to use the dot operator, you should have declared it as a property, which is what you really should have done from the beginning.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/36735882
comment on: http://stackoverflow.com/a/23858779
type: Comment
has text: The problem was quite stupid as I expected... the `public boolean onCreateOptionsMenu(Menu menu)` was duplicating `(Menu menu)` with the name of my other class - **Menu**.class and the android can't find my class because of that so when i changed the name of the class it started working perfectly.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36742204
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23870326
has text: http://bit.ly/1r8TC9D
type: QuestionComment

http://stackoverflow.com/comment/36849236
type: Comment
has text: I'm a beginner in java (just finished AP Computer Science A) and this answer made the most sense to me. All of the other answers I've read were great and would probably be very easy to comprehend for a programmer more advanced than me. However, since I'm a beginner, and don't know too much about autoboxing or caching, this answer was the most clear for me. Thanks to everyone who responded; I really appreciate all of your help.
type: AnswerComment
comment on: http://stackoverflow.com/a/23926151
score: 0

http://stackoverflow.com/a/23828281
answers question: http://stackoverflow.com/q/23827557
score: 0
has body: You need to fix your java application to use text/xml as http header. Java supports the mechanism so you can edit http header. And to know what http request your client is sending, you can use wireshark or httpdebugger like fiddler.
type: Answer

http://stackoverflow.com/q/23913165
has comment: http://stackoverflow.com/comment/36833389
has answer: http://stackoverflow.com/a/23913709
type: UnansweredQuestion
has body: Lotus Designer. Java agent/Script Library. I am trying to add a new dependencies "com.ibm.xsp.model.domino.wrapped" in the plugin.xml in the package explorer, but its not available. I am using version 9.0 without the extension library. Whether these plugins are not available as default? what should be done to get these. Thanks Veera
score: 0
tagged with: java
tagged with: lotus-domino
type: Question
has title: Domino API Plugin - com.ibm.xsp.model.domino.wrapped
answer count: 1
tagged with: xpages
has comment: http://stackoverflow.com/comment/36824199

http://stackoverflow.com/a/23793333
type: AcceptedAnswer
upvote count: 14
type: Answer
has body: Use generics. public &lt;T&gt;void foo(T[] array) { System.out.println(array.length); } This will not work for array of primitive types, such as int[], boolean[], double[],... You have to use their class wrappers instead: Integer[], Boolean[], Double[], ... or overload your method for each needed primitive type separately. If you are curious you may have a look at a analogical problem (generics and classes vs. primitive types) with Streams here: https://stackoverflow.com/a/23010472/2886891
downvote count: 0
score: 14
accepted answer of: http://stackoverflow.com/q/23793224
answers question: http://stackoverflow.com/q/23793224

http://stackoverflow.com/q/23823547
downvote count: 5
has answer: http://stackoverflow.com/a/23823594
has answer: http://stackoverflow.com/a/23823716
accepted answer: http://stackoverflow.com/a/23823716
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/1844688
favorite count: 0
has comment: http://stackoverflow.com/comment/36653271
tagged with: filereader
possible better answer: http://stackoverflow.com/a/23823594
has comment: http://stackoverflow.com/comment/36653061
type: AnsweredQuestion
score: -4
has title: Java, automatic reading file from a directory
has body: I need to know if it's possible to do this: i've some .txt file in a directory in my filesystem i would like to write a java code that does this: Automatically read all the files in the directory Give me a output Exists some library? or it's just a code problem? It's possible? Thanks
has comment: http://stackoverflow.com/comment/36696652
type: Question
tagged with: java

http://stackoverflow.com/q/23853237
tagged with: android
favorite count: 0
has body: I have a TextView with links and other text. I need to links to be clickable & I need to capture the click and open the link in a webview in my activity. I followed this this answer. My code looks like this: actitivity_main.xml <TextView android:id="@+id/textlinktest" android:layout_width="wrap_content" android:layout_height="50dp"/> And this is the way I invoke it: textLinkTest.setText(Html.fromHtml("Something else google")); textLinkTest.setText(RichTextUtils.replaceAll( (Spanned) textLinkTest.getText(), URLSpan.class, new URLSpanConverter())); The links show up fine, but they are not clickable! The onclick in my customeclickablespan never gets called. I tried toggling android:linksClickable & also tried different values for android:autoLink. But the links remain unclickable. Any thoughts?
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23854407
has title: Open TextView links at another activity - custom ClickableSpan
answer count: 1
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/23854407
tagged with: android-layout
linked to: http://stackoverflow.com/q/11413399
downvote count: 0
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/23822860
type: AnsweredQuestion
score: 2
tagged with: java
has title: Writing excel formula for HYPERLINK using jxl(java) fails
accepted answer: http://stackoverflow.com/a/24657228
type: Question
downvote count: 0
tagged with: jxl
answer count: 1
favorite count: 0
tagged with: excel-formula
has answer: http://stackoverflow.com/a/24657228
upvote count: 2
has body: I'm trying to write a HYPERLINK into excel using jxl in java, but the write fails as below. Please suggest what can be done String scn = "=HYPERLINK(\"D:\\snaps\\"+step_num+".jpg\",\"Click\")"; Formula link = new Formula(3,0,scn); wws.addCell(link); java.util.EmptyStackException at java.util.Stack.peek(Unknown Source) at java.util.Stack.pop(Unknown Source) at jxl.biff.formula.BinaryOperator.getOperands(BinaryOperator.java:61) at jxl.biff.formula.StringFormulaParser.parseCurrent(StringFormulaParser.java:240) at jxl.biff.formula.StringFormulaParser.parse(StringFormulaParser.java:113) at jxl.biff.formula.FormulaParser.parse(FormulaParser.java:129) at jxl.write.biff.FormulaRecord.initialize(FormulaRecord.java:160) at jxl.write.biff.FormulaRecord.setCellDetails(FormulaRecord.java:243) at jxl.write.biff.WritableSheetImpl.addCell(WritableSheetImpl.java:1155) at framework.WrapperMethods.writeExcel(WrapperMethods.java:174) at framework.WrapperMethods.setValueById(WrapperMethods.java:80) at sample.T24Login.main(T24Login.java:55)
tagged with: excel

http://stackoverflow.com/comment/60792761
comment on: http://stackoverflow.com/q/23898218
type: Comment
type: QuestionComment
has text: I had similar issues and eventually solved it by using `getResourceAsStream` instead of `getResource`
score: 0

http://stackoverflow.com/comment/37084697
comment on: http://stackoverflow.com/a/24045396
score: 0
type: AnswerComment
has text: Thanks! It runs fluently!
type: Comment

http://stackoverflow.com/comment/36886266
comment on: http://stackoverflow.com/a/23931631
score: 0
type: AnswerComment
type: Comment
has text: what do you suggest then if I'm not going to use onshow? onload doesn't work either on , , and tags? As soon as the page shown, I want the map to be filled with longlat values from myBean but not using because I want to determine which are the starting and end longlat points.

http://stackoverflow.com/a/23885816
has comment: http://stackoverflow.com/comment/36772539
has comment: http://stackoverflow.com/comment/36773046
has comment: http://stackoverflow.com/comment/36772465
has comment: http://stackoverflow.com/comment/36772144
has comment: http://stackoverflow.com/comment/36772324
upvote count: 2
has comment: http://stackoverflow.com/comment/36776039
downvote count: 0
has comment: http://stackoverflow.com/comment/36773943
has comment: http://stackoverflow.com/comment/36772819
answers question: http://stackoverflow.com/q/23885042
type: Answer
score: 2
has body: I used Jquery fileupload in client side. And at my JS file , function doUploadPhoto(seq) { $('#fileupload').fileupload({ url : 'news/upload.html?s=' + seq, sequentialUploads : true, disableImageResize : false, imageMaxWidth : 1024, imageMaxHeight : 1024, previewCrop : true, dropZone : $("#dropZone"), acceptFileTypes : /(\.|\/)(gif|jpe?g|png)$/i, progress : function(e, data) { if (data.context) { var progress = data.loaded / data.total * 100; progress = Math.floor(progress); $('.progress').attr('aria-valuenow', progress); $('.progress').css('display', 'block'); $('.bar').css('width', progress + '%'); } }, progressall : function(e, data) { var progress = data.loaded / data.total * 100; progress = Math.floor(progress); $('.progressall').attr('aria-valuenow', progress); $('.progressall').css('display', 'block'); $('.allbar').css('width', progress + '%'); if (progress &gt; 20) { $('.allbar').text(progress + '% Completed'); } }, stop: function (e) { return; } }); } Handle your specific request for image upload (I used Spring). @RequestMapping(value = "/news/upload.html", method = RequestMethod.POST) public final void uploadNewsPhoto(final HttpServletRequest request, final HttpServletResponse response) throws Exception { doUploadNewsPhoto(request, getSessionFileItems(request)); } for upload image public final synchronized String doUploadNewsPhoto(final HttpServletRequest request, final List&lt;FileItem&gt; sessionFiles) throws UploadActionException { try { List&lt;Map&lt;String, Object&gt;&gt; ret = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(); for (FileItem item : sessionFiles) { if (!item.isFormField()) { try { // get news sequence for save it's images Long seq = Long.parseLong(request.getParameter("s")); Map&lt;String, Object&gt; res = newsPhotoBiz.saveToFile(seq, item, SecuritySession.getLoginUserSeq()); res.put("name", item.getName()); res.put("size", item.getSize()); ret.add(res); } catch (Exception e) { log.error("Error, can't upload news photo file, name:" + it…

swiperefreshlayout
type: Tag
tags question: http://stackoverflow.com/q/23840254
tag name: swiperefreshlayout

http://stackoverflow.com/a/23862056
upvote count: 2
has body: Don't start throwing tomatoes if I'm wrong, but.... your mainframe layout is the FlowLayout mainframe.setLayout(new FlowLayout()); You're specifying that your MusicPanel be set to a BorderLayout position on a JFrame that is set for the FlowLayout. mainframe.add(MusicPanel, BorderLayout.SOUTH); By doing this, you can't really predict what your GUI is going to look like when it compiles.This could be the source of your issue. Also, on a side note, the compass references are no longer the preferred method of setting locations in a BorderLayout. http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html I would try setting your JFrame's layout to BorderLayout, set your MusicPanel to the PAGE_END (SOUTH) position of the JFrame. Then, use the GridBag layout on your MusicPanel and position your JButton to the LAST_LINE_END position. Let me know how that works out!
answers question: http://stackoverflow.com/q/23861345
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/23795402
has body: The remove-method does not remove the document you pass to it. It removes all documents which have all fields in common with the DBObject passed. Why is this distinction important in this case? Because you are using a projection to change the document. After the projection, the DBObject has a new field textScore=something. When you then pass that DBObject to .remove(), the database will only delete a document which also has a field textScore with that exact value. Because the original document in the collection hasn't got this field, it doesn't get deleted. So what do you do instead? Create a new BasicDBObject with only the _id of the document you want to delete and nothing else. Because the _id field is always unique and automatically indexed, this will be both unambiguous and fast. Then pass this one to .remove.
has comment: http://stackoverflow.com/comment/36601586
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23794926
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23794926

http://stackoverflow.com/comment/36626825
score: 0
comment on: http://stackoverflow.com/a/23807627
type: Comment
has text: Oh ok. I was hoping there was a property I could set. Wishful thinking. I'll leave it a few hours and if no-one else comments I'll mark your answer as **the** answer.
type: AnswerComment

http://stackoverflow.com/a/23935819
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23931386
type: Answer
accepted answer of: http://stackoverflow.com/q/23931386
score: 0
has body: collection.distinct('appName') will give you all the different values in your collection that exist for that particular fieldName. If you know that all documents have some kind of value there, then you can just do collection.find({}) If you are not sure that the field exists for each document, then you only want to documents where that field exists collection.find({'appName' : {'$exists' :true}}) That will get you all the documents that have the field 'appName' defined and the value will be one of the two values that you are expecting from your collection.distinct('appName') command

http://stackoverflow.com/q/23845096
type: Question
has answer: http://stackoverflow.com/a/23845281
upvote count: 0
score: -2
answer count: 3
has answer: http://stackoverflow.com/a/23845169
accepted answer: http://stackoverflow.com/a/23845281
favorite count: 0
possible better answer: http://stackoverflow.com/a/23845169
has answer: http://stackoverflow.com/a/23845206
downvote count: 2
has title: The Java code did not show the result that I want
type: AnsweredQuestion
has body: I am new to Java and actually this code is to ask the user for 2 numbers for the conversion from inch to centimeter and vice versa. But when I built it, it said "error: cannot find symbol" and I still cannot figure it out although I kept checking the code. Below is my code: import java.util.Scanner; import java.util.DecimalFormat; public class Practical2Q2 { public Practical2Q2() {} public static void inchToCentimeter(double a) { System.out.println("Inches " + "Centimeters"); System.out.print("\n"); for (double i = 1.0; i &lt;= a; i++) { double cm = i * 2.54; System.out.println(i + " " + df.format(cm)); } } public static void centimeterToInch(double b) { System.out.print("\n"); System.out.println("Centimeters " + "Inches"); System.out.print("\n"); for (double i = 5.0; i &lt;= b; i += 5) { double inch = i / 2.54; System.out.println(i + " " + df.format(inch)); } } public static void main(String args[]) { Scanner newScanner = new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.00"); System.out.println("Please enter 2 numbers :\n" + "Number a for the conversion from inch to centimeter,\n" + "while number b for the conversion from centimeter to inch"); System.out.println("Number a : "); double c = newScanner.nextDouble(); System.out.println("Number b : "); double d = newScanner.nextDouble(); inchToCentimeter(c); centimeterToInch(d); } } Could you please state the wrong part?
tagged with: java

http://stackoverflow.com/a/23884598
has body: Well Absurd-Mind's .replaceAll("[\\p{Cntrl}&amp;&amp;[^\n\t\r]]", ""); and my .replaceAll("[\\p{Zl}\\p{Zp}\\p{C}]+", ""); solutions work correct and Strings get cleaned. It was an export issues somewhere else in my code!
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23866256
downvote count: 0

http://stackoverflow.com/q/23893656
has comment: http://stackoverflow.com/comment/36787366
tagged with: concurrency
has answer: http://stackoverflow.com/a/23894026
answer count: 2
upvote count: 1
favorite count: 0
has body: I have two methods, foo() and bar(). There will be multiple threads calling these methods, possibly at the same time. It is potentially troublesome if foo() and bar() are run concurrently, as the interleaving of their internal logic can leave the system in an an inconsistent state. However, it it is perfectly ok, and in fact desirable, for multiple threads to be able to call foo() at the same time, and for multiple threads to be able to call bar() at the same time. The final condition is that foo() is expected to return asap, whereas there is no hard time constraint on bar(). I have been considering various ways in which it might be best to control this behaviour. Using synchronized in its simplest form doesn't work because this will block concurrent calls to each method. At first I thought ReadWriteLock might be a good fit, but this would only allow one of the methods to be called concurrently with itself. Another possibility I considered was queuing up requests for these methods on two separate queues and having a consumer which will concurrently execute every foo() in the queue, and then every bar() in the queue, but this seems like it would be difficult to tune so as to avoid unnecessary blocking of foo(). Any suggestions?
possible better answer: http://stackoverflow.com/a/23894026
has comment: http://stackoverflow.com/comment/36787133
downvote count: 0
has title: How can I prevent two operations from interleaving with each other whilst still allowing concurrent execution?
has answer: http://stackoverflow.com/a/23894003
accepted answer: http://stackoverflow.com/a/23894003
score: 1
tagged with: java
tagged with: multithreading
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/23847998
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23847936
has body: In c++ a more popular way for a 2D array would be to use a 2D vector. This would have many advantages. You could also access on elements via [][]. The size is dynamically allcoated - so you could always increase the size by a myVector.push_back(vec) or myVector[i].push_back(x). To shortly describe it, it is something like an ArrayList in Java. So maybe use a #include &lt;vector&gt; public class A { std::vector&lt;std::vector&lt;int&gt;&gt; indices; //... }

http://stackoverflow.com/a/23936876
has comment: http://stackoverflow.com/comment/36873241
score: -1
upvote count: 0
has body: Reading the error message... Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 6000.0 frame rate, FrameSize=32768 bits Your video fromat is wrong. what video formats are supported by JMF.ps Well, let's try looking it up. The first link takes us to a table of supported formats.
type: Answer
answers question: http://stackoverflow.com/q/23936843
downvote count: 1

http://stackoverflow.com/a/23808863
answers question: http://stackoverflow.com/q/23806625
has comment: http://stackoverflow.com/comment/37482202
has comment: http://stackoverflow.com/comment/37489061
upvote count: 16
has comment: http://stackoverflow.com/comment/37352531
has comment: http://stackoverflow.com/comment/37480969
accepted answer of: http://stackoverflow.com/q/23806625
has comment: http://stackoverflow.com/comment/37480588
has comment: http://stackoverflow.com/comment/37353499
has comment: http://stackoverflow.com/comment/37471695
has comment: http://stackoverflow.com/comment/37480134
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37447786
has comment: http://stackoverflow.com/comment/37264441
has comment: http://stackoverflow.com/comment/37480882
has comment: http://stackoverflow.com/comment/36660175
has comment: http://stackoverflow.com/comment/37367614
has comment: http://stackoverflow.com/comment/36659373
has comment: http://stackoverflow.com/comment/37352921
type: Answer
has comment: http://stackoverflow.com/comment/36991410
has comment: http://stackoverflow.com/comment/37482062
has comment: http://stackoverflow.com/comment/36665651
has comment: http://stackoverflow.com/comment/36662475
has comment: http://stackoverflow.com/comment/37231313
has comment: http://stackoverflow.com/comment/37476507
downvote count: 0
has comment: http://stackoverflow.com/comment/37489194
has comment: http://stackoverflow.com/comment/37482985
score: 16
has comment: http://stackoverflow.com/comment/37351916
has body: Ensure You Are Unmarshalling the Correct Thing You need to unmarshal the content held onto by SOAP body, not the entire SOAP message. Below is what the code might look like: SOAPMessage sm = response; SOAPBody sb = response.getSOAPBody(); Document d = sb.extractContentAsDocument(); DOMSource source = new DOMSource(d); results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class); The result of sb.extractContentAsDocument is going to be a DOM that is equivalent to the following: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ns1:findEventsResponse xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ticketmaster.productserve.com/v2/soap.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;return xsi:type="ns1:Response"&gt; &lt;details xsi:type="ns1:Details"&gt; &lt;totalResults xsi:type="xsd:int"&gt;20662&lt;/totalResults&gt; &lt;totalPages xsi:type="xsd:int"&gt;414&lt;/totalPages&gt; &lt;currentPage xsi:type="xsd:int"&gt;1&lt;/currentPage&gt; &lt;resultsPerPage xsi:type="xsd:int"&gt;50&lt;/resultsPerPage&gt; &lt;/details&gt; &lt;results SOAP-ENC:arrayType="ns1:Event[50]" xsi:type="ns1:ArrayOfEvent"&gt; &lt;item xsi:type="ns1:Event"&gt; &lt;eventId xsi:type="xsd:int"&gt;1516682&lt;/eventId&gt; &lt;ticketmasterEventId xsi:type="xsd:string"&gt;18004C6E8D7218A8&lt;/ticketmasterEventId&gt; &lt;status xsi:type="xsd:string"&gt;onSale&lt;/status&gt; &lt;name xsi:type="xsd:string"&gt;The Art of the Brick&lt;/name&gt; &lt;url xsi:type="xsd:string"&gt;http://www.ticketmaster.ie/event/18004C6E8D7218A8?camefrom=CFC_UK_BUYAT&amp;amp;brand=[=BRAND=]&lt;/url&gt; &lt;eventDate xsi:type="xsd:string"&gt;2014-05-23 10:00:00&lt;/eventDate&gt; &lt;onSaleDate xsi:type="xsd:string"&gt;0000-00-00 00:00:00&lt;/onSaleDate&gt; &lt;preSaleDate xsi:type="xsd:string"&gt;0…

http://stackoverflow.com/comment/36830517
comment on: http://stackoverflow.com/a/23916344
type: Comment
has text: @user3659691 I was editing the question :) how about now? if it doesn't work, please edit the question and post the compiler error. it's difficult to find the problem otherwise
type: AnswerComment
score: 0

http://stackoverflow.com/q/23851328
accepted answer: http://stackoverflow.com/a/23851391
tagged with: servlets
has comment: http://stackoverflow.com/comment/36706762
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
score: 1
tagged with: tomcat
type: Question
has title: Need help to understand and implement basic web app security
favorite count: 0
has answer: http://stackoverflow.com/a/23851391
has comment: http://stackoverflow.com/comment/36707221
has comment: http://stackoverflow.com/comment/36706448
upvote count: 1
has comment: http://stackoverflow.com/comment/36707183
has comment: http://stackoverflow.com/comment/36707111
answer count: 1
has comment: http://stackoverflow.com/comment/36707062
tagged with: jakarta-ee
has body: I am learning basic web app security from "head first jsp and servlets". There is no code for the security app except web.xml and tomcat-users.xml settings. I followed the book and tried to make my own code, but I am not able to control access to my web app. Anyone can access it despite setting the roles in tomcat-users.xml and editing web.xml. Please help me to understand this and complete my example. I am using Eclipse kepler and Tomcat 6.0. Eclipse project: Expectation: Run start.html and click the submit button to access SecureServlet. Container should ask you for a login to access that servlet. If the login matches the one in web.xml settings, then you are shown the secret.jsp page. Output: There is no security. You can see secret.jsp without entering any login. Tomcat-users.xml: <role rolename="Admin"/> <role rolename="Member"/> <role rolename="Guest"/> <user username="jim" password="admin" roles="Admin, Member, Guest" /> <user username="tim" password="premium" roles="Member, Guest" /> <user username="fred" password="regular" roles="Guest" /> web.xml: Put the code in both tomcat's web.xml and my web app's web.xml to be safe. <web-resource-collection> WebSecurity /secretServlet GET POST </web-resource-collection> Admin Member Admin Member Guest BASIC SecretServlet SecretServlet foo.SecretServlet SecretServlet /SecretServlet Html start page: Enter here: Servlet: package foo; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class SecretServlet extends HttpServlet { private static final long serialVersionUID = 1L; public SecretServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher view = request.getRequestDispatcher("/jsp/secret.jsp"); view.forward(request, response); …
has comment: http://stackoverflow.com/comment/36706428
tagged with: java

http://stackoverflow.com/comment/36659403
comment on: http://stackoverflow.com/a/23825570
score: 0
has text: I use jaxB and @XmlTransient annotation
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23872537
tagged with: tags
score: -1
tagged with: area
answer count: 1
accepted answer: http://stackoverflow.com/a/23872959
favorite count: 0
has title: JSOUP - Java create a new tag in the DOM
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23872959
tagged with: jsoup
upvote count: 0
has body: I'm trying to add a new tag "area" between somes existing "area" on a Web page in local using Jsoup. My code is like : &lt;hmtl&gt; &lt;head&gt; ... &lt;/head&gt; &lt;body&gt; ...a lot of &lt;div&gt;.. &lt;map name="diagram_map"&gt; &lt;area id="area1" /&gt; &lt;!-- I would like to insert a new area here--&gt; &lt;area id="area2" /&gt; &lt;/map&gt; &lt;/body&gt; &lt;hmtl/&gt; I look before on the site if anyone had already the same issue but I didn't found. I know how to select an existing "area" by the id : Element target = doc.getElementById("area1"); Node target = doc.getElementById("area1"); But I don't know how to add a new "area" tag, I tried all the append, after/before but it write the new tag in the tag "area". Thanks by advance!

http://stackoverflow.com/a/23857370
downvote count: 1
score: 3
accepted answer of: http://stackoverflow.com/q/23857338
upvote count: 4
type: AcceptedAnswer
type: Answer
has body: If I understood you correctly, you want the program to ask the user to re-enter a right input after it fails. In that case you can do something like: boolean inputOk = false; while (!inputOk) { System.out.print("Define width: "); try { width = scanner.nextDouble(); inputOk = true; } catch (InputMismatchException e) { System.err.println("That's not a number!"); scanner.nextLine(); // This discards input up to the // end of line // Alternative for Java 1.6 and later // scanner.reset(); } } Note: you should only catch and retry for a InputMismatchException. The nextXxx methods throw other exceptions, and if you attempt to retry those, your application will go into an infinite loop.
answers question: http://stackoverflow.com/q/23857338

http://stackoverflow.com/comment/36595455
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23793001
has text: Yes I am looking into OP code as well. Give me some time please. May be the grids will help the OP to understand the x,y position.

hudson
type: Tag
tags question: http://stackoverflow.com/q/23793305
tag name: hudson

http://stackoverflow.com/q/23853027
has title: 'Starting Tomcat v7.0 Server at localhost' does not start
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23853085
accepted answer: http://stackoverflow.com/a/23853085
score: 1
tagged with: java
favorite count: 0
tagged with: eclipse
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/36709677
tagged with: apache
answer count: 1
tagged with: tomcat
has body: Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor. This is my problem. And I have tried all the possible solutions given in other threads but it does not work for me. The following is Console message : May 25, 2014 12:38:55 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Java\jdk1.8.0_05\bin;. May 25, 2014 12:38:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SampleHello' did not find a matching property. May 25, 2014 12:38:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Library' did not find a matching property. May 25, 2014 12:38:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:LibraryManagement' did not find a matching property. May 25,…

variables
tag name: variables
tags question: http://stackoverflow.com/q/23824674
tags question: http://stackoverflow.com/q/23929947
tags question: http://stackoverflow.com/q/23791242
type: Tag
tags question: http://stackoverflow.com/q/23851599
tags question: http://stackoverflow.com/q/23921678
tags question: http://stackoverflow.com/q/23878462
tags question: http://stackoverflow.com/q/23905312
tags question: http://stackoverflow.com/q/23892347
tags question: http://stackoverflow.com/q/23919534
tags question: http://stackoverflow.com/q/23905777
tags question: http://stackoverflow.com/q/23827427
tags question: http://stackoverflow.com/q/23847351
tags question: http://stackoverflow.com/q/23906717
tags question: http://stackoverflow.com/q/23849497

http://stackoverflow.com/comment/36803341
comment on: http://stackoverflow.com/q/23901942
score: 0
has text: @user3580294: I already went down that route, and was told the other thing.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36682654
comment on: http://stackoverflow.com/a/23838998
has text: ahh. That makes more sense
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36570964
score: 0
comment on: http://stackoverflow.com/q/23780119
type: Comment
type: QuestionComment
has text: Exception ClassNotFoundException is not compatible with throws clause in Test.demo().

http://stackoverflow.com/comment/36911002
type: Comment
comment on: http://stackoverflow.com/q/23828088
has text: Hello, as i had to change nearly every part of my code it needed some time, but here is the 2nd video =) ... https://www.youtube.com/watch?v=PlQizeYQebs ... so as you can see the thing what i called "non-deterministic behavior" is fixed - the landing point of the ball is nearly fix, and even the code is much easier to read. Many many thanks to you Martijn, you really helped me! There's still of course much work to do, now the ball is hopping which is a bit annoying but im looking forward to fix the issues and implement new stuff =) once again THANK YOU ^^
score: 0
type: QuestionComment

http://stackoverflow.com/a/23845702
type: Answer
has comment: http://stackoverflow.com/comment/36695013
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23845681
downvote count: 0
has body: 2nd is partially wrong. Static method can't directly access non static method. But, they can access non static methods on an object corresponding to the methods.

http://stackoverflow.com/comment/36660039
type: Comment
type: QuestionComment
has text: Smells a lot like a duplicate of http://stackoverflow.com/questions/23653778/nullpointerexception-accessing-views-in-oncreate (already voted to close as "not enough detail", cannot change the vote to "duplicate")
comment on: http://stackoverflow.com/q/23826874
score: 0

http://stackoverflow.com/q/23932128
tagged with: java
has answer: http://stackoverflow.com/a/23932518
upvote count: 1
type: Question
tagged with: mule
tagged with: mule-studio
accepted answer: http://stackoverflow.com/a/23932518
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: Is there a way to send a file via MuleClient. Kind of like how VM's work where you can send mock-up messages? MuleClient client = muleContext.getClient(); client.send("vm://testexception.in", payload, null); Update per Learner's suggestion: String inputFileName = "control_000001.dat"; String inputFileResourcePath = "TestFile/"; File inputFile = new File(Resources.getResource(inputFileResourcePath).toString(),inputFileName); MuleClient client = muleContext.getClient(); client.dispatch("file:///tmp/muletest/input?connector=ConnectorName", inputFile, null);
has title: How to send a file via MuleClient.send()
type: AnsweredQuestion

http://stackoverflow.com/comment/36744128
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23864354
has text: Show what? What your app is currently playing? Why not? But that is not what you asked is it? You asked if there was a way of finding out what any other app was playing. AFAIK, there is no way of finding the Player Objects in use by other applications. And if you can't find them then you can't figure out if they are playing anything can you. And even if you could find them, I don't believe there is an interface to determine what they are playing. But I presume you have already looked at this?

http://stackoverflow.com/comment/36913794
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23941274
type: AnswerComment
has text: Thank you for your help, you taught me the use-expression="true"

http://stackoverflow.com/q/23940262
type: Question
has comment: http://stackoverflow.com/comment/36907300
downvote count: 0
tagged with: assemblies
tagged with: .net-assembly
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: clr
has comment: http://stackoverflow.com/comment/36918541
has comment: http://stackoverflow.com/comment/36882680
has title: What's the recommended way to read/write a .NET assembly from Java?
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36978851
tagged with: java
has body: It seems like there are plenty of tools to emit .NET assemblies from .NET itself, but there doesn't seem to be a library in the JVM space to do the same. For instance, the Wikipedia for ASM only mentions: ASM is Java-centric at present, and does not currently have a backend that exposes other bytecode implementations (such as .NET bytecode, Python bytecode, etc.). I can't imagine that this issue hasn't come up before, but I'm unable to find any hints how this has been solved in the past.
tagged with: cil

http://stackoverflow.com/a/41763103
score: 0
type: Answer
has body: In case of blank or null value you can set some default value for that sql column in sql query itself so that it always returns that coulmn with value.
answers question: http://stackoverflow.com/q/23794944

reflection
tags question: http://stackoverflow.com/q/23787260
tags question: http://stackoverflow.com/q/23856196
tags question: http://stackoverflow.com/q/23891624
tags question: http://stackoverflow.com/q/23883716
tags question: http://stackoverflow.com/q/23829340
tags question: http://stackoverflow.com/q/23802159
tags question: http://stackoverflow.com/q/23892167
tags question: http://stackoverflow.com/q/23906871
tags question: http://stackoverflow.com/q/23831036
tags question: http://stackoverflow.com/q/23810199
tags question: http://stackoverflow.com/q/23923518
type: Tag
tags question: http://stackoverflow.com/q/23899785
tags question: http://stackoverflow.com/q/23827311
tags question: http://stackoverflow.com/q/23844509
tags question: http://stackoverflow.com/q/23836016
tags question: http://stackoverflow.com/q/23849509
tags question: http://stackoverflow.com/q/23858975
tags question: http://stackoverflow.com/q/23812356
tags question: http://stackoverflow.com/q/23832544
tags question: http://stackoverflow.com/q/23876399
tags question: http://stackoverflow.com/q/23854085
tags question: http://stackoverflow.com/q/23891410
tags question: http://stackoverflow.com/q/23848992
tags question: http://stackoverflow.com/q/23907615
tag name: reflection
tags question: http://stackoverflow.com/q/23783857

http://stackoverflow.com/a/23827983
has comment: http://stackoverflow.com/comment/36662182
score: 1
answers question: http://stackoverflow.com/q/23827773
downvote count: 0
has body: Below is the section of code (from what you gave) that you should be interested in. var address = ''; if (place.address_components) { address = [ (place.address_components[0] &amp;&amp; place.address_components[0].short_name || ''), (place.address_components[1] &amp;&amp; place.address_components[1].short_name || ''), (place.address_components[2] &amp;&amp; place.address_components[2].short_name || '') ].join(' '); } Essentially, what this part does, is it initializes the address variable (empty initially). Then, if the place object (presumably returned from Google) is not empty and contains components, if fills the address with all the separate components from place. The above code implies that the place object returned by Google provides you with three (3) components specifically: those at index positions 0, 1, and 2. You will have to figure out if these components, on their own, give you the separated information you need. To check that, try updating with the following code (notice the FOR loop I added): var address = ''; if (place.address_components) { address = [ (place.address_components[0] &amp;&amp; place.address_components[0].short_name || ''), (place.address_components[1] &amp;&amp; place.address_components[1].short_name || ''), (place.address_components[2] &amp;&amp; place.address_components[2].short_name || '') ].join(' '); for (var i = 0; i &lt; place.address_components.length; i++) { console.log('Component at index ' + i + ' is: ' + place.address_components[i].short_name; } } Run the updated code and check your console (available with Chrome) -- it will let you know which components were returned by Google, with their index number. Use that knowledge to achieve your goal.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36673721
score: 0
type: Comment
type: QuestionComment
has text: (If you must, look at the specs for JNI -- the C-language "native" interface stuff.)
comment on: http://stackoverflow.com/q/23832964

http://stackoverflow.com/comment/36717939
type: QuestionComment
comment on: http://stackoverflow.com/q/23856497
has text: @Pawal: agreed - drop those catches - NPE means you got something wrong coding, better crashed than crippled: http://pragmatictips.com/32
score: 0
type: Comment

http://stackoverflow.com/a/23819715
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23819348
upvote count: 1
has body: Here's one way to do it: The class should implement ActionListener and implement the actionPerformed() method. This is how you can capture button clicks and act on them. The buttons should invoke addActionListener so the clicks can be captured. In actionPerformed(), use e.getSource() to determine which button was clicked. Then act appropriately. For this example, b1 shows the panel. b2 and b3 hide the panel. I changed the button labels import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Button1 extends JApplet implements ActionListener { private JButton b1 = new JButton("show"), b2 = new JButton("hide"), b3 = new JButton("hide"); private JFrame frame = new JFrame(); private JPanel panel = new JPanel(); public void init() { Container cp = getContentPane(); cp.setLayout(new FlowLayout()); cp.add(b1); cp.add(b2); cp.add(b3); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); panel.add(new JLabel("foo")); frame.add(panel); frame.setSize(200,100); frame.setLocation(200,200); } public static void main(String[] args) { run(new Button1(), 200, 50); } public static void run(JApplet applet, int width, int height) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(applet); frame.setSize(width, height); applet.init(); applet.start(); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == b1) frame.setVisible(true); else frame.setVisible(false); } }

http://stackoverflow.com/comment/36677907
score: 0
type: Comment
has text: ` ProxyPreserveHost On ` an new directive.Read it here http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost
type: AnswerComment
comment on: http://stackoverflow.com/a/23835742

http://stackoverflow.com/a/23981063
has body: This issue has been fixed in UCanAccess 2.0.6.2. The code String sql = "CREATE TABLE TBL_fonts (" + "char_id int not NULL, " + "FW VARCHAR(255), " + "code VARCHAR(255), " + "character VARCHAR(255), " + "CONSTRAINT fontConst UNIQUE(FW,code), " + "PRIMARY KEY (char_id)" + ")"; Statement stmt = conn.createStatement(); stmt.executeUpdate(sql); now works as expected.
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23905122
downvote count: 0

http://stackoverflow.com/q/23840483
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23842272
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23841106
tagged with: session
has title: Why SessionMap is not instantiated?
has answer: http://stackoverflow.com/a/23841106
tagged with: struts2
answer count: 2
tagged with: struts2-interceptors
has body: The first time a member registers, the session needs to be set, which normally happens in login, so I thought I'd reuse the LoginAction without routing to it. But the sessionmap isn't getting instantiated. member logging in is: model.hibernate.Member@549c8a8c session map not instantiated RegisterAction public class RegisterAction extends ActionSupport implements SessionAware{ private String username, password, email; SessionMap&lt;String,Object&gt; sessionmap; MemberDAO mdao = new MemberDAO(); UsersDAO udao = new UsersDAO(); Users user = new Users(); Member member = new Member(); public RegisterAction() { this.email = ""; this.password = ""; this.username = ""; } // ...setters/getters... public String execute() { udao.addUserToDatabase(newUser); Member newMember = new Member(username, password); mdao.addMemberToDatabase(newMember); member = newMember; // perform first login (to set session member and role). // this could be done by sending to login action. // but then would have to track that it was first login. this is quick fix. LoginAction firstLogin = new LoginAction(member); firstLogin.setSession(sessionmap); String firstLoginAttempt = firstLogin.execute(); String resultString = ""; if(firstLoginAttempt.equals(SUCCESS)){resultString = SUCCESS;} else{ addActionError("First login attempt didnt work"); resultString = ERROR; } return resultString; // send user to quiz or show error }else { // cant add user addActionError("Username already taken. Please choose another."); return ERROR; } } public void setSession(Map&lt;String, Object&gt; map) { sessionmap=(SessionMap) map; } } LoginAction public class LoginAction extends ActionSupport implements SessionAware{ private String username, password; MemberDAO mdao = new MemberDAO(); Member member = new Member(); SessionMap&lt;String,Object&gt; sessionmap; public LoginAction() { this.password = ""; this.username = ""; } public LoginAction(Member m) { this.member = m; this.password = member.getPassword(); this.username = me…
downvote count: 0
has answer: http://stackoverflow.com/a/23842272

http://stackoverflow.com/comment/36808649
type: Comment
comment on: http://stackoverflow.com/q/23876675
has text: First I code like that Cipher cipher=cipher.getInstance(algosWithMode[k],**"BC"**); and AES is faster than BLOWFISH. And than I wonder if there is wrong bouncy implementation and I changed code Cipher cipher=cipher.getInstance(algosWithMode[k],**"sunJCE"**); but result does not changed.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36775035
type: Comment
comment on: http://stackoverflow.com/a/23887495
has text: And yes, with JList or JTable glitch is still there. As i said before - this bug is not scroll content -related, but some drawing or even native stuff -related.
score: 0
type: AnswerComment

slidingmenu
tag name: slidingmenu
type: Tag
tags question: http://stackoverflow.com/q/23822507

http://stackoverflow.com/q/23896886
duplicate of: http://stackoverflow.com/q/7745693
has title: Scalac compains "object lang is not a member of package org.apache.commons"
answer count: 0
has comment: http://stackoverflow.com/comment/36793607
type: UnansweredQuestion
tagged with: scala
tagged with: java
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/36793472
has body: I'm trying to add Apache commons-lang to my Gatling project (a load-testing tool written in Scala). I dropped the jar into Gatling's lib/ directory, which gets added to the classpath, but I'm still getting the following compile error from my import statements: object lang is not a member of package org.apache.commons The code throwing the error: import org.apache.commons.lang.StringEscapeUtils The last couple lines of the run script: CLASSPATH="$GATLING_HOME/lib/*:$GATLING_CONF:$GATLING_HOME/user-files:${JAVA_CLASSPATH}" java $JAVA_OPTS -cp $CLASSPATH io.gatling.app.Gatling "$@" What am I missing? Every other jar in the lib/ directory gets loaded fine.
linked to: http://stackoverflow.com/q/7745693
tagged with: gatling
score: 0

http://stackoverflow.com/q/23829926
downvote count: 0
answer count: 7
favorite count: 0
tagged with: instanceof
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23830110
has answer: http://stackoverflow.com/a/23830116
upvote count: 6
has body: Let's say I have the following class hierarchy: public interface Result { } public class Failure implements Result { private String msg; public Failure(String msg) { this.msg = msg; } @Override public String toString() { return msg; } } public class Success implements Result { private int time, count; public Success(int time, int count) { this.time = time; this.count = count; } public int getTime() { return time; } public int getCount() { return count; } @Override public String toString() { return time + ", " + count; } } which basically defines an interface Result with two concrete classes: Success and Failure. Then, I have a calculate method that returns a result and based on the result I should do something, for example: Result result = calculate(); I have several options to figure it out the concrete class. The most obvious one is to use instance of: if (result instanceof Success) { int time = result.getTime(); int count = result.getCount(); // Do something with them } else { throw new RuntimeException(result.toString()); } In programming languages like Scala that support pattern matching, I could use a match like case Success =&gt; case Failure =&gt; but since Java doesn't support it, I'm not sure what's the best to do. I can for example extend the Result interface as follows: public interface Result { public boolean isSuccess(); public boolean isFailure(); public Success asSuccess(); public Failure asFailure(); } and then write the client code as: if (result.isSuccess()) { Success success = result.asSuccess(); int time = success.getTime(); int count = success.getCount(); // Do something with them } else { throw new RuntimeException(result.toString()); } but in this case the interface is bound to concrete classes which is not good either. What is the best way to represent such cases? I really don't want to put the processing code in the Result hierarchy as it really up to the client to get the data and do whatever they want, so polymorphic dispatch solutions ma…
has answer: http://stackoverflow.com/a/23830094
has answer: http://stackoverflow.com/a/23830369
tagged with: java
has answer: http://stackoverflow.com/a/23834503
score: 6
has title: Alternatives for instanceof when processing concrete types in Java
has answer: http://stackoverflow.com/a/23830303
type: Question
tagged with: inheritance
has answer: http://stackoverflow.com/a/23830285

http://stackoverflow.com/comment/36813794
type: Comment
comment on: http://stackoverflow.com/a/23907099
type: AnswerComment
score: 1
has text: thanks for answer. i tried to add your config but the result was the same err. most android specific rules like `-keep public class * extends android.app.Activity` should come from `Android/.../tools/proguard/proguard-android(-optimize).txt`

http://stackoverflow.com/q/23818713
has comment: http://stackoverflow.com/comment/36644088
downvote count: 4
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: cannot figure out the next step
has body: Hi guys so I'm trying to figure out how to get this code to make a bank account but I I only get zero's for answers for the balance and all that, could you help me out. if your wondering I did not allow for an input. package exercise12; public class exercise12 { public static void main(String[] args) { Account myaccount = new Account(0, 0, 0, 0); System.out.println("my initial balance is " + myaccount.getBalance()); System.out.println("depositing 32.19"); myaccount.deposit(32.19); System.out.println("now my balance is " + myaccount.getBalance()); System.out.println("withdrawing 90.00"); myaccount.withdraw(90.00); System.out.println("now my balance is " + myaccount.getBalance()); System.out.println("withdrawing 10.00"); myaccount.withdraw(10.00); System.out.println("now my balance is " + myaccount.getBalance()); } } class Account { public Account (double a, double b, double c, double d) { deposit = a; withdraw = b; account = c; Balance = d; } public void deposit(double d) { // TODO Auto-generated method stub } Double Balance; Double withdraw; Double deposit; Double account; public void setmoney(double Balance, double withdraw, double deposit, double account){ setBalance(Balance); setwithdraw(withdraw); setdeposit(deposit); setaccount(account); } public double getdeposit() { return deposit; } public double withdraw(double d) { return withdraw; } public double getaccount() { return account; } public double getBalance() { Balance = account - withdraw + deposit; return Balance; } public void setaccount(double accountmoney) { } public void setdeposit(double depositmoney) { } public void setwithdraw(double withdrawmoney) { } public void setBalance(double balancemoney) { } }
tagged with: java
has answer: http://stackoverflow.com/a/23818755
type: Question
upvote count: 0
score: -4

http://stackoverflow.com/a/23836262
answers question: http://stackoverflow.com/q/23834809
score: 0
has body: A provided scope dependency must be on the classpath at runtime, but isn't required for compilation. If you require the dependency for compilation, which it sounds like you do, then you must not have a provided scope. Typically, libraries that are provided have compile scoped interface libraries that are used for compilation, and only the implementation is provided at runtime.
type: Answer

http://stackoverflow.com/comment/36762312
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23875443
has text: protected void onPostExecute() It does not like when I'm trying to change that to other then void
score: 0

http://stackoverflow.com/a/23795246
type: Answer
answers question: http://stackoverflow.com/q/23795141
has body: That is a public method for the View class. If your class implements OnClickListener, you can use something like this (for example in your Activity's onCreate method): Button yourButton = (Button) findViewById(R.id.your_button_id); yourButton.setOnClickListener(this); To set a click listener to yourButton. In that case when you click yourButton, the view arg0 in onClick would be yourButton. In onClick you can do: switch(arg0.getId()){ case R.id.your_button_id: // do stuff break; //repeat for other buttons } This allows you to set click listeners within your class for multiple buttons. All you have to do is set the classes on click listener to the button the same way you did for yourButton.
score: 0

http://stackoverflow.com/comment/36629275
comment on: http://stackoverflow.com/q/23798229
score: 1
has text: You can read the file line-by-line (or in chunks) and append it to the text area. This way the visible part of the text area is filled quickly and the rest is done "behind the scene".
type: Comment
type: QuestionComment

osgi
tags question: http://stackoverflow.com/q/23902577
type: Tag
tags question: http://stackoverflow.com/q/23848387
tags question: http://stackoverflow.com/q/23780546
tags question: http://stackoverflow.com/q/23930526
tag name: osgi
tags question: http://stackoverflow.com/q/23881432
tags question: http://stackoverflow.com/q/23872779

http://stackoverflow.com/comment/36764048
comment on: http://stackoverflow.com/a/23881540
type: AnswerComment
has text: Upvoted for explanation of `this` vs `getApplicationContext()`. Other than that, the code is missing the part that removes a RelativeLayout.
type: Comment
score: 1

http://stackoverflow.com/comment/37004689
score: 0
type: AnswerComment
has text: Yes closing each file
type: Comment
comment on: http://stackoverflow.com/a/23931568

http://stackoverflow.com/q/23834809
answer count: 1
type: UnansweredQuestion
tagged with: maven
has title: How do I add a provided jar to my Run Configuration
has body: My maven pom defines a dependency on foo.jar with scope:provided. Demo.java is located under src/main/java. It imports classes provided by foo. If I create a run configuration for this class, running the class throws java.lang.NoClassDefFoundError TestDemo.java is located under src/main/test. It is nothing but a wrapper around Demo. If I create a run configuration for this class, everything just works. If I update that working configuration, changing the main class to Demo, I see the java.lang.NoClassDefFoundError again. Is there a better way to run my main classes within the IDE than hacking wrappers into src/main/test ?
tagged with: java
has answer: http://stackoverflow.com/a/23836262
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/36677104
score: 0

http://stackoverflow.com/comment/36690914
score: 2
has text: use .equals method instead of == in string comparision.
type: Comment
comment on: http://stackoverflow.com/q/23843309
type: QuestionComment

http://stackoverflow.com/q/23843719
type: Question
score: 1
has body: My goal is to inject the cell with =HYPERLINK("text", "link") So I did this with: row.getCustomElements().setValueLocal("item", "=hyperlink(\""+a.getAttribute("href")+"\",\""+tds.get(1).getText().replace("=","")+"\")"); But I got error, it won't let me to use =, equal sign, next to hyperlink and I have no idea how to workaround this. Please help. Thanks.
tagged with: java
tagged with: gdata-api
downvote count: 0
tagged with: spreadsheet
favorite count: 0
has title: In Google Spreadsheet API, how to pass equal sign as value?
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/36796755
score: 1
type: QuestionComment
has text: @user3580294 I'm not familiar with that abbreviation.
comment on: http://stackoverflow.com/q/23898541
type: Comment

http://stackoverflow.com/comment/101104851
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23868527
has text: https://www.iso20022.org/sites/default/files/documents/messages/camt/schemas/camt.053.001.08.zip This is the official XSD for CAMT.053 others can be found on https://www.iso20022.org/payments_messages.page

http://stackoverflow.com/comment/106164962
score: 2
comment on: http://stackoverflow.com/a/23861497
has text: I'm trying to make the point that the exercise the question asker has been given isn't trying to teach palindromes... it's trying to teach critical thinking and string manipulation. It would be easier to list real world applications that didn't require critical thinking and string manipulation in development than to list those that do.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/54118405
has text: I want to remove this question, do you know how to do this?
comment on: http://stackoverflow.com/a/23894944
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23833380
has answer: http://stackoverflow.com/a/23833423
has body: I am inheriting Exception class for creating my own exception. Something like the code below public class ApplicationException extends Exception { ApplicationException(String errorMessage) { super(errorMessage); } } The problem is that the stacktrace is always empty. The below code will write nothing to the console. ApplicationException(String errorMessage) { super(errorMessage); System.out.println(this.getStackTrace()); } I don't understand why it is empty because the Throwable(String) is calling fillInStackTrace method. Is there a way to fill in Stack or is it something else that I should do?
has comment: http://stackoverflow.com/comment/36676296
tagged with: java
has comment: http://stackoverflow.com/comment/36671674
has comment: http://stackoverflow.com/comment/36671562
answer count: 3
possible better answer: http://stackoverflow.com/a/23833517
has comment: http://stackoverflow.com/comment/36671966
downvote count: 0
has answer: http://stackoverflow.com/a/23833517
accepted answer: http://stackoverflow.com/a/23833511
favorite count: 0
linked to: http://stackoverflow.com/q/4479683
tagged with: exception
has comment: http://stackoverflow.com/comment/36701669
has comment: http://stackoverflow.com/comment/36671668
score: 2
type: AnsweredQuestion
upvote count: 2
has title: Why am I getting an empty stacktrace while creating my own exception?
tagged with: stack-trace
has answer: http://stackoverflow.com/a/23833511
type: Question

http://stackoverflow.com/comment/36920907
has text: It works! Thank you, but....still, convertNet.txt doesn't contain anything. It's still a blank...file. However, i write String line = reader.readline() into the file, it works. And it contain something the same with the testttt.net, which is not the result that i want to...
comment on: http://stackoverflow.com/a/23923479
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23824742
score: 2
accepted answer of: http://stackoverflow.com/q/23819968
type: AcceptedAnswer
downvote count: 0
has body: Your CSS will break because your HTML will change. Struts2 uses Themes to generate the HTML for each tag; the default theme is XHTML. Just use SIMPLE theme, that will generate ONLY the tag without any side data (&lt;label&gt; for example). It can be applied to a single tag, to a form, or globally at application level. Then try &lt;s:form action="User_login" theme="simple"&gt;` ; if you are satisfied with the result, set it globally in struts.xml with &lt;constant name="struts.ui.theme" value="simple" /&gt;
has comment: http://stackoverflow.com/comment/36687497
upvote count: 2
answers question: http://stackoverflow.com/q/23819968
type: Answer

http://stackoverflow.com/comment/36723176
type: Comment
type: AnswerComment
has text: @Eng.Lolina No, it only copies them. To move files you would have to use `Files.move()`
score: 0
comment on: http://stackoverflow.com/a/23859921

http://stackoverflow.com/q/23917603
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
tagged with: layout-manager
has answer: http://stackoverflow.com/a/23917636
has title: Resizing Components with JFrame
accepted answer: http://stackoverflow.com/a/23917636
score: 0
tagged with: swing
has body: I have a JFrame that contains two JPanel containers. In the below picture one panel is blue, the other contains a JTable. As can be seen, when I resize the frame, the frame (the blank gray area) expands. I would like the table panel to expand to fill this area. IMG http://i61.tinypic.com/2evujdj.png[/IMG] What layout managers will accomplish this?

http://stackoverflow.com/comment/36671368
score: 1
has text: This doesn't address the exception being raised before this loop.
type: AnswerComment
comment on: http://stackoverflow.com/a/23832966
type: Comment

struts2
tags question: http://stackoverflow.com/q/23796325
tags question: http://stackoverflow.com/q/23893486
tags question: http://stackoverflow.com/q/23899416
tags question: http://stackoverflow.com/q/23919226
tags question: http://stackoverflow.com/q/23882198
tags question: http://stackoverflow.com/q/23829949
tags question: http://stackoverflow.com/q/23890430
tags question: http://stackoverflow.com/q/23812711
tags question: http://stackoverflow.com/q/23789198
tags question: http://stackoverflow.com/q/23910345
tags question: http://stackoverflow.com/q/23929229
tags question: http://stackoverflow.com/q/23934355
tag name: struts2
tags question: http://stackoverflow.com/q/23934893
tags question: http://stackoverflow.com/q/23846474
tags question: http://stackoverflow.com/q/23859402
tags question: http://stackoverflow.com/q/23820026
tags question: http://stackoverflow.com/q/23871707
tags question: http://stackoverflow.com/q/23915024
tags question: http://stackoverflow.com/q/23819733
tags question: http://stackoverflow.com/q/23840483
tags question: http://stackoverflow.com/q/23914012
tags question: http://stackoverflow.com/q/23862760
tags question: http://stackoverflow.com/q/23844765
tags question: http://stackoverflow.com/q/23936580
tags question: http://stackoverflow.com/q/23810026
tags question: http://stackoverflow.com/q/23780282
tags question: http://stackoverflow.com/q/23939566
tags question: http://stackoverflow.com/q/23827599
tags question: http://stackoverflow.com/q/23880515
tags question: http://stackoverflow.com/q/23819968
tags question: http://stackoverflow.com/q/23911217
tags question: http://stackoverflow.com/q/23827729
type: Tag
tags question: http://stackoverflow.com/q/23920047

http://stackoverflow.com/comment/36619780
comment on: http://stackoverflow.com/q/23806378
has text: Simply try `labelWord.setText(labelWord.getText()+myArray[j]);`
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/53241110
has body: The first thing that you need to do is make sure the first node you create is the oldest so it should be the first to be removed from the Queue based on First In First Out (FIFO) principle to archive this you might need to modify you're add method to something like this, by the way this example is based on single linked list implementation. void add(char new_data) { /* 1. alloc the Node and put data*/ Node new_Node = new Node(new_data); /* 2. Make next of new Node as head */ new_Node.next = head; /* 3. Move the head to point to new Node */ head = new_Node; } then you will need a remove method which will remove the oldest node on the list first remember in Queue the order of remove is First In First Out (FIFO) that being said this remove method should help you void remove() { // Store head node Node temp = head, prev = null; // If head node itself holds the key to be deleted if (temp != null ) { head = temp.next; // Changed head return; } // Search for the key to be deleted, keep track of the // previous node as we need to change temp.next while (temp != null) { prev = temp; temp = temp.next; } // If key was not present in linked list if (temp == null) return; // Unlink the node from linked list prev.next = temp.next; } This worked for me on my linked list
answers question: http://stackoverflow.com/q/23865967
score: 0
type: Answer

http://stackoverflow.com/comment/36821207
type: QuestionComment
comment on: http://stackoverflow.com/q/23910822
type: Comment
score: 0
has text: I'm considering the change in order to avoid inheritance and stick to the Annotation based programming pattern. It's not a discussion about which can work, rather which is more appropiate to give it to developers.

http://stackoverflow.com/q/23783248
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/23783558
accepted answer: http://stackoverflow.com/a/23987761
has comment: http://stackoverflow.com/comment/36577018
type: AnsweredQuestion
tagged with: sql
tagged with: composite-primary-key
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36577034
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/23987761
has comment: http://stackoverflow.com/comment/36576759
has comment: http://stackoverflow.com/comment/36576914
tagged with: primary-key
tagged with: java
answer count: 3
has title: Use Objects as Primary keys and Composite keys in JPA
possible better answer: http://stackoverflow.com/a/23784308
has answer: http://stackoverflow.com/a/23784308
has body: I want to know whetheris it a GOOD practise to use Objects as composite keys in JPA. For example I have few composite keys and the are foreign keys from another tables and mapped with them. Composite Class @Embeddable public class CashInstrumentComposite implements Serializable { private static final long serialVersionUID = -6065538857637001219L; @Column(name = "instrument_id", nullable = false) private String instrumentId; @OneToOne @JoinColumn(name = "company_id") private Company companyId; @Column(name = "instrument_type", nullable = true) @Enumerated(EnumType.STRING) private InstrumentType instrumentType; @Column(name = "batch_no", nullable = false) private String batchNumber; } Entity Class @Entity @Table(name = "bank_corporate_cash_instrument") public class CashInstrument extends Model { /* serial version id. */ private static final long serialVersionUID = 8360452197690274885L; /* specify the composite key */ @EmbeddedId private CashInstrumentComposite compositeId; I can persist using this without any problem, BUT I read this, http://docs.oracle.com/javaee/6/tutorial/doc/bnbqa.html#bnbqf It says there that primarykey should be one of Java primitive types Java primitive wrapper types java.lang.String java.util.Date (the temporal type should be DATE) java.sql.Date java.math.BigDecimal java.math.BigInteger So what did I do wrong here? Please explain.Thank You

http://stackoverflow.com/comment/36583607
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23786460
has text: hmm, this looks promising.
score: 0

http://stackoverflow.com/q/23830434
has title: NullPointerException while trying to read int from file with Scanner
downvote count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/36665954
answer count: 1
has comment: http://stackoverflow.com/comment/36665811
favorite count: 0
has answer: http://stackoverflow.com/a/23830636
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/36666020
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36665903
has comment: http://stackoverflow.com/comment/36666107
upvote count: 0
has comment: http://stackoverflow.com/comment/36665940
tagged with: java
has body: I am trying to read information from a file. The first thing in the file is an integer, but when I try to read it I get a NullPointerException. I also tried reading the first thing in the file as a string, and again I got a NullPointerException. I then added the print statement that is in the catch statement when I connect the file. When I run the code, that print statement is evaluated. What is the source of my issue? Thanks. private boolean collectSystem(String loc) { Scanner fileIn = null; try { fileIn = new Scanner(new File(loc)); } catch (FileNotFoundException e) { System.out.println("File not found, IntakeSystem"); } // Determine number of equations try { n = fileIn.nextInt(); } catch (InputMismatchException e) { return false; } // Collect the text in the file as a string String info = ""; while (fileIn.hasNextLine()) { info = info + fileIn.nextLine(); } fileIn.close(); //Separate equations in file String[] eqns = new String[n]; int start = 0; int end = info.indexOf(";"); for (int i = 0; i &lt; n; i++) { if(end == -1) return false; String nextLine = info.substring(start, end); eqns[i] = nextLine; start = end + 1; end = info.indexOf(";", start); } for (int i = 0; i &lt; n; i++) { System.out.println(eqns[n]); } return true; }
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36666006
has comment: http://stackoverflow.com/comment/36665932

http://stackoverflow.com/comment/36710198
comment on: http://stackoverflow.com/q/23853320
type: QuestionComment
has text: where `sinsertMoney` is declared and initialized?
score: 0
type: Comment

http://stackoverflow.com/comment/36829166
type: Comment
has text: The OP does not want to sort the first 300 elements in the array, he wants to obtain the largest 300 elements.
comment on: http://stackoverflow.com/a/23915865
type: AnswerComment
score: 1

http://stackoverflow.com/a/23925122
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23925076
has body: The best way to process web application files is after uploading completely and saving in your server as a file. Streaming file processing should be avoided because HTTP model is designed to be a Request, Response model. You shouldn't ask the Web Client wait until you finish the file processing. Best thing to do is upload file to a directory and send the Web Client a upload success message, with possibly a link where the end user can check for the results in the future. And having a scheduled task to process the files in the uploaded directory and post the results in the results page. This way web application will not have unnecessary delays and scale-able.

http://stackoverflow.com/comment/36811852
type: QuestionComment
comment on: http://stackoverflow.com/q/23906402
score: 0
has text: Make sure your asset folder is in the class path.
type: Comment

http://stackoverflow.com/a/23834847
upvote count: 1
answers question: http://stackoverflow.com/q/23834716
downvote count: 0
type: Answer
score: 1
has body: Except for this tool that converts from your package explorer in Eclipse to a class hierarchy, I don't think there are any tools that convert from a .jar extension unless you first import the file and then generate the diagram. ALSO: Eclipse plugin for generating a class diagram EDIT AGAIN: If you want to generate the uml diagram, you need to use the source file, as the .jar file is a compilation of java files, usually in the form of .class compiled Java programs, as per the usual, developers that aren't developing open source don't like to propagate their source code. You can extract the contents of the .jar file and hope that the .java files are included, but if they aren't, you won't be able to generate a class diagram as it has already been translated into its low level byte code to be run on the virtual machine. If the .java files are included, you can generate a diagram using the tool linked, but otherwise, you won't be able to.

http://stackoverflow.com/a/23853615
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36710870
answers question: http://stackoverflow.com/q/23853601
has comment: http://stackoverflow.com/comment/36710844
accepted answer of: http://stackoverflow.com/q/23853601
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36710778
has body: Just simply read online(So many good answers), and if you dont understand: You need to add this in the Dogs class, simply do: @Override public boolean equals(Object obj) { if (!obj instanceof Dogs){ return false; } return this.dogKind.equals(((Dogs)obj).getDogKind()); } The first part makes sure that the object given to the method is not null or from a different class. The second part simply uses String equals, to check if the Strings are the same or not.
has comment: http://stackoverflow.com/comment/36710847
has comment: http://stackoverflow.com/comment/36710774

http://stackoverflow.com/q/23886986
has comment: http://stackoverflow.com/comment/36773809
downvote count: 7
type: Question
upvote count: 0
score: -7
has comment: http://stackoverflow.com/comment/36773803
has title: How to add java objects into an array
has comment: http://stackoverflow.com/comment/36773873
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36773823
tagged with: object
has body: I have few radio button objects and I want to add them to an array of that type. I was trying to do something like this: JRadioButton b1 = new JRadioButton(); JRadioButton[] radioarray; radioarray = new JRadioButton[2]; radioarray[0] = b1; But its not working. Any ideas ?
has comment: http://stackoverflow.com/comment/36774434
tagged with: java
has answer: http://stackoverflow.com/a/23889006

http://stackoverflow.com/a/23819158
type: Answer
has body: I'm not sure where the problem was since your code did not compile. This code works (rock solid) reliably. In this GUI, I would tend to replace ImgPanel with a JLabel, YMMV. import java.awt.*; import java.awt.image.*; import javax.swing.*; import java.util.ArrayList; import javax.imageio.ImageIO; import java.net.URL; public class Main { public void show(ArrayList&lt;BufferedImage&gt; images){ int i = 0; for(BufferedImage b : images){ JFrame frame = new JFrame("Execution: "+i); frame.add(new ImgPanel(b)); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationByPlatform(true); frame.setVisible(true); i++; } } public class ImgPanel extends JPanel { BufferedImage i; public ImgPanel(BufferedImage image) { i = image; } @Override public Dimension getPreferredSize() { return new Dimension(i.getWidth(), i.getHeight()); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(i, 0, 0, this); } } public static void main(String[] args) throws Exception { final ArrayList&lt;BufferedImage&gt; images = new ArrayList&lt;BufferedImage&gt;(); String[] urlStrings = { "https://i.sstatic.net/XZ4V5.jpg", "https://i.sstatic.net/7bI1Y.jpg", "https://i.sstatic.net/OVOg3.jpg", "https://i.sstatic.net/lxthA.jpg" }; for (String s : urlStrings) { URL url = new URL(s); BufferedImage bi = ImageIO.read(url); images.add(bi); } Runnable r = new Runnable() { public void run() { Main m = new Main(); m.show(images); } }; SwingUtilities.invokeLater(r); } }
answers question: http://stackoverflow.com/q/23818526
score: 4
has comment: http://stackoverflow.com/comment/36644787
has comment: http://stackoverflow.com/comment/36644755
upvote count: 4
has comment: http://stackoverflow.com/comment/36645734
downvote count: 0

http://stackoverflow.com/comment/36970505
score: 1
comment on: http://stackoverflow.com/a/23991508
has text: Okay, so you have answered your own question and the bounty is gone. Anyway, as a side note and because I wanted to try and help you: Do you know of any Exchange Server test environments available via internet for developers who do not have access to a "real" Exchange corporate server?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23846205
tagged with: java
has answer: http://stackoverflow.com/a/23985636
tagged with: mono
has body: I have somoe C# source code that I want to be available for java applications under linux OS. How can I call some C# method from java code? I have found http://www.mono-project.com/Java but this looks like writing java code in .net environment. It is not what I look for. Rather I need to create new java library that will expose all functionality from C# code, the new library must be executed in pure java environment. Maybe that is possible with IKVM I am not sure.
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23943999
score: 0
has comment: http://stackoverflow.com/comment/36701792
tagged with: linux
possible better answer: http://stackoverflow.com/a/23985636
has answer: http://stackoverflow.com/a/23862258
has title: Call C# mono code from java under linux
answer count: 4
has answer: http://stackoverflow.com/a/23996156
accepted answer: http://stackoverflow.com/a/23996156
type: AnsweredQuestion

http://stackoverflow.com/a/23910684
upvote count: 1
answers question: http://stackoverflow.com/q/23910539
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23910539
has body: What you are getting is the default value of DATE in Calendar class. Which is 5 public final static int DATE = 5; But when I print the dates from your code, looks like it is fine. Date toDate = new Date(114, 5, 30); Calendar calendar = Calendar.getInstance(); Calendar calendarTo = Calendar.getInstance(); calendar.setTime(toDate); calendarTo.setTime(toDate); calendarTo.add(Calendar.DATE, 1); System.out.println(toDate);//Mon Jun 30 00:00:00 IST 2014 System.out.println(calendarTo.getTime());//Tue Jul 01 00:00:00 IST 2014
type: Answer

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/23915478

http://stackoverflow.com/comment/36707435
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23851695
has text: return "xPos="+xPos+", yPos="+yPos+", dist="+dist;
type: AnswerComment

http://stackoverflow.com/comment/36593964
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23792433
has text: by using mutators: setters and getters

http://stackoverflow.com/comment/36848073
type: AnswerComment
comment on: http://stackoverflow.com/a/23903663
score: 0
has text: @IHazABone I asked for info as you had not provided enough in question already. Wish you all the best. No idea about your issue.
type: Comment

http://stackoverflow.com/comment/36735935
type: AnswerComment
score: 0
has text: That was what I suspected.
type: Comment
comment on: http://stackoverflow.com/a/23858779

http://stackoverflow.com/q/23872896
has comment: http://stackoverflow.com/comment/36747378
type: Question
has comment: http://stackoverflow.com/comment/36746924
has answer: http://stackoverflow.com/a/23873225
answer count: 1
has body: In some situations (automated testing) I need to screencast my display(s) to video file(s), but currently i can only save a series of PNG files using Robot and ImageIO classes, I know there are other third party programs to convert this set of image files into a video file but I want to make it in my code without a need to third party applications, so how to convert from a series of PNG files into a video file in any format ? Thanks in advance.
type: UnansweredQuestion
has title: How to screencast to a video file using java?
score: 0
tagged with: java

http://stackoverflow.com/comment/36699979
comment on: http://stackoverflow.com/q/23847988
has text: @MadProgrammer do you have any idea about this ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23789957
has answer: http://stackoverflow.com/a/23812609
has comment: http://stackoverflow.com/comment/36589218
has answer: http://stackoverflow.com/a/23790353
accepted answer: http://stackoverflow.com/a/23790353
has comment: http://stackoverflow.com/comment/36589127
type: AnsweredQuestion
has title: sql query for filtering record in jsp
downvote count: 0
has comment: http://stackoverflow.com/comment/36589606
has comment: http://stackoverflow.com/comment/36589255
score: 1
tagged with: java
has body: Hi this sql query is not working in some conditions.Whenever i write query += " Price<? and Size<? and Type=?"; out of the if statement then it is working but when i put within the if statement then it doesn't work. And when i am trying print the variable query when it is outside the if statement then it show the message like this select * from products where Price<? and Size<? and Type=? I am not able to understand it please help me out this is the whole code` public List<Products> Filter_Items(String[] Brand, String[] Flavour,float Price,float Size,String Type) { ResultSet rs; List<Products> data = null; PreparedStatement stmt; try { StringBuilder param = new StringBuilder(); if (Brand != null) { for (String str : Brand) { param.append("'").append(str).append("', "); } } StringBuilder param1 = new StringBuilder(); if (Flavour != null) { for (String str : Flavour) { param1.append("'").append(str).append("', "); } } String prm = param.toString().length() > 2 ? param.toString() .substring(0, param.toString().length() - 2) : null; String prm1 = param1.toString().length() > 2 ? param1.toString() .substring(0, param1.toString().length() - 2) : null; String query = "select * from products where "; if(Price!=0 && Size!=0 && Type!=null && prm != null && prm1 != null) { query+="Brand in (" + prm + ") and Flavour in (" + prm1 + ") and"; query += " Price<? and Size<? and Type=?"; } System.out.println("---------------------------------------------"); System.out.println(query); stmt = DataBaseConnection.DBConn.getConnection().prepareStatement(query); stmt.setFloat(1, Price); stmt.setFloat(2, Size); stmt.setString(3, Type); rs = stmt.executeQuery(); if (rs != null) { data = new ArrayList<Products>(); while (rs.next()) { Products p = new Products(); p.setTitle(rs.getString("Ttile")); p.setCategory(rs.getString("Category")); p.setSubCategory(rs.getString("SubCategory")); p.setSubCategoryTwo(rs.getString("SubCategorytwo")); p.setPrice(rs.getInt("Price")); p.setFlavour(rs.getString(…
type: Question
has comment: http://stackoverflow.com/comment/36589815
answer count: 2
has comment: http://stackoverflow.com/comment/36589206
has comment: http://stackoverflow.com/comment/36589133
has comment: http://stackoverflow.com/comment/36589320
has comment: http://stackoverflow.com/comment/36589520
has comment: http://stackoverflow.com/comment/36589451
upvote count: 1
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36589303
possible better answer: http://stackoverflow.com/a/23812609
favorite count: 0
has comment: http://stackoverflow.com/comment/36589494

http://stackoverflow.com/comment/36660710
has text: You have the answer in your question *There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server*
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23827820
score: 2

http://stackoverflow.com/comment/36749170
type: Comment
type: QuestionComment
has text: @user3616949 You are providing a null Typeface, with a bold flag. You should be doing `redo.setTypeface(redo.getTypeface(), Typeface.BOLD)`.
comment on: http://stackoverflow.com/q/23873698
score: 0

http://stackoverflow.com/a/23912182
answers question: http://stackoverflow.com/q/23912035
upvote count: 5
has comment: http://stackoverflow.com/comment/36822369
has comment: http://stackoverflow.com/comment/36823036
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It depends on how your data look like. Are there repeating entries, or do they change only slowly, or what? If so, you can try to compress chunks of your data and decompress when needed. The bigger the chunks, the more memory you can save and the worse the speed. IMHO no good deal. You could also save the data compressed and decompress in memory. Otherwise, i.e., in case of no regularities, you'll need at least log(9) / log(2) = 3.17 bits per entry and there's nothing what could improve it. You can come pretty close to this value by packing 5 numbers into a short. As 9**5 = 59049 &lt; 65536 = 2**16, it fits nearly perfectly. You'll need 3.2 bits per number, no big win. Packing of five number is given via this formula a + 9 * (b + 9 * (c + 9 * (d + 9 * e))) and unpacking is trivial via a precomputed table. UPDATE after question update Further information: I just did a little experimenting, and it turns out, that on average 2.14 consecutive numbers have the same value. There are 1 zero, 154 ones, 10373 twos, 385990 threes, 8146188 fours, 85008968 fives, 265638366 sixes, 70791576 sevens and 80 eights. So more than half of the numbers are 6s. The fact that there are on the average about 2.14 consecutive numbers are the same could lead to some compression, but in this case it says us nothing. There are nearly only fives and sixes, so encountering two equal consecutive numbers seems to be implied. Given this facts, you can forget my above optimization. There are practically only 8 values there as you can treat the single zero separately. So you need just 3 bits per value and a single index for the zero. You can even create a HashMap for all values below four or above seven, store there 1+154+10373+385990+80 entries and use only 2 bits per value. But this is still far from ideal. Assuming no regularities, you'd need 1.44 bit per value as this is the entropy. You could go over all 5-tuples, compute their histogram, and use 1 byte for encoding of the 255 most frequent tuples…
accepted answer of: http://stackoverflow.com/q/23912035

http://stackoverflow.com/comment/36869276
score: 0
has text: Also you should know that the above code works only if i define the items in the dialog like this: String[] pairedDevicesArray = {"TRobot", "PC", "TDroid"}; But i want to get them from the system, not to declare them as constants.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23934191

http://stackoverflow.com/q/23917156
has body: Sorry for the title, couldn't come up with anything clearer. I have the following structure: public interface Vehicle {...} public class Car implements Vehicle {...} then: public abstract class Fixer { ... abstract void fix(Vehicle vehicle); ... } and would like to have: public class CarFixer extends Fixer { void fix(Car car) {...} } but this doesn't work. Eclipse says: The type CarFixer must implement the inherited abstract method Fixer.fix(Vehicle). Any idea how can I solve this?
answer count: 2
tagged with: abstract
favorite count: 0
has answer: http://stackoverflow.com/a/23917217
accepted answer: http://stackoverflow.com/a/23917217
tagged with: interface
has answer: http://stackoverflow.com/a/23917380
type: AnsweredQuestion
has title: Java inheritance; passing a subclass to an abstract method of a superclass
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23917380
type: Question
score: 3
tagged with: inheritance
has comment: http://stackoverflow.com/comment/36831532
upvote count: 3

http://stackoverflow.com/comment/36770689
comment on: http://stackoverflow.com/q/23884885
score: 0
has text: There is no pattern here. Don't use REGEX
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23835817
tagged with: nutiteq
has body: I am using Nutiteq SDK which holds a MapView and am trying to use a navigation drawer as well. The problem I am having is that whenever I slide from the left or click the icon to open the drawer nothing opens, but I am unable to move the map until I slide the drawer back or click the icon again. This has lead me to believe that the drawer is opening but not displaying. Here is my MainActivity.java and activity_main.xml: MainActivity.java public class MainActivity extends Activity { private MapView mapView; private LocationListener locationListener; private GeometryLayer locationLayer; private Timer locationTimer; private String[] drawerListViewItems; private ListView drawerListView; private DrawerLayout drawerLayout; private ActionBarDrawerToggle actionBarDrawerToggle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setMap(); // get list items from strings.xml drawerListViewItems = getResources().getStringArray(R.array.items); // get ListView defined in activity_main.xml drawerListView = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view drawerListView.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.drawer_listview_item, drawerListViewItems)); // App Icon drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); actionBarDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ drawerLayout, /* 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 actionBarDrawerToggle as the DrawerListener drawerLayout.setDrawerListener(actionBarDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); // just styling option add shadow the right edge of the drawer drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); } @Override public void onConfigurationChanged(…
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23842017
tagged with: navigation-drawer
type: Question
score: 5
has title: Navigation drawer not displaying but still opening
favorite count: 0
tagged with: android
answer count: 1
upvote count: 5
type: UnansweredQuestion

http://stackoverflow.com/a/23937876
has comment: http://stackoverflow.com/comment/36876554
has comment: http://stackoverflow.com/comment/36870341
answers question: http://stackoverflow.com/q/23937743
has body: Your List will be of type string so --> List&lt; String > or you could use the ArrayList object. See this question for pointers. String tunes = "Electronic,Pop,Rock"; String[] splits = tunes.split(","); List&lt;String&gt; wordList = Arrays.asList(splits);
has comment: http://stackoverflow.com/comment/36871023
score: 0
type: Answer

http://stackoverflow.com/comment/36828123
comment on: http://stackoverflow.com/a/23914131
type: AnswerComment
score: 0
type: Comment
has text: ROROROOROROR, could you advise what are another possiblities? Except using SimpleFormController?

http://stackoverflow.com/comment/36687079
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the answer. The `username`/`user` was typo which I corrected. But I guess you got the problem.
comment on: http://stackoverflow.com/a/23834422

http://stackoverflow.com/a/23872959
has comment: http://stackoverflow.com/comment/36747840
has body: Try import java.io.File; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class JsoupFrame { public static void main(String[] args) throws Exception { Document doc = Jsoup.parse(new File("t2.html"), "UTF-8"); doc.select("area#area1").after(" "); System.out.println(doc.html()); } } Html ...a lot of .. Output ...a lot of ..
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36747147
type: Answer
has comment: http://stackoverflow.com/comment/36747236
has comment: http://stackoverflow.com/comment/36748995
answers question: http://stackoverflow.com/q/23872537
has comment: http://stackoverflow.com/comment/36747416
has comment: http://stackoverflow.com/comment/36748668
score: 0
has comment: http://stackoverflow.com/comment/36747612
has comment: http://stackoverflow.com/comment/36747088
accepted answer of: http://stackoverflow.com/q/23872537

http://stackoverflow.com/q/23838362
has title: Gradle: How to exclude javax.realtime package from JScience jar dependency (Multiple dex define)
tagged with: dependencies
score: 8
tagged with: jscience
has comment: http://stackoverflow.com/comment/36687648
has body: I'm using Gradle in my Android application an I would like to use the JScience library dependency. I have added the library this way: dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'org.jscience:jscience:4.3.1' testCompile group: 'junit', name: 'junit', version: '4.11' } But in the compile time I get the error: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Ljavax/realtime/MemoryArea; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103) This is caused because of duplicating javax.realtime packages in project, one is a part of JDK, and the second one is in the Jscience library. I have tried to remove this package from Jscience library this way in Gradle: sourceSets { main { java { exclude 'javax/realtime/**' } } } configurations { all*.exclude group: 'javax.realtime' } But that didn't help. So, that package is still exists in dependencies. Is there any way how I can exclude a package from jar on compile time?
has answer: http://stackoverflow.com/a/23841614
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36681482
tagged with: java
tagged with: gradle
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23841614
favorite count: 0
upvote count: 8
tagged with: android

http://stackoverflow.com/a/23798726
has body: use this code textView.setText(Html.fromHtml(data))); // where data contains string with html tags like &lt;br&gt;,&lt;b&gt;,&lt;i&gt;,etc.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23798341

http://stackoverflow.com/comment/36681868
type: QuestionComment
comment on: http://stackoverflow.com/q/23834934
type: Comment
score: 0
has text: The stack trace tells you more or less where the exception was generated--a native method implementing `FileDispatcher.read0()`. The actual "Broken pipe" text probably came from calling the C language [strerror()](http://en.wikipedia.org/wiki/String.h#cite_ref-38) function.

http://stackoverflow.com/comment/36785199
comment on: http://stackoverflow.com/a/23892403
has text: So how can I access my Application variable from this class?? (since it is not an Activity class)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/23800792
tags question: http://stackoverflow.com/q/23784205
tags question: http://stackoverflow.com/q/23876925
tags question: http://stackoverflow.com/q/23807903
tags question: http://stackoverflow.com/q/23854958
tags question: http://stackoverflow.com/q/23890924
tags question: http://stackoverflow.com/q/23798341
tags question: http://stackoverflow.com/q/23858142
tags question: http://stackoverflow.com/q/23811258
tags question: http://stackoverflow.com/q/23903277
tags question: http://stackoverflow.com/q/23784876
tags question: http://stackoverflow.com/q/23840468
tags question: http://stackoverflow.com/q/23937475
tags question: http://stackoverflow.com/q/23819968
tags question: http://stackoverflow.com/q/23828761
type: Tag
tags question: http://stackoverflow.com/q/23926814
tags question: http://stackoverflow.com/q/23814045
tags question: http://stackoverflow.com/q/23820356
tags question: http://stackoverflow.com/q/23805909
tags question: http://stackoverflow.com/q/23898338
tags question: http://stackoverflow.com/q/23843347
tags question: http://stackoverflow.com/q/23883561
tags question: http://stackoverflow.com/q/23849406
tags question: http://stackoverflow.com/q/23782662
tags question: http://stackoverflow.com/q/23858601
tags question: http://stackoverflow.com/q/23914394
tags question: http://stackoverflow.com/q/23931844
tags question: http://stackoverflow.com/q/23801935
tags question: http://stackoverflow.com/q/23902895
tags question: http://stackoverflow.com/q/23831166
tags question: http://stackoverflow.com/q/23843628
tags question: http://stackoverflow.com/q/23873507
tags question: http://stackoverflow.com/q/23783217
tags question: http://stackoverflow.com/q/23815692
tags question: http://stackoverflow.com/q/23857938
tags question: http://stackoverflow.com/q/23802811
tags question: http://stackoverflow.com/q/23805961
tags question: http://stackoverflow.com/q/23865768
tags question: http://stackoverflow.com/q/23865190
tags question: http://stackoverflow.com/q/23875883
tags question: http://stackoverflow.com/q/23851722
tags question: http://stackoverflow.com/q/23870626
tags question: http://stackoverflow.com/q/23905182
tags question: http://stackoverflow.com/q/23806781
tag name: html
tags question: http://stackoverflow.com/q/23785962
tags question: http://stackoverflow.com/q/23817482
tags question: http://stackoverflow.com/q/23874131
tags question: http://stackoverflow.com/q/23888598
tags question: http://stackoverflow.com/q/23932260
tags question: http://stackoverflow.com/q/23820373
tags question: http://stackoverflow.com/q/23858364

http://stackoverflow.com/comment/36806466
score: 0
type: Comment
type: QuestionComment
has text: i have many occurrence like this `{FILLIN PDPremium \* MERGEFORMATPDPremium }` need to replace all
comment on: http://stackoverflow.com/q/23903494

http://stackoverflow.com/comment/36685842
type: AnswerComment
score: 0
type: Comment
has text: at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
comment on: http://stackoverflow.com/a/23840596

http://stackoverflow.com/q/23910160
tagged with: jsp
has title: Start Java Swings application on Solaris box from JSP
has comment: http://stackoverflow.com/comment/36818114
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36818194
type: Question
tagged with: java
has body: We have standalone Java Swing based application which got deployed on Solaris OS, We want to gave an option in JSP which should start Java Swings application on the server. Please suggest. Thanks Sampath
has comment: http://stackoverflow.com/comment/36825190
score: 0
has comment: http://stackoverflow.com/comment/36818198

http://stackoverflow.com/comment/36599928
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23788952
has text: When I do I like this I get the exception "can't create handler inside thread that has not called looper.prepare'. I tried these ways: http://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare It gives null pointer exception. Please help

http://stackoverflow.com/comment/36780197
type: Comment
has text: Thank you. i will have a look.
comment on: http://stackoverflow.com/a/23889770
score: 0
type: AnswerComment

http://stackoverflow.com/a/23829273
answers question: http://stackoverflow.com/q/23828128
has comment: http://stackoverflow.com/comment/36681873
accepted answer of: http://stackoverflow.com/q/23828128
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36666965
score: 1
has comment: http://stackoverflow.com/comment/36678111
type: Answer
has comment: http://stackoverflow.com/comment/36665441
upvote count: 1
has comment: http://stackoverflow.com/comment/107186205
has body: The default HTML doclet sorts the summaries of its members. Collections.sort(members); from /com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java :312 It is probably best that you don't do this. Javadoc puts the summaries in alphabetical order so that you can quickly find the one you want. Breaking that model would make the Javadoc much harder to quickly scan and find what you are looking for. Alphabetical order only applies to the summary, the full Javadoc will be in the order of decleration in the source file. If you really needed to do this then you could roll your own doclet or perhaps a taglet might be able to do it.

http://stackoverflow.com/comment/36864202
comment on: http://stackoverflow.com/q/23934675
type: QuestionComment
has text: Classes should always start with a capital letter. It's is confusing to read. Ball not ball
score: 0
type: Comment

http://stackoverflow.com/comment/36624869
type: AnswerComment
score: 0
has text: Thanks for the in depth answer
comment on: http://stackoverflow.com/a/23808861
type: Comment

jodconverter
tags question: http://stackoverflow.com/q/23910331
tag name: jodconverter
type: Tag

http://stackoverflow.com/q/23935662
has title: Print Records from FindAll() in CrudRepository
has comment: http://stackoverflow.com/comment/36866325
answer count: 1
downvote count: 0
tagged with: hibernate-entitymanager
tagged with: entitymanager
has body: I am extending CrudRepository in my Repository class. I want to print the records in my table using the findAll method. So far, I have written a test class, and I can see the result query is correct. How can I print the individual records in the table? Here is a snippet of my code: Repository Class public interface RepositoryAda extends CrudRepository{ } Service Class @Service public class Service{ @Autowired private RepositoryAda repository; @Transactional public List selectRecords(){ return (List) repository.findAll(); } } Test Case: @Test public void getAllRecords() { service.selectRecords(); } How can I print the individual records from the table to a console?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36866243
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23936222
type: Question

http://stackoverflow.com/a/23817678
has comment: http://stackoverflow.com/comment/36655695
score: 0
has body: Try in this way to create a Scroll-Insensitive, read only ResultSet object statement object. Statement sta = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); instead of Statement sta = conn.createStatement(); Do the same for PreparedStatement as well. Through this ResultSet type the cursor can move in any direction. It is insensitive which means result set that does not reflect changes made while it is still open. It is default resultset type for MySql. Must read Retrieving and Modifying Values from Result Sets
type: Answer
answers question: http://stackoverflow.com/q/23817619
has comment: http://stackoverflow.com/comment/36656041

http://stackoverflow.com/a/23903127
answers question: http://stackoverflow.com/q/23902895
score: 0
type: Answer
has body: All the data that is submitted as a part of GET/POST will become part of a HttpServletRequest object. You can use the same to fetch the values. Refer javadocs for more details. It is also good practice not to write HTML in .java files and not to write java in .jsp files.

http://stackoverflow.com/comment/36759433
comment on: http://stackoverflow.com/q/23879238
type: Comment
type: QuestionComment
has text: @brano It is a desktop application.
score: 0

http://stackoverflow.com/comment/36701399
has text: Nop, it's still not that. I took my Unit ID from the logcat (when it advises me to use the 'test code'). It reservates space for the ad, but for some reason the ad doesn't show :/
type: AnswerComment
comment on: http://stackoverflow.com/a/23848505
score: 0
type: Comment

http://stackoverflow.com/q/23794374
score: 0
has title: GXT TextField shows as (null handle), rendered = false, getValue() = null, even though HTML shows the widget is rendered and has value
has comment: http://stackoverflow.com/comment/36598026
answer count: 0
type: UnansweredQuestion
tagged with: gxt
has body: I have a form with several GXT SimpleComboBox and TextField widgets. They are layed out in an elaborate form, with validators, default values, conditional enabling/disabling, etc. The problem is that one particular TextField.getValue() is returning null, and failing form submission due to this validation error. The entered value is valid, in accordance with the regex used for the field's validator (proven working for other fields, where the same regex is used to set validators on those fields). Debugging shows that the field is (null handle), instead of HTML that is shown for other TextFields. Flag rendered is false. Strangely, the field with that id is indeed rendered in the browser and contains a value. I'm using IE8, gxt 3.0.1 rc2. Method getRawValue() is returning empty. I've recompiled the entire project, and still experiecing this. There appears to be a disconnect between what is rendered and the Eclipse (keplar) debugger. I'm running in development mode.
tagged with: gwt
has comment: http://stackoverflow.com/comment/36597936
tagged with: java
type: Question

http://stackoverflow.com/q/23815217
has answer: http://stackoverflow.com/a/23815412
downvote count: 4
has body: I'm doing Project Euler and I got stuck at problem 3. After 2 hours of trying to make a java program in vain, I googled the answer but I can't understand a few things. Sorry if I ask stupid questions but I'm noob and I really want to learn. public static void main(String[] args) { long x = 600851475143L; long biggest = 0L; for (long i = 2L; i &lt;= x; i++) { // &lt;- HERE, WHY 2L and NOT 1L ? for (long l = 1L; l &lt;= Math.sqrt(i); l++) { // &lt;- HERE, why Math.sqrt(i) ????? if (l % i == 0) { break; } else { while (x % i == 0) { x = x / i; // &lt;- Why x/i ??? biggest = i; } } } } System.out.println(biggest); }
has title: Understanding problems of code
score: -3
has comment: http://stackoverflow.com/comment/36637325
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36637448
has comment: http://stackoverflow.com/comment/36637141
tagged with: java
has comment: http://stackoverflow.com/comment/36637241
type: Question
accepted answer: http://stackoverflow.com/a/23815412
upvote count: 1
has comment: http://stackoverflow.com/comment/36637705
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23794617
accepted answer: http://stackoverflow.com/a/23794737
downvote count: 0
answer count: 1
favorite count: 0
has body: I am getting the error "The prefix "c" for element "c:de" is not bound." Any clue will be very appreciated. javax.xml.parsers.DocumentBuilderFactory fac = new org.apache.xerces.jaxp.DocumentBuilderFactoryImpl( ); fac.setNamespaceAware(true); org.w3c.dom.Document d = null; javax.xml.parsers.DocumentBuilder builder = fac.newDocumentBuilder(); d = builder.parse("C:/my_folder/my_file.xml"); //the error rises in this line my_file.xml is exactly and complete pasted here. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;c:de format="N" lengthField="0" maxLength="012" minLength="012" name="AMOUNT, TRANSACTION" number="004" subFields="00"/&gt;
has comment: http://stackoverflow.com/comment/36598292
has answer: http://stackoverflow.com/a/23794737
has title: DocumentBuilder.parse raises the error "The prefix "c" for element "c:de" is not bound."
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: dom
type: Question

filenotfoundexception
tags question: http://stackoverflow.com/q/23854949
tag name: filenotfoundexception
type: Tag
tags question: http://stackoverflow.com/q/23808440

http://stackoverflow.com/a/23887495
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36775035
downvote count: 0
answers question: http://stackoverflow.com/q/23886275
has comment: http://stackoverflow.com/comment/36775191
has comment: http://stackoverflow.com/comment/36775913
score: 4
has body: While GridLayout(0, 1) can arrange an arbitrary number of components in a column, the result scales poorly for more than a few hundred cells. Profile to be sure. Instead, use a component that renders only visible cells, such as JList or JTable, as suggested here.
has comment: http://stackoverflow.com/comment/36774877

http://stackoverflow.com/a/24008952
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23869774
type: Answer
accepted answer of: http://stackoverflow.com/q/23869774
score: 0
has body: Picking the patches from Link1 and Link2 Fixed the issue. Still I don't understand the way the original AOSP code initialize the variable.

http://stackoverflow.com/comment/36975437
type: AnswerComment
type: Comment
score: 1
has text: Looks like Spring makes use of the JMM to avoid this reordering issue. I updated my answer on this matter.
comment on: http://stackoverflow.com/a/23991842

http://stackoverflow.com/comment/39420851
has text: sorry, that looks very accurate to me
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23860014

http://stackoverflow.com/comment/36758999
type: AnswerComment
score: 0
type: Comment
has text: Static method can't be overridden. True. If, I mean, if the keyword super can only be used in an overridden method, then using super in static method because meaningless. However, we can use super to call any method in the super class(Which I think should be a bad idea, that's why I'm asking here). It means that its not mandatory to use super in overridden method. This undermine the claim that: " Given that a static method cannot be overridden using the super keyword to access one becomes meaningless". I'm not very good at English, I hope you get what I mean.
comment on: http://stackoverflow.com/a/23878740

http://stackoverflow.com/comment/36864356
has text: Not at all. You seem quite sweet. Thank you for taking your time out for my question, sir. I might work on the formatting if you don't mind, though. I edit everything I can on this site.
comment on: http://stackoverflow.com/a/23934457
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23815263
upvote count: 3
has comment: http://stackoverflow.com/comment/36637337
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23815084
answers question: http://stackoverflow.com/q/23815084
has comment: http://stackoverflow.com/comment/36637252
has body: The problem you're running into is that there are two classes called PrincipalComponents in the weka API: weka.attributeSelection.PrincipalComponents and weka.filters.unsupervised.attribute.PrincipalComponents. The latter is a kind of Filter, but you are importing the former, which is not. Just change your import statement and your code should work.
type: Answer
score: 3

http://stackoverflow.com/q/23820454
has answer: http://stackoverflow.com/a/23840111
has title: Java - Timer class that accepts a time source
type: Question
answer count: 2
score: 0
possible better answer: http://stackoverflow.com/a/23820672
has answer: http://stackoverflow.com/a/23820672
accepted answer: http://stackoverflow.com/a/23840111
tagged with: timer
type: AnsweredQuestion
has body: I need a replacement of java.util.Timer or java.util.concurrent.ScheduledExecutorService that accepts a time source so that it can be driven off of system time or some other reference. I use this timer to periodically execute a method, but need the period to be driven by system time when the application is in "live" mode and some other source when the application is in "playback" mode. I did see that there are some 3rd party libraries such as guava stopwatch with functionality similar to what I am asking, but I prefer something native to Java due to the policies of the information system I am working on. I may end up having to write my own, but am asking here since this seems like a need that many would have... Either when working with applications that have alternate concepts of time passage or for testing of units with embedded timers.
tagged with: java

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/23851315

http://stackoverflow.com/q/23846479
type: Question
tagged with: asp-classic
has comment: http://stackoverflow.com/comment/36697295
has answer: http://stackoverflow.com/a/26106332
score: 0
tagged with: com
has comment: http://stackoverflow.com/comment/36699106
answer count: 1
has title: Java class not used as a COM object from classic ASP page
has comment: http://stackoverflow.com/comment/36703482
has comment: http://stackoverflow.com/comment/36696772
type: UnansweredQuestion
tagged with: iis
tagged with: windows
has body: I am stuck in a very strange problem for which i haven't found a solution from Internet as yet.Here is my issue:- I have a pre-compiled java class which is registered with javareg utility so that it can be used as a COM object in classic ASP page. Thus, this java class is called in global.asa with a Prog ID and then it is used all over the page to call it's methods. This is working well in our current development server which is Windows Server 2003 R2.But, it is not working in our new 64-bit Windows Server 2008 R2. I have done the registration using javareg but when i try to create an object using Server.CreateObject in ASP page, i am getting "ASP 0177 : 80070002' Server.CreateObject Failed." Thus, i tried to create a sample java class in our existing development server and registered it using javareg and used Server.CreateObject to instantiate it but even i am getting this same error in Dev server, which proves i am even not able to use a java class as COM object even in the working dev server. Also, when i tried to simulate the CreateObject method using Vb 6, i am now getting a Classfactory automation error. So what can be the issue? I see the id which i logged on to the server has been added to Administrators group, thus there is faint chance of any permission problem. Also, i see the registered java COM components present in Control Panel->Components...Any suggestions or help is truly appreciated... Additional info:- Existing dev server specs: Windows Server 2003 R2(32 bit) IIS 6.0 .Net Framework 2.0 New server specs: Windows Server 2008 R2(64 bit) IIS 7.5 .Net Framework 3.5
has comment: http://stackoverflow.com/comment/36697041
has comment: http://stackoverflow.com/comment/36696912
has comment: http://stackoverflow.com/comment/36696661
has comment: http://stackoverflow.com/comment/36696762
tagged with: java
has comment: http://stackoverflow.com/comment/36696840
has comment: http://stackoverflow.com/comment/36696981
has comment: http://stackoverflow.com/comment/36696586
has comment: http://stackoverflow.com/comment/36735856

http://stackoverflow.com/q/23844226
possible better answer: http://stackoverflow.com/a/23844291
has answer: http://stackoverflow.com/a/23844291
has answer: http://stackoverflow.com/a/23844491
type: AnsweredQuestion
has body: So I have an object that contains a couple of strings. the text in this string sometimes contains special characters like ë,ô, é, etc... Now when I set the text in my TextView to show what is inside the string it does show the text but replaces all the special characters with ? Any ideas how to fix this? Note the textView is used as an listitem for a listview, and the data is extracted from a .csv file. <?xml version="1.0" encoding="utf-8"?>
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36692271
type: Question
linked to: http://stackoverflow.com/q/7890491
accepted answer: http://stackoverflow.com/a/23844491
answer count: 2
downvote count: 0
tagged with: textview
has title: Android textview doesn't show correct characters
favorite count: 0
has comment: http://stackoverflow.com/comment/36692194
tagged with: android

http://stackoverflow.com/q/23917518
type: Question
tagged with: resize
tagged with: image
score: 0
has title: Rescale BufferedImage java
answer count: 1
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/23919650
accepted answer: http://stackoverflow.com/a/23919650
type: AnsweredQuestion
has body: Hi i am looking for a way to rescale my image and still show the entire image, so it isn't cut in half or something like that. I am also not allowed to use libraries of any sort. Im drawing the image with paintcomponent. Is there any way how to do this properly? I've tried this one already : BufferedImage image = null; try { image = ImageIO.read(new File($question.getMediaFile().getPath())); /* Get the image */ Image scaled = image.getScaledInstance(350, 350, Image.SCALE_SMOOTH); g.drawImage(scaled, w-350, 200, null); } catch (IOException e) { e.printStackTrace(); } This resizes my image but doesn't show the entire image, i would like to rescale it to an image with 300*300 or 350*350 size or something like that. Thanks!
has comment: http://stackoverflow.com/comment/36832690
tagged with: java
tagged with: bufferedimage

http://stackoverflow.com/comment/36749149
comment on: http://stackoverflow.com/q/23872779
has text: Check that the Jetty bundle is publishing an HttpService, and that it is being consumed by the WebConsole bundle: `inspect cap service 5`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23812386
score: -1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23812494
tagged with: multithreading
downvote count: 1
type: Question
has title: Java.lang.IllegalArgumentException: timeout value is negative
tagged with: java
tagged with: timeout
accepted answer: http://stackoverflow.com/a/23812494
upvote count: 0
answer count: 1
has body: I have a thread that runs every day at a given hour. it gives me this error message : 2014-05-21 03:57:06 [CRITICAL][AlertMgr] : maintenance : java.lang.IllegalArgumentException: timeout value is negative at java.lang.Thread.sleep(Native Method) at com.orca.pf.tc50.managerutilities.maintenance.MaintenanceManager.backgroundProcess(Unknown Source) at com.orca.pf.tc50.managerutilities.maintenance.MaintenanceManager.access$000(Unknown Source) at com.orca.pf.tc50.managerutilities.maintenance.MaintenanceManager$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:745). do you know what could cause this. Thanks private void backgroundProcess() { Calendar cal; cal = Calendar.getInstance(); log.addHelpField("AlertMgr"); /* * Synchronise le calendrier a 3:00AM */ cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); if (cal.get(Calendar.HOUR_OF_DAY) &gt; HOUR_START) { /* * wait till tomorrow */ cal.set(Calendar.HOUR_OF_DAY, HOUR_START); cal.add(Calendar.DAY_OF_YEAR, 1); } else { cal.set(Calendar.HOUR_OF_DAY, HOUR_START); } do { try { /* * Calculate the time to wait */ long timeToWait = cal.getTimeInMillis() - System.currentTimeMillis(); Thread.sleep(timeToWait); processAllEntries(); /* * wait for tomorrow */ cal.add(Calendar.DAY_OF_YEAR, 1); /* * Clear */ Thread.interrupted(); } catch(InterruptedException i) { Thread.currentThread().interrupt(); } catch(Exception ex) { log.addException(LogLevel.CRITICAL, "maintenance", ex); } } while(!th.isInterrupted()); }
has comment: http://stackoverflow.com/comment/36631679
favorite count: 0
tagged with: illegalargumentexception
has comment: http://stackoverflow.com/comment/36631594

http://stackoverflow.com/comment/36774604
type: Comment
comment on: http://stackoverflow.com/a/23848479
has text: @rath--What's the `... i < (n/2) ...` supposed to do?
score: 0
type: AnswerComment

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/23812105
tags question: http://stackoverflow.com/q/23885846

http://stackoverflow.com/comment/36703681
type: Comment
has text: What `Location.getLocation("myLocation");` is returning?
type: QuestionComment
comment on: http://stackoverflow.com/q/23849811
score: 0

http://stackoverflow.com/q/23889572
downvote count: 1
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/29140402
tagged with: java
linked to: http://stackoverflow.com/q/409784
has title: Why does my Java code return a memory address and not a string?
has comment: http://stackoverflow.com/comment/36778839
possible better answer: http://stackoverflow.com/a/23889609
upvote count: 1
has comment: http://stackoverflow.com/comment/36779685
favorite count: 0
has answer: http://stackoverflow.com/a/23889662
score: 0
has answer: http://stackoverflow.com/a/23889824
accepted answer: http://stackoverflow.com/a/23889824
has comment: http://stackoverflow.com/comment/36778834
duplicate of: http://stackoverflow.com/q/29140402
answer count: 4
has answer: http://stackoverflow.com/a/23889613
has answer: http://stackoverflow.com/a/23889609
has body: I am calling a WSDL service from PlaneXML - API reference here https://flightwise.com/documentation/39/PlaneXML_API_Reference.html#AirportInfo My code: public static void airportName() throws RemoteException{ String lax = "LAX"; PlaneXMLv1SoapProxy foo = new PlaneXMLv1SoapProxy(); Airport [] info = foo.airportInfo(lax); System.out.println("output 1: " + info); System.out.println("output 2: " + info.toString()); System.out.println("output 3: " + info[0]); } My output: output 1: [Lcom.flightwise.planexml.ws.Airport;@604ed9f0 output 2: [Lcom.flightwise.planexml.ws.Airport;@604ed9f0 test test output 3: com.flightwise.planexml.ws.Airport@9117a1a4 Why do I return these memory addresses and not a string? Any ideas what might be causing the "test" output?

http://stackoverflow.com/comment/36648408
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23820881
type: Comment
has text: it's quite long if I placed all the code here. Basically, I have a GUI that allows me to input recipients. By pressing the "Add" button, I can add the email address to a DefaultListModel object. Once the "Send" button is pressed, a method will be called that creates the message itself. Within that method is a loop to extract all the content of the DefaultListModel object and add them as recipients

http://stackoverflow.com/q/23910818
linked to: http://stackoverflow.com/q/4714645
has body: I want to generate a random string and then I need to convert it into an image. I want to store this image in my resource folder of spring. @Service public class CapchaServiceImpl implements CapchaService{ @Override public void CapchaString() { String capchaString = UUID.randomUUID().toString(); ByteArrayInputStream bais = new ByteArrayInputStream(capchaString.getBytes()); try { BufferedImage bi=ImageIO.read(bais); File outputfile = new File("/resources/saved.png"); ImageIO.write(bi, "png", outputfile); } catch (IOException e) { throw new RuntimeException(e); } } } However, when I used this, I am getting java.lang.IllegalArgumentException: image == null! Exception. Why and what do I need to do?
score: 0
answer count: 2
type: UnansweredQuestion
has title: write random string image to resources
tagged with: filestream
type: Question
has answer: http://stackoverflow.com/a/23910913
tagged with: java
has answer: http://stackoverflow.com/a/23910907

http://stackoverflow.com/comment/36738289
type: QuestionComment
type: Comment
has text: Basically for the first code the compiler tells you "I hope you are sure your code works properly, because I cannot tell"... in the second one, the compiler is sure that your definition is wrong.
comment on: http://stackoverflow.com/q/23868273
score: 0

http://stackoverflow.com/q/23903901
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36807462
has title: Java read each lines of numbers from text file using Scanner class, finding max value
upvote count: 1
downvote count: 1
has body: Hello I'm a java beginner and I'm working on an assignment. I need to read in numbers from text file, then print out message if they are invalid 1st number (Int) needs to be 0~99999 2nd number (Int) needs to be 0~5 3rd number (double) needs to be 0~100.00 the txt file looks like this, the numbers represent student ID, extra credit, grade 51673 0 98.85 19438 5 95.00 00483 3 73.16 and here is what I have so far... any hint is greatly appericiated public static void validateDate(File inputFile) x = new Scanner(new File("xxx.txt"); while(x.hasNext())!= null) { int a = x.next(); int b = x.next(); double c = x.next(); ) if (a &lt; 0 || a &gt; 99999){ System.out.print("Ignoring student with invalid ID number " + a); } if ( b &lt; 0 || b &gt; 5){ System.out.println("Ignoring student " + a + " with invalid extra credit" + b); } if ( c &lt; 0 || c &gt; 100){ System.out.println("Ignoring student " + a + " with invalid grade " + c); } I also need to write another method to find max value of all the 3rd numbers, any suggestions?
tagged with: java
has comment: http://stackoverflow.com/comment/36806838
type: Question
has answer: http://stackoverflow.com/a/23904156
has comment: http://stackoverflow.com/comment/36806844
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36807033
has comment: http://stackoverflow.com/comment/36806878

http://stackoverflow.com/comment/36784876
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23892179
has text: I'm new to Spring, so I don't really know the inner workings or if what I'm doing is right. As far as I can tell, the setter for the parameters need to be the same as the parameter name, so I tried changing it a few times like this: `setProductType, setProduct_type, setProducttype` but that didn't work. I'm not really getting any error, the parameter just remains null.
type: QuestionComment

http://stackoverflow.com/q/23876879
has comment: http://stackoverflow.com/comment/36754732
has comment: http://stackoverflow.com/comment/36755284
tagged with: imagej
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/23879752
type: Question
has comment: http://stackoverflow.com/comment/36755413
upvote count: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36754710
favorite count: 0
has comment: http://stackoverflow.com/comment/36754550
answer count: 1
has body: I want to make a split pane where on the left hand side it displays a list of images, and once you click on those images it should then display the image in a bigger size on the right hand side. I was wondering if anyone knows how to do this because I can't seem to create a list of images (image icons) on the left hand side of the split pane. I can read and open .dcm images (using ImageJ) and they are displayed in the internal frame but I can't make it work in split panes. If anyone has a general solution on how I could make this work it would be very helpful. Thanks in advance. So this is my code that displays a list of questions on the left side and then more information about it on the right hand side of the split panes. I was wondering how can I make the left hand side a list of image icons. So that if an image is clicked it is displayed on to the right hand side. public class FrequentQuestions implements ActionListener, InternalFrameListener{ private int openFrameCount; private JDesktopPane desk; private JTextArea Tarea; private JScrollPane scroll; private BufferedReader in ; JPanel panelQuestions = new JPanel(); JPanel panelAnswers = new JPanel(); JTextArea text = new JTextArea(); JTextPane tPane = new JTextPane(); String file =""; //private FrequentQuestions quest; JSplitPane pane ; MyInternalFrame frame; public FrequentQuestions(JDesktopPane desktop) { // TODO Auto-generated constructor stub desk = desktop; } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(frame == null || frame.getParent() == null){ frame = new MyInternalFrame("Frequently Asked Questions"); String [] options = {"How to open/save images", "What formats can SAD Imaging open", "How to show information about an image"}; JList list = new JList(options); //list.setBorder(BorderFactory.createLineBorder(Color.black)); //panelQuestions.add(list); list.addListSelectionListener(new ListSelectionListener(){ @Override public void valueChanged(ListSelectionEve…
has title: how to display a list of images on one side of the split pane
has comment: http://stackoverflow.com/comment/36755039
downvote count: 1
has answer: http://stackoverflow.com/a/23879752
type: AnsweredQuestion

sockets
tags question: http://stackoverflow.com/q/23873220
tags question: http://stackoverflow.com/q/23898970
tags question: http://stackoverflow.com/q/23795682
tags question: http://stackoverflow.com/q/23927420
tags question: http://stackoverflow.com/q/23916579
tags question: http://stackoverflow.com/q/23905436
tags question: http://stackoverflow.com/q/23869762
tags question: http://stackoverflow.com/q/23820291
tags question: http://stackoverflow.com/q/23834934
tags question: http://stackoverflow.com/q/23860050
tags question: http://stackoverflow.com/q/23836238
tags question: http://stackoverflow.com/q/23890488
tags question: http://stackoverflow.com/q/23803041
tags question: http://stackoverflow.com/q/23907987
tags question: http://stackoverflow.com/q/23793151
tags question: http://stackoverflow.com/q/23784616
tags question: http://stackoverflow.com/q/23841222
tags question: http://stackoverflow.com/q/23855604
tags question: http://stackoverflow.com/q/23918067
tags question: http://stackoverflow.com/q/23847700
type: Tag
tags question: http://stackoverflow.com/q/23871183
tags question: http://stackoverflow.com/q/23889208
tags question: http://stackoverflow.com/q/23935273
tags question: http://stackoverflow.com/q/23907415
tags question: http://stackoverflow.com/q/23877694
tags question: http://stackoverflow.com/q/23870164
tags question: http://stackoverflow.com/q/23844560
tags question: http://stackoverflow.com/q/23903608
tags question: http://stackoverflow.com/q/23939467
tags question: http://stackoverflow.com/q/23829165
tags question: http://stackoverflow.com/q/23815406
tags question: http://stackoverflow.com/q/23933513
tags question: http://stackoverflow.com/q/23854402
tags question: http://stackoverflow.com/q/23936133
tags question: http://stackoverflow.com/q/23809213
tags question: http://stackoverflow.com/q/23780651
tag name: sockets
tags question: http://stackoverflow.com/q/23829601
tags question: http://stackoverflow.com/q/23778196
tags question: http://stackoverflow.com/q/23928745
tags question: http://stackoverflow.com/q/23816711
tags question: http://stackoverflow.com/q/23929222
tags question: http://stackoverflow.com/q/23819786
tags question: http://stackoverflow.com/q/23909233
tags question: http://stackoverflow.com/q/23908555
tags question: http://stackoverflow.com/q/23876411
tags question: http://stackoverflow.com/q/23875543

http://stackoverflow.com/comment/36633767
has text: @TimCastelijns this code doesn't show that... Which means that this is not the relevant code to evaluate.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813352

http://stackoverflow.com/comment/36590846
type: QuestionComment
has text: you can do it dynamically.
comment on: http://stackoverflow.com/q/23785359
score: 1
type: Comment

http://stackoverflow.com/comment/36701390
type: Comment
comment on: http://stackoverflow.com/a/23848658
type: AnswerComment
has text: Usually camera moves all the time in a game. Which makes method 2 not very good idea.
score: 0

http://stackoverflow.com/comment/36765563
has text: Not sure about the android timer, but at least [this](http://developer.android.com/reference/android/os/CountDownTimer.html) states that you do not get overlapping calls to `onTick`. If your `doSignal` takes longer than a ms this might cause missing ticks. In that case something like this could help: `Long signalledSecond = 0l; public void onTick(long millisLeft) { Long second = TimeUnit.MILLISECONDS.toSeconds(millisLeft+999); if (second % (60 / 20) == 0 && signalledSecond != second) { signalledSecond = second; doSignal(); } } `
comment on: http://stackoverflow.com/a/23877080
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/23823172
favorite count: 0
accepted answer: http://stackoverflow.com/a/23823412
upvote count: 1
has comment: http://stackoverflow.com/comment/36652455
tagged with: calendar
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: date
type: Question
has comment: http://stackoverflow.com/comment/36653753
answer count: 2
has body: I have a date from the request, say 15-aug-2014, How do I calculate the previous month end date (It will be 31-Jul-2014) in java using java,lang.Calendar. We dont use JODA time.
has title: Month End Date of previous month without JODA
possible better answer: http://stackoverflow.com/a/23823282
downvote count: 0
has answer: http://stackoverflow.com/a/23823412
has answer: http://stackoverflow.com/a/23823282
has comment: http://stackoverflow.com/comment/36652604

http://stackoverflow.com/q/23886626
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23887320
has comment: http://stackoverflow.com/comment/36773490
answer count: 1
has comment: http://stackoverflow.com/comment/36773266
has comment: http://stackoverflow.com/comment/36774675
score: 0
linked to: http://stackoverflow.com/q/2406341
has answer: http://stackoverflow.com/a/23887320
has title: isLocalHost(String hostNameOrIpAddress) in Java
has body: I want to write a ContainerRequestFilter for a Jersey webapp that will filter out all remote calls. So only requests from same machine (where webapp is running) are allowed. I get a context object of type ContainerRequestContext where I get the host name via ctx.getUriInfo().getRequestUri().getHost(). How can I check if this host name (in form of IPv4, IPv6 or domain name) is an address of the local machine?

http://stackoverflow.com/q/23793885
has comment: http://stackoverflow.com/comment/36596805
favorite count: 0
has comment: http://stackoverflow.com/comment/36596832
tagged with: serialization
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23794052
tagged with: subclass
has comment: http://stackoverflow.com/comment/36596791
score: 2
has answer: http://stackoverflow.com/a/23794044
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23794052
has comment: http://stackoverflow.com/comment/36596790
downvote count: 3
tagged with: extend
has comment: http://stackoverflow.com/comment/36597481
type: Question
has comment: http://stackoverflow.com/comment/36606110
has body: I want to serialize an arraylist of Item but it doesn't work.... my Item class extends Stuff class and has some subclasses. all of my classes implement Serilalizable. i have this part : try{ // Serialize data object to a file ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("MyData.ser")); out.writeObject(myData); out.close(); // Serialize data object to a byte array ByteArrayOutputStream bos = new ByteArrayOutputStream() ; out = new ObjectOutputStream(bos) ; out.writeObject(myData); out.close(); // Get the bytes of the serialized object byte[] buf = bos.toByteArray(); } catch (IOException e) { } my classes : public class Stuff implements Serializeable{ .... some protected fields . . } public class Item extends Stuff implements Serializable{ ... .. . } and some subclasses of Item: public class FirstItem extends Item implements Serializable{ ... } public class SecondItem extends Item implements Serializable{ ... } ... I want to serialize an object contains ArrayList of &lt;Item&gt; that has objects of Item's subclasses (FirstItem,SecondItem,...) i think informations are sufficient... it's just a little mistake and now works correctly... I'm sorry for my stupid question. Thank you for your answers.
has title: How to serialize ArrayList of objects?
linked to: http://stackoverflow.com/q/8785955
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36607013
possible better answer: http://stackoverflow.com/a/23794044
answer count: 2

http://stackoverflow.com/comment/36591797
has text: I don't think logging the number of individual write operations that take more than 10ms is a good way of measuring throughput, especially when there's buffering involved. Better to measure the average write speed over time.
score: 1
comment on: http://stackoverflow.com/q/23791240
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36826918
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23877854
has text: Yup done.. but sessionFactory is still null. I can't execute any queries.

http://stackoverflow.com/q/23784876
tagged with: selenium-webdriver
has body: Need to fond out how I can select and click the blog-title without using the text as the content can change frequently. I do not have a "li" tag so some of the things that I have done before do not work in this case. Any help would be apprecaited. Here is the last thing I tried: driver.findElement(By.xpath("(//h2[contains(@class, 'blog-post-title')])[3]/a")).click(); &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="view-content"&gt; &lt;div class="views-row views-row-1"&gt; &lt;span class="pubdate"&gt;July 31, 2012&lt;/span&gt; &lt;h2 class="blog-post-title"&gt;&lt;a href= "/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it"&gt;The Surprise Attack (And When Not to Do It)&lt;/a&gt;&lt;/h2&gt; &lt;p class='field-summary'&gt;With 200 meters remaining in the 250-kilometer Men’s Olympic Road Race last Saturday, Colombia’s Rigoberto Uran made a fatal mistake: He turned his head to see what was happening behind him....&lt;/p&gt;&lt;a class="read-more" href= "/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it"&gt;Read more&lt;/a&gt; &lt;ul class="links inline"&gt; &lt;li class="datetime first"&gt;&lt;span&gt;Posted at &lt;time class= "timestamp" datetime="2012-07-31T17:41:04-04:00"&gt;5:41 PM&lt;/time&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="disqus_comments_num"&gt;&lt;a data-disqus-identifier= "node/28978" href= "/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it#disqus_thread"&gt; Comments&lt;/a&gt;&lt;/li&gt; &lt;li class="email"&gt;&lt;a class="sharebtn" href= "mailto:?subject=The%20Surprise%20Attack%20%28And%20When%20Not%20to%20Do%20It%29&amp;amp;amp;body=With%20200%20meters%20remaining%20in%20the%20250-kilometer%20&amp;amp;lt;a%20href=&amp;amp;quot;http://www.bicycling.com/news/pro-cycling/ahead-pack-vinokourov-sprints-olympic-gold&amp;amp;quot;&amp;amp;gt;Men%E2%80%99s...%20http://stage7.bicycling.com/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it"&gt; &lt…
has answer: http://stackoverflow.com/a/23823572
tagged with: java
has comment: http://stackoverflow.com/comment/36586194
type: Question
has comment: http://stackoverflow.com/comment/36584655
has comment: http://stackoverflow.com/comment/36593287
has comment: http://stackoverflow.com/comment/36594119
has answer: http://stackoverflow.com/a/23785113
score: 0
has answer: http://stackoverflow.com/a/23831868
answer count: 3
tagged with: http://stackoverflow.com/tag/html
tagged with: css
has title: How to select content from a page without using the text?
has comment: http://stackoverflow.com/comment/36580538
type: UnansweredQuestion

http://stackoverflow.com/comment/36754968
type: Comment
comment on: http://stackoverflow.com/q/23876964
score: 0
type: QuestionComment
has text: So if columns 3-5 are equal you write an "x" to column 2?

http://stackoverflow.com/comment/36664856
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23828229
score: 0
has text: SPring boot will do that as well as bootstrapping the Jetty container. I don't see why you are creating a container yourself as spring boot does all that for you...

node-java
tag name: node-java
tags question: http://stackoverflow.com/q/23868148
type: Tag

http://stackoverflow.com/comment/36835970
score: 0
type: QuestionComment
type: Comment
has text: @membersound That is what i said. if you change ` ../project-parent/pom.xml ` to ` ../../project-parent/pom.xml ` it should work
comment on: http://stackoverflow.com/q/23916211

http://stackoverflow.com/q/23821743
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/122303108
type: Question
tagged with: java
score: 5
has body: I am uploading a file to google cloud storage using java. The uploaded may of any size. I am sending this file using post request to a bucket, but after the processing of the request i am getting the response like Metadata part is too large. I am using this URL as the post request from my jsp page. https://www.googleapis.com/upload/storage/v1/b/mybucket/o?uploadType=multipart&amp;name=hello&amp;X-Upload-Content-Type=application/octet-stream Can any one tell me how to upload the file using the above url?
downvote count: 0
has title: uploading a file using google apis java
favorite count: 0
upvote count: 5
tagged with: google-app-engine

http://stackoverflow.com/q/23860240
has answer: http://stackoverflow.com/a/23891526
tagged with: mousemotionlistener
tagged with: java
has comment: http://stackoverflow.com/comment/36723974
has comment: http://stackoverflow.com/comment/36723722
upvote count: 0
answer count: 1
tagged with: applet
tagged with: awt
favorite count: 0
accepted answer: http://stackoverflow.com/a/23891526
has body: I recently made a MakeDots class in java that when you drag the mouse, it makes dots(yay!). I implemented a MouseMotionListener for that. It worked fine. Then I added some buttons to change the colors of the dots. I added ActionListeners for that. Once I did that, the color-changing worked, but I could only draw in the very tiny borders of the buttons! Why does this happen? How do I fix it? If you need me to post my code just say in the comments, and I will do so. CODE: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.applet.Applet; import java.awt.Button; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; public class MakeDots extends Applet implements MouseMotionListener{ private Graphics graphics = null; private Color dotColor = Color.red; private Button setRed; private Button setPink; private Button setPurple; private Button clrBtn; public void init() { setRed = new Button("Red"); setPink = new Button("Pink"); setPurple = new Button("Purple"); clrBtn = new Button("Clear"); this.addMouseMotionListener(this); this.add(setRed); this.add(setPink); this.add(setPurple); this.add(clrBtn); setRed.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dotColor = Color.red; } }); setPink.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dotColor = Color.pink; } }); setPurple.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dotColor = new Color(80, 0, 80); } }); clrBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { clear(); } }); } public void paint(Graphics g) { this.setSize(new Dimension(800, 600)); graphics = g.create(); clear(); } public void drawDot(int x, int y) { graphics.setColor(dotColor); graphics.fillOval(x, y, 10, 10); } public void clear() { Dimension d = this.getSize(); graphics.setCo…
has title: Why Does Implementing an ActionListener make the applet shrink(virtually)?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36723681
downvote count: 3
score: -3
type: Question
has comment: http://stackoverflow.com/comment/36723945
tagged with: actionlistener

http://stackoverflow.com/a/24021536
accepted answer of: http://stackoverflow.com/q/23837314
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23837314
has body: After struggling with it for a week or so, it's now working fine. Appears to be magic as I've made no changes. Same JRE/JDK, same marathon install, etc. I'd rebooted with no change, yet it just works now...
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/23805583
has body: let's look at what references are. (Java-references, not to be confused with C++-references) Let's assume we have some memory with addresses, in this case the data is some String Object [ address ][ data ] [ 0 ][ abc ] [ 1 ][ de ] [ 2 ][ y ] [ 3 ][ foo ] [ 4 ][ baar ] If we have a reference, than this reference is only an address, not the data itself! int i = 15; // this is a primitive type, the variable i holds the data directly // 15 in this case Number x = new StringObject(foo); // this is a reference, the reference only // contains the address. // so x is actually '3' Now, what happens if we call a method? Every value passed to a method will be copied. void call(int x) { x = 4; } int i = 15; call(i); System.out.println(i); The output of this will be 15. because, the value of i gets copied to the call method. And the method only changes the copy, but not the original i. The same goes for references: void call(StringObject x) { x = new StringObject("baz"); // this creates a new address in x! } StringObject i = new StringObject("foo"); // remember, i is only an address! // the address is '3' // the actual value can be looked up // in our memory table above // '3' -&gt; 'foo' call(i); System.out.println(i); The output here will be foo. As with the primitives, i will be copied. But don't worry, only the address will be copied. The result is, that the call method works on a copy of i which is 3. But the value of the original i is not changed. So, what is the connection to your problem? See this method: private void insert(Node current, Node temp) { if(current == null) current = temp; else if(temp.element &lt; current.element) insert(current.leftChild, temp); else if(temp.element &gt;= current.element) insert(current.rightChild, temp); } Clearly as you can see, your code operates on the copy of the current reference! You are changing a copy which will be discarded after the method. Basically the solution to your problem with the second code is to use the first code sni…
accepted answer of: http://stackoverflow.com/q/23804645
answers question: http://stackoverflow.com/q/23804645
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36664471
type: Comment
has text: http://www.sevenforums.com/tutorials/83361-priority-level-set-applications-processes.html This may help you set the priority.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23829709

http://stackoverflow.com/comment/36909250
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23955285
has text: I don't know if it's intentional but that code will create a new thread pool for every instance of WebSocketFrame. You want to create the threadpool once when the application starts and submit tasks to the same instance.

http://stackoverflow.com/comment/36758532
comment on: http://stackoverflow.com/q/23878654
score: 0
type: Comment
type: QuestionComment
has text: @AnubianNoob Sacred Stones is a great game <3 And that series is what this game will be similar to ;) And check the comment above this one, I answered the question.

http://stackoverflow.com/q/23919809
has comment: http://stackoverflow.com/comment/36919944
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36836789
tagged with: try-catch
has comment: http://stackoverflow.com/comment/36836773
has title: Where's the "right place" to put return statement in try catch finally
has answer: http://stackoverflow.com/a/23919964
has body: End of try block, or after all blocks? I read a lot of answers on stack overflow about what will happen in each case. However, I could not find out which one is the commonly accepted "corrected" place to return. Object o = null; try { Connection c = getConnection(); o = c.getThing(); return o; } catch (Exception e) { //handle exception return null; } finally { c.close(); } vs Object o = null; try { Connection c = getConnection(); o = c.getThing(); } catch (Exception e) { //handle exception return null; } finally { c.close(); } return o;
accepted answer: http://stackoverflow.com/a/23919964
score: -5
answer count: 1
favorite count: 0
tagged with: return
has comment: http://stackoverflow.com/comment/36837654
downvote count: 8
has comment: http://stackoverflow.com/comment/36836901
type: AnsweredQuestion

http://stackoverflow.com/comment/36676833
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23836148
has text: I would not of thought of different assemblies. Cool solution!
type: Comment

http://stackoverflow.com/comment/36745811
comment on: http://stackoverflow.com/q/23871931
score: 0
type: Comment
type: QuestionComment
has text: @fabian actually am not good with the database, i searched query for above condition online and couldn't find one. My colleague gave me this query has it worked in other different project, so i took this and did changes. I really don't have any idea with ternary operators? could you kindly help me with this?

http://stackoverflow.com/comment/36720115
type: QuestionComment
comment on: http://stackoverflow.com/q/23858203
has text: please post the stacktrace, otherwise we can just guess
score: 0
type: Comment

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/23900941
type: Tag

http://stackoverflow.com/a/23859703
answers question: http://stackoverflow.com/q/23859403
has body: As mentioned in the comment, I was not correctly authenticating. According to : https://api.imgur.com/oauth2, my authorization header must be: Authorization: Client-ID YOUR_CLIENT_ID Below is a fully working example for future API users. I renamed apiKey and apiSecret to with Client_ID and Client_Secret respectively to match the Imgur api page. I also added a while loop to print out the retrieved information for verification. public static void main (String[] args) throws IOException { // get your own Id and Secret by registering at https://api.imgur.com/oauth2/addclient String Client_ID = ""; String Client_Secret = ""; String YOUR_USERNAME = " "; // enter your imgur username String YOUR_REQUEST_URL = "https://api.imgur.com/3/account/YOUR_USERNAME"; URL imgURL = new URL(YOUR_REQUEST_URL); HttpURLConnection conn = (HttpURLConnection) imgURL.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", "Client-ID " + CLIENT_ID); BufferedReader bin = null; bin = new BufferedReader(new InputStreamReader(conn.getInputStream())); //below will print out bin String line; while ((line = bin.readLine()) != null) System.out.println(line); bin.close(); }
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23859403
type: Answer

http://stackoverflow.com/comment/36776562
type: Comment
has text: Use of com.google.appengine.repackaged may result in your app breaking without warning is the error
type: QuestionComment
comment on: http://stackoverflow.com/q/23888240
score: 0

http://stackoverflow.com/comment/36874860
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23927111
has text: Yes it should. Add your new code to your questions to be verified.
score: 0

http://stackoverflow.com/comment/36693263
type: Comment
type: QuestionComment
has text: Thanks. I actually ended up writing a simple observer interface. Made it slicj and simple
comment on: http://stackoverflow.com/q/23843729
score: 0

http://stackoverflow.com/comment/36743106
score: 0
type: AnswerComment
has text: how could each array printed individually when we loop all the arrays ?
type: Comment
comment on: http://stackoverflow.com/a/23870454

http://stackoverflow.com/comment/36825789
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23898937
score: 0
has text: I didnt figure it would be order of O(n^2) :p .. I will use hashset. Thank you again! :)

http://stackoverflow.com/comment/36659404
score: 0
has text: What driver version are you using?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23826823

http://stackoverflow.com/comment/36725535
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23857481
has text: Since crashes will occur all the time in code development the best use of your time now is to learn about logcat and post a stacktrace. The stacktrace will make the crash very easy to diagnose.

http://stackoverflow.com/q/23893568
has comment: http://stackoverflow.com/comment/36787008
linked to: http://stackoverflow.com/q/23653778
score: 0
duplicate of: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/36816816
tagged with: java
has comment: http://stackoverflow.com/comment/36814951
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36814880
tagged with: sql
tagged with: sqlite
answer count: 0
has title: Starting to work with SQLite and Android; errors on starting the program
has body: Recently, I have been trying to use SQL together with Android. However, my code has come into errors. The program is simple; it's supposed to take a name and an e-mail address, save it when a button is pressed, and then load the data afterwards when the Load button is pressed. So far, I've been able to narrow it down, the setOnClickListener area, and the problems are most likely in the two cases. I don't know why they are always returning errors, though. I've written programs where setOnClickListener was working, so I'm assuming the actual errors are inside the two cases I've put in. Here's the code: one MainActivity.java, one class, and one XML file. MainActivity.java: package com.example.sqlpractice; import android.support.v7.app.ActionBarActivity; import android.support.v4.app.Fragment; import android.database.Cursor; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends ActionBarActivity implements OnClickListener{ Button bSave, bLoad; EditText etName, etEmail; DataHandler handler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bSave = (Button) findViewById(R.id.bSave); bLoad = (Button) findViewById(R.id.bLoad); etName = (EditText) findViewById(R.id.etName); etEmail = (EditText) findViewById(R.id.etEmail); bSave.setOnClickListener(this); bLoad.setOnClickListener(this); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return…
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/36786974

http://stackoverflow.com/comment/36577230
comment on: http://stackoverflow.com/q/23783506
score: 1
has text: The easy solution would probably be to use a list, append to the list and then iterate over it. Right now you're tightly coupled to your data, but if you do something like that it's much more dynamic for changing sets. While you may not need it now, it may serve as a reference in the future.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23884908
tagged with: java
has answer: http://stackoverflow.com/a/23884951
type: Question
accepted answer: http://stackoverflow.com/a/23884953
score: 0
answer count: 5
has answer: http://stackoverflow.com/a/23885165
has body: Below Is My Code , I Cant figure out , how can i make the user to have only 4 tries then its say you lost , try again ? why cant this work ? i am doing something wrong in the for loop ? or should i use another loop public class JavaApplication11 { /** * @param args the command line arguments * @throws java.io.IOException */ public static void main(String[] args) throws IOException { int random = (int )(Math.random() * 10 + 1); // System.out.println("Random Number Is:"+random); double userinput = 0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("-------------------------------------------------"); System.out.println("Welcome To The Guessing Game!"); System.out.println("-------------------------------------------------"); System.out.println("Lets Start,Guess The Number:"); System.out.println("-------------------------------------------------"); userinput=Integer.parseInt(br.readLine()); for(int i=random;i&lt;=4;i++) { if(userinput==random) { System.out.println("-----------------------------------------"); System.out.println("You Won!"); System.out.println("-----------------------------------------"); } else { System.out.println("--------------------------------------------"); System.out.println("Wrong Guess,Try Again! Good Luck^_^"); System.out.println("--------------------------------------------"); } System.out.println("Created By XYZ!"); } } }
possible better answer: http://stackoverflow.com/a/23884951
has answer: http://stackoverflow.com/a/23884953
has answer: http://stackoverflow.com/a/23884992
has answer: http://stackoverflow.com/a/23885806
has title: Guessing random number game error
type: AnsweredQuestion

http://stackoverflow.com/q/23925252
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23925339
answer count: 4
has answer: http://stackoverflow.com/a/23925328
upvote count: 0
has answer: http://stackoverflow.com/a/23925279
has comment: http://stackoverflow.com/comment/36847359
type: UnansweredQuestion
tagged with: java
has body: System.out.println("Which horse do you want to win, enter in 1-5"); String horsechoice = Input.next(); int randomhorse = (int)(Math.random()*5+1); int horsechoice1 = Integer.parseInt(horsechoice); System.out.println(randomhorse); if (horsechoice1 == randomhorse){ System.out.println("You win"); int money = x + i; System.out.println("You have $"+money+ " remaining."); }else if(horsechoice1 != randomhorse){ System.out.println("You Loose"); int money = x - i; System.out.println("You have $"+money+ " remaining."); } My goal is to get the int money outside of its brackets and to another part of my code further on. I feel like it should be a lot easier then I am making it.
type: Question
has title: How to get a value outside its brackets in java
score: -1
has answer: http://stackoverflow.com/a/23925324

http://stackoverflow.com/a/23839505
accepted answer of: http://stackoverflow.com/q/23839357
score: 1
answers question: http://stackoverflow.com/q/23839357
type: Answer
has body: It seems that you want the indexOf method to act like as a predicate, where you can give a custom property to tell whether you find the first object that satisfies it. It can be done using an helper method. static &lt;T&gt; List&lt;T&gt; getSubList(List&lt;T&gt; list, Predicate&lt;T&gt; pred){ return list.subList(list.indexOf(list.stream().filter(pred).findFirst().get()), list.size()); } What it does is: get a Stream&lt;T&gt; from the list apply a filter to it find the first element that satisfied the given predicate get the object in the resulting Optional&lt;T&gt; calling get() use indexOf on the list to get the index of this object return a sublist of the original list Then you can call it like; List&lt;MyClass&gt; subList = getSubList(list, o -&gt; o.b.startsWith("10")); For a small example, here's how you can take a sublist from the first object where its String value starts with a 10 until the end of the list. public class Test { public static void main(String[] args) { List&lt;MyClass&gt; list = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; 15; i++){ list.add(new MyClass(i, String.valueOf(i))); } System.out.println(getSubList(list, o -&gt; o.s.startsWith("10"))); //[MyClass [a=10, b=10], MyClass [a=11, b=11], MyClass [a=12, b=12], MyClass [a=13, b=13], MyClass [a=14, b=14]] } static &lt;T&gt; List&lt;T&gt; getSubList(List&lt;T&gt; list, Predicate&lt;T&gt; pred){ return list.subList(list.indexOf(list.stream().filter(pred).findFirst().get()), list.size()); } } class MyClass { int i; String s; public MyClass(int i,String s){ this.i = i; this.s = s; } @Override public String toString() { return "MyClass [i=" + i + ", s=" + s + "]"; } } You can add more checks, for example to see if you have a value from the Optional (using isPresent()) you get by calling findFirst, but you have the main idea of how to do it. Hope it helps! :)
upvote count: 1
type: AcceptedAnswer
downvote count: 0

weblogic12c
tags question: http://stackoverflow.com/q/23894498
tag name: weblogic12c
type: Tag
tags question: http://stackoverflow.com/q/23929503
tags question: http://stackoverflow.com/q/23865468
tags question: http://stackoverflow.com/q/23931718

http://stackoverflow.com/a/23855937
upvote count: 1
has body: Your approach is just fine :) You created class and you inherit from her, And use one of her methods.. Of course, if you don't have anything to add to GridNewValue so you don't need the override but this is ok
answers question: http://stackoverflow.com/q/23855912
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/23899600
downvote count: 0
answers question: http://stackoverflow.com/q/23899406
type: Answer
upvote count: 1
score: 1
has body: I'd say it depends on the servlet container but normally exceptions inside the servlet code don't crash the whole server. If you're worrying about a posible memory leak here it's also unlikely to happen in this case. This exception is just a contract enforcement. The servlet container tells you that you should use either getOutputStream() or getWriter() but never both during a single request.
has comment: http://stackoverflow.com/comment/36813558

http://stackoverflow.com/q/23929947
tagged with: generics
answer count: 0
has comment: http://stackoverflow.com/comment/36855440
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36855937
tagged with: java
has title: Is it possible that declare method as a Variable in java
has comment: http://stackoverflow.com/comment/36855581
type: Question
score: 0
has body: Here is a code from googlemap cluster utility private ClusterManager.OnClusterItemInfoWindowClickListener&lt;T&gt; mItemInfoWindowClickListener; ClusterManager is a class. private final ClusterManager&lt;T&gt; mClusterManager; OnClusterItemInfoWindowClickListener is interface. public interface OnClusterItemInfoWindowClickListener&lt;T extends ClusterItem&gt; { public void onClusterItemInfoWindowClick(T item); } The question is does mItemInfoWindowClickListener variable? I can't find any example like this. and I don't know what is the purpose of this. It will be help full, If anyone explain this code or just link informative webpage. Thanks.
tagged with: variables
has comment: http://stackoverflow.com/comment/36855336
has comment: http://stackoverflow.com/comment/36855323
tagged with: interface
tagged with: android

http://stackoverflow.com/comment/36807815
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23903827
has text: Sometimes I don't know which element of cache need to be updated.I need to reload all of it from database,but I can't shutdown the service?
score: 0

http://stackoverflow.com/comment/36640362
comment on: http://stackoverflow.com/q/23816548
score: 0
type: Comment
type: QuestionComment
has text: This has nothing to do with JSP. You're making a client-side request using jQuery.

http://stackoverflow.com/q/23902577
has answer: http://stackoverflow.com/a/23945008
possible better answer: http://stackoverflow.com/a/23916693
tagged with: e4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23916693
has comment: http://stackoverflow.com/comment/36881949
type: Question
accepted answer: http://stackoverflow.com/a/23945008
has comment: http://stackoverflow.com/comment/36807562
tagged with: java
has title: Bundle is being instantiated more than once using DS
score: 0
answer count: 2
has body: I'm creating an application that has hips of bundles. Some of them are interfaces and some are implementation of those interfaces. I'm using declarative services (DS) to provide and use services, which means that each bundle has a component.xml describing the service(s) I'm providing/referencing. Currently I have a class called ClockWidget that implements 3 interfaces (as you can see in the attached diagram). For each service implemented, I have a specific class that is referencing this service. For example, the Timeout class has bind methods that receives anyone who implements the TimeoutListener service. The problem is that the constructor of the ClockWidget class is being called three times. Obviously I associated that with the number of services that it's being used by other bundles. The question is: what's a good approach/practice in order to deal with bundles that implements more than one service? I mean, I don't want this bundle to be duplicated in the application. I'd like to use the same instance in the three classes that are referencing this guy. I tried to enable the singleton property in the manifest, but nothing has changed. ClockWidget.class: public class ClockWidget implements Widget, TimeoutListener, DummyInterface { public ClockWidget() { System.out.println("ClockWidget constructor."); } @Override public String getWidgetName() { return "Clock widget"; } @Override public void onTimeout() { System.out.println("Timeout!"); } @Override public void dummyMethod() { // Does nothing. } } Its component definition ClockWidget.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="test.e4.ClockWidget"&gt; &lt;implementation class="test.e4.history.ClockWidget"/&gt; &lt;service&gt; &lt;provide interface="test.e4.widget.Widget"/&gt; &lt;provide interface="test.e4.timeoutlistener.TimeoutListener"/&gt; &lt;provide interface="test.e4.dummyinterface.DummyInterface"/&gt; &lt;/service&gt; &lt;/scr:compo…
tagged with: declarative-services
tagged with: equinox
tagged with: osgi
has comment: http://stackoverflow.com/comment/36880427

http://stackoverflow.com/a/23905879
type: Answer
has body: Use the fields. You need to store the information somewhere. That's the simpliest solution at your disposal.
score: 0
answers question: http://stackoverflow.com/q/23905777

http://stackoverflow.com/a/23791363
has body: When writing small files using BufferedWriter, the buffer is not flushed to disk until the writer is closed, which is not measured at all by your benchmark. Most writes will operate on an in-memory buffer, which will be very fast. To get a better picture of performance, you'd want to start your timer before the very first write, and stop it after the call to close() completes, and divide it by total size of the written data to get a measure of average throughput.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23791240
upvote count: 1

http://stackoverflow.com/comment/36789134
score: 0
type: AnswerComment
type: Comment
has text: @T.J.Crowder cool. OK, so how does that work? Why the field but not using the getter?
comment on: http://stackoverflow.com/a/23894443

http://stackoverflow.com/comment/36684334
type: Comment
has text: *Can* you even treat the file as a bunch of strings? Arbitrary binary data doesn't generally make valid `String`s, though I don't know whether Java enforces this.
type: QuestionComment
comment on: http://stackoverflow.com/q/23839782
score: 0

http://stackoverflow.com/comment/36795359
type: Comment
comment on: http://stackoverflow.com/a/23897629
has text: I have already shared a [ConnectionUtil](http://stackoverflow.com/questions/22999830/servlet-server-side-initialization-code-in-gwt/23006184#23006184) class where you can check for all the opened connection. Get the connection for a factory class that is common for whole application -a single point to access the connection. Get the connection for the utility, increment the counter and call its close method to decrease the counter.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36707476
has text: Its also hard to get good anti-aliasing in OpenGL without bitmaps (or custom GLSL shaders). The Libgdx ShapeRenderer definitely doesn't do any anti-aliasing.
score: 2
type: Comment
comment on: http://stackoverflow.com/a/23850483
type: AnswerComment

http://stackoverflow.com/a/23936130
type: Answer
has body: Now I'm not entirely sure if I follow you, but let me know if this helps you out at all. It's entirely JSF and I threw in some ajax. You can play around with your javascript still. Front-end: &lt;p:inputText id="input" value="#{bean.value}" /&gt; &lt;p:commandButton value="button" action="#{bean.action}"&gt; &lt;f:ajax execute="input" render="output" /&gt; &lt;/p:commandButton&gt; &lt;p:selectOneMenu id="output" value="#{bean.placeValue}"&gt; &lt;f:selectItems value="#{bean.values}" /&gt; &lt;/p:selectOneMenu&gt; Bean: @ManagedBean @RequestScoped public class Bean { private String value; private List&lt;String&gt; values; @EJB private ValueService valueService; @PostConstruct public void init() { values = valueService.list(); } public void action() { // ... Action taken } public String placeValue() { // ... Validation and clear desired values return value; } // ... (getters, setters, etc) }
has comment: http://stackoverflow.com/comment/36878947
answers question: http://stackoverflow.com/q/23920239
score: 0
has comment: http://stackoverflow.com/comment/36903262

http://stackoverflow.com/a/23928228
score: 8
answers question: http://stackoverflow.com/q/23927887
type: Answer
upvote count: 8
has body: Only one reson: 1) It reduces the Exception Handling while development public E peekFirst() { if (size==0) return null; return getFirst(); } Above is the implementation of peekFirst(), it just check the size ZERO, and returns NULL instead of throwing Exception
downvote count: 0

http://stackoverflow.com/a/23938339
has comment: http://stackoverflow.com/comment/36872502
score: 1
has body: There are different 4 ways to transfer data from JSF Page To Backing Bean. We can use f:param f:setPropertyActionListener f:attribute Method expression (JSF 2.0). Here you can try f:setPropertyActionListener as.. &lt;h:commandButton value="redirect to result" action="resultPage?faces-redirect=true"&gt; &lt;f:setPropertyActionListener target="#{postRedirectResult.number}" value=4 /&gt; &lt;/h:commandButton&gt; Here is the link for this.
has comment: http://stackoverflow.com/comment/36871244
answers question: http://stackoverflow.com/q/23936733
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/23915319
downvote count: 1
has comment: http://stackoverflow.com/comment/36828100
tagged with: java
answer count: 4
has comment: http://stackoverflow.com/comment/36837720
linked to: http://stackoverflow.com/q/15031386
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39051332
favorite count: 0
has answer: http://stackoverflow.com/a/35552133
has title: How to turn off proguard completely?
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/52293907
upvote count: 6
has answer: http://stackoverflow.com/a/54467322
tagged with: proguard
has comment: http://stackoverflow.com/comment/36828083
has body: I have an Android application on which I don't want to do anything regarding optimization/obfuscation/etc. I deleted the (auto-generated) proguard configuration file (proguard.cfg) but I think my library projects' files are still being obfuscated, because in the crash reports I don't see the line numbers - Unknown Source is shown instead. How can I turn off proguard completely? Also, how can I validate that it was indeed turned off?
score: 5

http://stackoverflow.com/comment/36684190
type: AnswerComment
comment on: http://stackoverflow.com/a/23839560
type: Comment
has text: Okay, i made some corrections and it now runs properly. The only problem is that the balls no longer move correctly. Am i passing the Ball objects to the moveBalls() method properly?
score: 0

http://stackoverflow.com/comment/36726069
score: 0
type: Comment
type: QuestionComment
has text: How about, in each of your `while` loops, before you do the division, you could print out the dividend and the divisor. Would that work for you?
comment on: http://stackoverflow.com/q/23861315

http://stackoverflow.com/comment/36868769
type: AnswerComment
comment on: http://stackoverflow.com/a/23937017
type: Comment
score: 0
has text: I understand, but the 'getting started' states explicitly to "Store !!SocialAuthManager object in session". So how would I do this now, or what do if I don't store it?

http://stackoverflow.com/q/23787866
tagged with: serialization
score: 0
has comment: http://stackoverflow.com/comment/36585546
has comment: http://stackoverflow.com/comment/36586366
answer count: 0
has title: Where to put java serialization code
type: UnansweredQuestion
has body: I have a number of objects that are serializable. I am considering whether to place the actual serialization code in a separate utility class vs putting the serialization for each object into each object methods as a save/load methods. Utility Class pros : serialization all in one place can be tested all at once. Code works even when add new field to object. cons : not very object oriented Serialization methods in each object pros : More Object Oriented cons : for load need to explicitly change code if new field is added Would anyone be able to give there thoughts on this. Mayby there is a best practice here that I can use ? Currently I have implemented/tested the utility class method Frank.
has comment: http://stackoverflow.com/comment/36585244
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36843610
has comment: http://stackoverflow.com/comment/36586678

http://stackoverflow.com/comment/36838379
has text: I am starting to look at something important one user had mentioned, but not sure if it will shape up to be my problem yet: "I finally got my form validation to work. As it turned out, Spring was adding the BindingResult object to the model, but under a different name (the classname beginning with lower case) than the command name I am using in my form tag. Changing the command name to reflect the name Spring is using to add the BindingResult to the model, got my form validation to work as expected"
score: 0
comment on: http://stackoverflow.com/q/23920284
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23903884
has body: I'd use a master table with all the data, then materialized views for each chunk, and I'd update the materialized views from the master table daily. Here a "materialized view" can just be another table that you TRUNCATE then INSERT INTO ... SELECT to populate. Or you can be a bit trickier and do a partial DELETE followed by a partial INSERT INTO ... SELECT of only the new data. It's not really clear why you need this in the first place though. Views are often quite sufficient.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23896128

http://stackoverflow.com/q/23871459
has comment: http://stackoverflow.com/comment/36769070
has comment: http://stackoverflow.com/comment/36763132
answer count: 2
has body: I'm creating an OCR based on Java. My objective is to extract text from a video file (post-processing). It has been a difficult search, trying to find free, open-source OCR that works purely on Java. I found Tess4J to be the only popular option, but given the need for the native interface, I somehow felt inclined towards developing the algorithm from scratch. I need to create a dependable OCR that properly identifies English alphabets (computerized typefaces only, not handwritten text) with reasonable accuracy, given that the region in which the text lies in the video frame is pre-defined. We can also assume that the color of the text is given. What I've done so far: (All image processing done using Java bindings for openCV) I've extracted features for training my classifier using: A. Pixel intensities, after down-sampling the character image to 12 X 12 resolution. (144 feature vectors) B. Gabor wavelet transform across 8 different angles (0, 11.25, 22.5 ...etc) and the computed energy using mean squared value of the signal for all these angles. (8 feature vectors) A+B gives me the feature vector of the images. (Total 152 feature vectors) I've 62 classes for classification, viz. 0,1,2...9 | a,b,c,d...y,z | A,B,C,D...Y,Z I train the classifier using 20 x 62 samples (20 for each class). For classification, I've used the following two approach: A. ANN with 1 hidden layer (of 120 nodes). Input layer has 152 nodes and output has 62. Hidden and output layer have sigmoid activation function and the network is trained using Resilient Back Propagation. B. kNN classification for the entire 152 dimensions. Where I stand: k-Nearest Neighbor search is turning out to be a better classifier than neural network (so far). However, even with kNN, I'm finding it difficult to classify letters like: OR . Moreover, it is classifying as Z... to name few of the anomalies. What I'm looking for: I want to find out the following: Why is ANN under-performing? What configuration of network shou…
tagged with: neural-network
has title: OCR algorithm improvement
favorite count: 0
has answer: http://stackoverflow.com/a/30813412
has comment: http://stackoverflow.com/comment/49716363
has answer: http://stackoverflow.com/a/30781588
has comment: http://stackoverflow.com/comment/36747544
tagged with: ocr
tagged with: knn
type: UnansweredQuestion
downvote count: 1
upvote count: 16
type: Question
tagged with: opencv
tagged with: java
score: 15

http://stackoverflow.com/comment/36577018
has text: @j.con above class is my composite class, there are 4 keys bind as a composite
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23783248

http://stackoverflow.com/comment/36826881
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23911735
has text: That's interesting... what are your thoughts on making a standard practice of putting all field variables in an ArrayList<Object>? I guess with a parallel enum naming the indices?

http://stackoverflow.com/comment/36738919
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23868582
has text: Using a more intelligent compiler this might work, you can write a FR if you like.

http://stackoverflow.com/comment/36793412
has text: I'm not looking at the source code at the moment, could you elaborate how indexes are evaluated. For example `session.attribute["foo"]` evaluated because `session` has a method `getAttribute(String name)`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23894944

http://stackoverflow.com/comment/36728414
score: 0
type: Comment
type: QuestionComment
has text: You could look at JME2 (Java Micro Edition) and possibly even [CodeName One](http://www.codenameone.com/)
comment on: http://stackoverflow.com/q/23862725

http://stackoverflow.com/a/23843354
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23841550
downvote count: 0
type: Answer
has body: No compiler would be so stupid as to actually emit a full division for it. But that doesn't mean there's no difference. A signed division by 2 is more complicated than a right shift, you'd have to do something like this: mov edi, eax shr eax, 31 add eax, edi sar eax, 1 Unless you can prove that the number you're dividing by 2 is non-negative. That would require proving hi &gt;= lo. In a binary search, that might just be feasible (if there's an if (hi &lt; lo) return false; or something like that before calculating the middle). Even then the division way still has 3 operations versus 2 of the shift version. Maybe a sufficiently smart JIT compiler can see through that as well, but we're asking more and more of it now. The old interpreters of the beginning days of Java certainly wouldn't have done any of this, and neither would the first JIT compilers. So there's a small advantage to writing hi + lo &gt;&gt;&gt; 1, and there are really no downsides. So why wouldn't they use it?

http://stackoverflow.com/q/23811134
has answer: http://stackoverflow.com/a/56072017
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36639020
accepted answer: http://stackoverflow.com/a/23876508
has comment: http://stackoverflow.com/comment/36666608
tagged with: java
tagged with: selenium
tagged with: selendroid
has comment: http://stackoverflow.com/comment/36638448
type: Question
has title: SelendroidDriver not in jar file
linked to: http://stackoverflow.com/q/1334802
has body: I have recently written a Selenium program in Java that works perfectly with the FireFoxDriver(). My step 2 is to be able to run this program on my Android device with Selendroid. I went on their website here and have been able to download the jar and connect to their localhost with port:4444. However, when I try their example, Eclipse doesn't recognize the SelendroidDriver() and suggests me to go back to WebDriver(). Here is their code: SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.10.0"); // My error appears when I create the new SelendroidDriver(). WebDriver driver = new SelendroidDriver(capa); WebElement inputField = driver.findElement(By.id("my_text_field")); Assert.assertEquals("true", inputField.getAttribute("enabled")); inputField.sendKeys("Selendroid"); Assert.assertEquals("Selendroid", inputField.getText()); driver.quit(); I have also noticed that the SelendroidDriver class does not appear in my files although I downloaded the Selendroid jar file, version 0.10.0.
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23876508
has comment: http://stackoverflow.com/comment/36642580
has answer: http://stackoverflow.com/a/23831018
score: 1
has comment: http://stackoverflow.com/comment/36639256
favorite count: 0
has comment: http://stackoverflow.com/comment/36638647
possible better answer: http://stackoverflow.com/a/23831018
upvote count: 1

http://stackoverflow.com/a/23887562
has comment: http://stackoverflow.com/comment/36775084
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23887325
has body: The problem I think is that you are retrieving getArguments() on onActivityCreated and there you didn't create the bundle yet (You are creating it in the onClick). You should either check if getArguments() returns null or create your bundle out of the onClick. Former version would be: if (getArguments() != null){ String str = getArguments().getString("btn1_clicks").toString(); }
has comment: http://stackoverflow.com/comment/36776032
has comment: http://stackoverflow.com/comment/36775571
type: Answer
accepted answer of: http://stackoverflow.com/q/23887325
has comment: http://stackoverflow.com/comment/36775198
upvote count: 1
score: 1

http://stackoverflow.com/comment/36747687
has text: SOMEONE TO CLOSE THIS QUESTION PLEASE
comment on: http://stackoverflow.com/q/23869758
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36806549
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23903556
has text: basically what it is telling you, is that from you static main, you needs to either call static methods or create an object and call methods on the object.
score: 0

http://stackoverflow.com/comment/36651255
comment on: http://stackoverflow.com/q/23822428
has text: myhadoopJob.setInputFormatClass(KeyValueTextInputFormat.class); myhadoopJob.setOutputFormatClass(TextOutputFormat.class);
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36662554
type: Comment
type: QuestionComment
score: 1
has text: @double_word_disruptor https://blog.codecentric.de/en/2010/08/invoking-system-gc-can-have-serious-impact/ [Here's one example that's technically a good use, but it's not really an example, click to see why](http://stackoverflow.com/a/66694/1768232)
comment on: http://stackoverflow.com/q/23828425

http://stackoverflow.com/q/23842095
has comment: http://stackoverflow.com/comment/36689970
type: Question
downvote count: 0
has body: I need to show that my vehicle is being charged. Charging starts when start button is clicked and stops when stop button is clicked on GUI. i have a GUI for this work where i have to have some kind of image representation to show the status. (Something like our cell phone battery) I am using SWT. Any Suggestion, regarding, how to go about it, will be appreciated.
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: swt
upvote count: 1
has title: How to show battery charging status
score: 1
tagged with: java

http://stackoverflow.com/comment/36696981
has text: Sorry, you lost me a bit there. Are you saying *your* object `abc.class` doesn't work on the 32 bit environment as well?
comment on: http://stackoverflow.com/q/23846479
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23863859
type: Answer
score: 2
upvote count: 2
has body: provide HTML. I tried auto suggestion on redbus.in &amp; is working without using Action class. Here is a code which works for me on FF/Chrome- driver.get("http://www.redbus.in/"); driver.findElement(By.xpath(".//*[@id='txtSource']")).sendKeys("pune"); driver.findElement(By.xpath(".//*[@id='txtDestination']")).sendKeys("Chennai"); Please provide url or html so we can dig more in to it. Below code is working for me on FF(http://in.via.com/bus-tickets)- driver.get("http://in.via.com/bus-tickets/"); WebElement from = driver.findElement(By.xpath(".//*[@id='autocomplete_source']")); WebElement to =driver.findElement(By.xpath(".//*[@id='autocomplete_dest']")); from.clear(); from.sendKeys("Pune"); to.clear(); to.sendKeys("Chennai"); WebDriverWait wait=new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("html/body/div[9]/ul/li"))); driver.findElement(By.xpath("html/body/div[9]/ul/li")).click(); //clicking submit driver.findElement(By.xpath(".//*[@id='bookingDiv']/div[21]/input")).click();
accepted answer of: http://stackoverflow.com/q/23863425
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23863425

http://stackoverflow.com/comment/36655189
comment on: http://stackoverflow.com/a/23822952
type: AnswerComment
score: 0
type: Comment
has text: Did you try to set a higher `closeTimeout`?

http://stackoverflow.com/a/23865319
type: Answer
has body: Tried with the following code. Worked for me: WebDriver driver = new FirefoxDriver(); driver.get("http://in.via.com/bus-tickets"); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.findElement(By.xpath("//input[@id='autocomplete_source']")) .clear(); driver.findElement(By.xpath("//input[@id='autocomplete_source']")) .sendKeys("Chen"); driver.findElement( By.xpath("//div[@class='acResults'][1]//li[1]//span")).click(); driver.findElement(By.xpath("//input[@id='autocomplete_dest']")) .clear(); driver.findElement(By.xpath("//input[@id='autocomplete_dest']")) .sendKeys("Co"); driver.findElement( By.xpath("//div[@class='acResults'][2]//li[1]//span")).click();
answers question: http://stackoverflow.com/q/23863425
score: 0

elasticsearch
tags question: http://stackoverflow.com/q/23939487
tags question: http://stackoverflow.com/q/23883110
type: Tag
tags question: http://stackoverflow.com/q/23828367
tags question: http://stackoverflow.com/q/23800718
tags question: http://stackoverflow.com/q/23797939
tag name: elasticsearch
tags question: http://stackoverflow.com/q/23932483

http://stackoverflow.com/a/23903391
has comment: http://stackoverflow.com/comment/36806316
score: 0
type: AcceptedAnswer
type: Answer
has body: In Mysql you can do: CREATE TABLE tablename IF NOT EXISTS... This will, as the name says, create the table if there is no table with the same name, described here. If you run it whenever you open the connection to the database, you should be fine. BUT this is no guarantee that the existing table has the format you want! If you change the definition of the table halfway through the process, because you want an extra column, you will need to delete the existing table fist, for the changes in the query to have an effect.
has comment: http://stackoverflow.com/comment/36806040
accepted answer of: http://stackoverflow.com/q/23903272
answers question: http://stackoverflow.com/q/23903272

http://stackoverflow.com/q/23937798
tagged with: onclick
tagged with: java
answer count: 2
linked to: http://stackoverflow.com/q/1238355
has comment: http://stackoverflow.com/comment/36870186
tagged with: button
has body: When I click a button, I want it to give click a textbox beside it. However, just giving focus to the textbox wont work. I actually need to click it, the user can do it manually but how do I do it programmatically? Button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //Click the texbox } });
tagged with: textbox
duplicate of: http://stackoverflow.com/q/1238355
has comment: http://stackoverflow.com/comment/36870306
score: 0
has answer: http://stackoverflow.com/a/23938331
accepted answer: http://stackoverflow.com/a/23938331
possible better answer: http://stackoverflow.com/a/23938234
has title: how to call click() function for a textbox in gwt
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/23938234
type: AnsweredQuestion

http://stackoverflow.com/comment/36579912
comment on: http://stackoverflow.com/a/23784794
type: Comment
has text: I have already integrate Volley in a lot of class, change to piccaso will take me a lot of time Thank's for your reponses anyway
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36810401
type: QuestionComment
comment on: http://stackoverflow.com/q/23905546
score: 0
has text: Use UIL Library https://github.com/nostra13/Android-Universal-Image-Loader
type: Comment

http://stackoverflow.com/q/23885486
answer count: 7
has answer: http://stackoverflow.com/a/23885567
possible better answer: http://stackoverflow.com/a/23885542
has title: Why the order of return type matters when we define a method in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/23885827
has comment: http://stackoverflow.com/comment/36771291
has answer: http://stackoverflow.com/a/23885542
has comment: http://stackoverflow.com/comment/36771120
has body: public void static final finalMethod() { //This throws error saying "Syntax error on token //"void", volatile expected" } public static final void finalMethod() { } works fine. Why the order plays an important role in defining a method? Why java expects the volatile keyword here?
score: 3
has answer: http://stackoverflow.com/a/23885594
has answer: http://stackoverflow.com/a/23885553
tagged with: syntax
downvote count: 2
has answer: http://stackoverflow.com/a/23885560
has answer: http://stackoverflow.com/a/23885718
type: AnsweredQuestion
upvote count: 5
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23885553
has comment: http://stackoverflow.com/comment/36771411

http://stackoverflow.com/comment/36814758
comment on: http://stackoverflow.com/q/23907526
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23820274
answer count: 0
has comment: http://stackoverflow.com/comment/36648394
upvote count: 1
type: Question
score: 1
tagged with: java
has body: Good day, The following code works when I select an image from the Google Photo app. However, when I select the same image from Samsung stock gallery, my app crashes. I did some troubleshooting and realize the problem is with the getContentResolver().query(): @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; //Error happens when program try to run the following line of code Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); Toast.makeText(getApplicationContext(), picturePath, Toast.LENGTH_LONG).show(); } } Please help me. Thank you.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36649139
type: UnansweredQuestion
has title: Android: App crashes when selecting image from Samsung gallery (but it works with Google Photo app)
tagged with: android

http://stackoverflow.com/comment/36742945
score: 6
comment on: http://stackoverflow.com/q/23870478
has text: Why do you want to know? Just interested in what you're use case is.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23909433
has answer: http://stackoverflow.com/a/23910646
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36817471
has comment: http://stackoverflow.com/comment/36816907
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23928856
tagged with: jradiobutton
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/36817355
has body: There is a private member in Page1.java which is combo box public class Page1 extends javax.swing.JInternalFrame { private javax.swing.JComboBox jComboMonth; public JComboBox getjComboMonth() { return jComboMonth; } public void setjComboMonth(JComboBox jComboMonth) { this.jComboMonth = jComboMonth; } public void showList() { jComboMonth.removeAllItems(); jComboMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"April-June", "July-September", "October-December"})); } public void showList1() { System.out.println("Inside showlist1 method");//for testing jComboMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"April-June", "July-September", "October-December", "January-February"})); } } AND HERE IS THE CODE IN scrollpane.java WHERE IS TO RADIO BUTTONS AND i WANT TO POPULATE TWO DIFFERENT LISTS IN A SAME COMBOBOX WHICH IS RESIDE IN Page1.java, BY CLICKING THOSE TWO DIFFERENT RADIO BUTTON public class scrollPane extends javax.swing.JFrame { private javax.swing.JRadioButton jRadioAnnual; private javax.swing.JRadioButton jRadioQuarter; private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup2; private javax.swing.ButtonGroup buttonGroup3; private javax.swing.ButtonGroup buttonGroup4; public scrollPane() { initComponents(); } private void jRadioAnnualActionPerformed(java.awt.event.ActionEvent evt) { : Page1 pg1 = new Page1(); pg1.showList(); } private void jRadioQuarterActionPerformed(java.awt.event.ActionEvent evt) { Page1 pg1 = new Page1(); pg1.showList1(); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new scrollPane().setVisible(true); } }); } BUT STILL NOW THE COMBOBOX DOES NOT POPULATE THE LIST :(
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36816985
has title: How to change list items of a combobox onclick of two different radio button
has answer: http://stackoverflow.com/a/40483668

http://stackoverflow.com/q/23885954
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36772798
type: Question
tagged with: callable
score: 0
has comment: http://stackoverflow.com/comment/36772535
answer count: 1
has title: Wanting to specify a bit of work for a specific thread
has answer: http://stackoverflow.com/a/23886074
has body: In a Java test (it's actually a groovy / grails test using Java Threading), I want do something like this, in pseudo code do / check work for user 1 on thread 1 do / check work for user 2 on thread 2 do / check work for user 1 on thread 1 do / check work for user 2 on thread 2 do / check work for user 1 on thread 1 So specific work for a specific thread. I notice with the Execturors, you just submit to a pool so you can't specify which thread to use. But I need to specify the thread, as I want to check a certain condition is thread safe. I was thinking of just creating two threads and then putting the work in Callables, then in Futures and putting the Futures into the the specific threads or creating two ExcutorsService with threadpool size of 1. Any tips or better ideas?

http://stackoverflow.com/q/23862729
has comment: http://stackoverflow.com/comment/36728895
score: 0
tagged with: sql
has body: I am trying to extract date column 'startdate' from mysql table named 'course' but unable to do. It shows unknown column 'startdate' I am using jsp to get the date and print in jsp file. column 'startdate' is extracted and stored in java.mysql.Date type. But still it shows exception. I'm unable to figure out what it is. The following exception is showed. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'startdate' in 'field list' Code if as follow <%@ page import="java.sql.*"%> <% Connection con; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch(Exception e) { System.out.println("Failed to load mySQL driver..."); return; } PreparedStatement stat ; ResultSet result; String url = "jdbc:mysql://localhost/ftk?user=root"; con = DriverManager.getConnection(url); stat = con.prepareStatement("select COUNT(*) from batch where startdate is NULL and enddate is NULL"); result = stat.executeQuery(); result.next(); int count = result.getInt(1); String batchid[] = new String[count]; stat = con.prepareStatement("select batchid from batch where startdate is NULL and enddate is NULL"); result = stat.executeQuery(); int i=0; while(result.next()) { batchid[i++] = result.getString(1); } %> Generate Schedule <%for(i=0; i<count; i++) { %> <option value="<%=batchid[i]%>"><%= batchid[i] %> <% } %> <% if(request.getParameter("schedule")!=null) {%> Display Schedule Phase 1 Foundation Training CourseID Course Name Category Start Date End Date <% Statement stmt; String coursename,category; sdate,edate; int courseid,cid; stmt = con.createStatement(); result = stmt.executeQuery("select courseid,coursename,category,startdate,enddate from course where phase=1"); while(result.next()) { courseid = result.getInt(1); coursename = result.getString(2); category = result.getString(3); sdate = result.getDate(4); edate = result.getDate(5); %> <%= courseid %> <%= coursename %> <%= category %> <%= sdate %> <%= edate %> <% } %> Phase 2 Technology Training CourseID Cou…
tagged with: jdbc
has answer: http://stackoverflow.com/a/23862919
has comment: http://stackoverflow.com/comment/36729604
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36728488
accepted answer: http://stackoverflow.com/a/23862919
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36729280
has title: Unknown column 'startdate' in fieldlist in mysql jdbc
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/23870993
accepted answer: http://stackoverflow.com/a/23871936
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/23871936
tagged with: junit
has comment: http://stackoverflow.com/comment/36744576
has body: I'm trying to write a specific JUnit Runner, and I did not find good tutorials / examples online. The requirements are the following : I will have some categorized tests (e.g A.java from category catA, B.java from category catA, C.java from Category catC Each test has a single @BeforeClass method that needs to be run if the test is launched alone When launching all tests from the same category, the @BeforeClass method must only be launched once. Each @Test method from a Junit Test also has @Before and @After methods. That being said, I looked at the different options available. I started by creating Test Suites which would represent my test categories, using the provided junit Suite Runner. (@RunWith(Suite.class)) You need to manually provide the Tests in the suite, using @SuiteClasses() which is annoying. So I looked at the ClasspathSuite Runner, which allows to put all classes from the classpath in every suite, and filter them after with @Category It also provides a @BeforeSuite annotation that is launched once when the suite is launched. => Everything is almost perfect. When a single test is launched, the @BeforeClass from this test is launched When a Test Suite is launched, the correct Tests are launched (thanks to the @Category), the @BeforeSuite is called only once, but the @BeforeClass of every Test is also called, where it should not. => All these things led me to think about implementing my own Runner. I tried extending the ClasspathSuite Runner, but it is not designed to do so. I tried extending the stock Suite Runner, but I did not succeed. Could you help me understand how to implement these requirements in a JUnit Runner?
favorite count: 0
tagged with: junit-runner
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: How to write a JUnit runner that runs a @BeforeCategory method before a TestCase in a @Category?
type: Question

http://stackoverflow.com/comment/36607076
has text: Why can't you make the ID auto_increment instead of asking select max(id) ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23798971
score: 0

http://stackoverflow.com/comment/36673606
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23832830
has text: @MickG Replace `\n` with `System.lineSeparator()`.

http://stackoverflow.com/q/23798953
type: Question
has comment: http://stackoverflow.com/comment/36606243
tagged with: java
score: 2
has comment: http://stackoverflow.com/comment/36651213
downvote count: 0
answer count: 1
tagged with: powershell
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/36657972
has title: Java runs in CMD but not in Powershell
has comment: http://stackoverflow.com/comment/36632856
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23799508
has body: So, I am not new to Java and compiling in cmd but I am pretty new to using windows powershell. I have 'javac' and 'java' commands running fine in CMD and all java programs compile using netbeans and eclipse. I can also use javac inside windows powershell with no problems, but when attempting to run a java program, i.e. java MyProgram, after compiling it I get the following error... Error: could not open 'C:\Program Files (x86)\Java\jre7\lib\jvm.cfg Now I am running Java 8, so I have no idea why it would be looking for a file like this since CMD confirms that both 'java' and 'javac' are running version 8 and have the correct path set, or they would not run there. And please do not just tell me more about setting the paths because I have checked and checked and checked again. Also, I have made sure that anything that is related to java version 7 that I could find has been uninstalled / deleted. Well, any advice would be appreciated. Thanks a bunch.
tagged with: java-8
tagged with: classpath
has comment: http://stackoverflow.com/comment/36658066

http://stackoverflow.com/q/23839782
tagged with: java
accepted answer: http://stackoverflow.com/a/23839888
has comment: http://stackoverflow.com/comment/36684402
type: Question
has title: Which is faster - comparing binary data or line-wise strings?
answer count: 1
has comment: http://stackoverflow.com/comment/36684702
has comment: http://stackoverflow.com/comment/36684593
tagged with: string
has comment: http://stackoverflow.com/comment/36684473
tagged with: binary-data
score: 0
has body: Problem I am describing a very simplified version of my problem here. I have a huge file (10-50GB) which I need to split into millions of chunks. Suppose I have certain lines containing a string "SPLITTER". I need to split the file by those lines. Each chunk will contain the text between two SPLITTER lines. This is of course very simplified, and the actual use-case will involve a bit more complicated matching/splitting. Question So we have a streaming matching problem here. Which is more efficient: Treat this like a string matching problem, use a buffered reader to read lines and compare and split depending upon that? - OR - Treat the file like a binary input stream, treat the splitter strings like an Array[Byte] and do byte-wise comparisons? I need to get an insight before I start implementing something. I am using Java. Also, the original input will decompressed from bz2 on-the-fly, for what it's worth.
has answer: http://stackoverflow.com/a/23839888
has comment: http://stackoverflow.com/comment/36684837
has comment: http://stackoverflow.com/comment/36684334
has comment: http://stackoverflow.com/comment/36684547
tagged with: string-matching
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/q/23924003
favorite count: 0
linked to: http://stackoverflow.com/q/27581
has answer: http://stackoverflow.com/a/23924551
accepted answer: http://stackoverflow.com/a/23924551
has comment: http://stackoverflow.com/comment/36844867
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/2265503
tagged with: java
has body: I am writing the image processing program, and I have a problem with a list. I have a list with Points. class Point1{ private int x; private int y; Point1(int x,int y) { this.x = x; this.y = y; } int getX(){ return this.x; } int getY() {return this.y; } } ArrayList&lt;Point1&gt; list = new ArrayList(); And now, I create new Point, for example new Point(4,3); I want to check if there is a point in my list which has the same coordinates. The problem is that list.contains(Object a) is checking if if on my list there is a particular object. It will work if I put Point1 first = new Point(1,1); list.add(first); list.contains(first) // and this is true but: Point second = new Point(2,2); list.add(second); list.contains(new Point(2,2)); &lt;- false how can I check it?
has title: checking if list contains the object - java
type: Question
has comment: http://stackoverflow.com/comment/36844859
has comment: http://stackoverflow.com/comment/36844833
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/23924020
has answer: http://stackoverflow.com/a/23924020

http://stackoverflow.com/comment/36652696
type: QuestionComment
type: Comment
has text: Those would be entirely equivalent in practice, save that neither of them are as efficient as they could be: you should use `new double[features.size()][]`.
score: 0
comment on: http://stackoverflow.com/q/23823080

http://stackoverflow.com/comment/36674420
has text: Oleg, the WeatherDatabaseCreator file does nothing else except take the json files on the command line and pass them to the parser, make the appropriate connections with the database, and initiate the file parsing. I don't think including the rest of the code would be of any use.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23834744

http://stackoverflow.com/comment/36687525
score: 0
comment on: http://stackoverflow.com/q/23841232
has text: One approach you may take is to have `OtherRunnable` check the states of all the other threads before calling notify all. If `OtherRunnable` sees any threads of `MyRunnable` are not in the waiting state, sleep and check again until all your `MyRunnable` threads are in the waiting state. See [Thread.State](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.State.html). (I didn't post this as an answer because it seems rather hacky to me, but I suppose it should get the job done.)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36633828
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23812609
score: 0
has text: Ok thanks sir what code should i write on servlet part a last help from you side

http://stackoverflow.com/comment/36828147
type: QuestionComment
has text: It looks like `u == 2*x` at all times, so perhaps someone thought that it would be more efficient to keep a separate `u` instead of just saying `E += 2 * x` (before incrementing `x`). This could conceivably be slightly more efficient if the algorithm is written in assembly language on some processors, although it's hard to imagine, since I don't recall ever seeing a processor without at least a "shift left 1 bit" instruction.
score: 0
comment on: http://stackoverflow.com/q/23914892
type: Comment

http://stackoverflow.com/comment/36671283
score: 0
type: QuestionComment
has text: Not sure I'm following you. When I call the REST service I get a page with the JAXBException message. I expect to get the XML representation of the Banana class
type: Comment
comment on: http://stackoverflow.com/q/23832707

http://stackoverflow.com/comment/36619423
type: Comment
comment on: http://stackoverflow.com/q/23806026
type: QuestionComment
has text: That is just as unhelpful as the first time you said, it. Can you tell us what is *does* do.
score: 1

http://stackoverflow.com/comment/36823763
type: Comment
has text: You should override the equals() method of the company so that you can say with guarantee that one is equal another. For example create a hashcode and compare it.
score: 0
comment on: http://stackoverflow.com/q/23912929
type: QuestionComment

http://stackoverflow.com/q/23887226
type: Question
has comment: http://stackoverflow.com/comment/36776067
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36776201
has answer: http://stackoverflow.com/a/23887414
has body: I have a strange situation: I want to switch one class in library, so I created jar with this class and I loaded this to Oracle - and this threw error about too new class version (and that was true, I didn't noticed that I compiled it with JDK8). So I recompiled it with JDK5 and loaded again, but... it throws the same error again, UnsupportedClassVersionError. I checked in SYS.ALL_JAVA_CLASSES and this classes has major 49.0 number. I tried to load all library, and it didn't help. I tried to drop this classes and load again, drop all library and load again - nothing changed. In my opinion this error sholudn't happens any more, but DB still throws it. Any ideas why it happens? And what should I do? P.S. Sorry for terrible english...
answer count: 2
upvote count: 1
has title: UnsupportedClassVersion 52.0 error though I recompiled class under JDK5 in Oracle DB
favorite count: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36777878
has comment: http://stackoverflow.com/comment/36777094
has comment: http://stackoverflow.com/comment/36776723
has answer: http://stackoverflow.com/a/24012606
accepted answer: http://stackoverflow.com/a/24012606
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23887414

http://stackoverflow.com/q/23902218
has title: How can I encrypt email message by recipient's certificate?
type: UnansweredQuestion
tagged with: encryption
has body: I'm using javamail-crypto-bouncycastle-smime library for email digital signature and encryption. I have checked some examples for email encryption from Internet, and they always use the public key which store in keystore. But I need to use the public key which store in recipient's certificate. I know how to get public key from X.509 certificate. CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); FileInputStream fis = new FileInputStream(new File("certFile.cer"))); Certificate cert = cert = certFactory.generateCertificate(fis); Key pKey = cert.getPublicKey(); And I have a sample code for encryption eamil message by javamail-crypto-bouncycastle-smime. EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME); char[] smimePw = new String(_smimePw).toCharArray(); EncryptionKeyManager smimeKeyMgr = smimeUtils.createKeyManager(); smimeKeyMgr.loadPublicKeystore(new FileInputStream(_filepk12), smimePw); Key smimeKey = smimeKeyMgr.getPublicKey(_alias); MimeMessage smimeEncryptedMsg = smimeUtils.encryptMessage(session, message, smimeKey); The problem is the sample code use pk12 public key, but what I have is X.509 public key which don't need password. How can I encrypt email message by recipient's X.509 certificate?
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36846735
has comment: http://stackoverflow.com/comment/36819209
score: 0
tagged with: jakarta-mail

http://stackoverflow.com/a/23792092
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23791751
type: Answer
has body: You can use String.format to control the format in general. Unfortunately I can't see any way of combining that with a custom pattern directly, but you can compose them. For example: import java.math.*; import java.text.*; public class Test { public static void main(String[] args) { showPrice(new BigDecimal("123.456")); showPrice(new BigDecimal("11.12")); showPrice(new BigDecimal("10.5")); showPrice(new BigDecimal("1.5")); showPrice(new BigDecimal("0.5")); } static void showPrice(BigDecimal price) { DecimalFormat format = new DecimalFormat("0.00"); String text = String.format("Price: $%5s", format.format(price)); System.out.println(text); } } Output: Price: $123.46 Price: $11.12 Price: $10.50 Price: $ 1.50 Price: $ 0.50 Note that: The $ signs are still aligned (the space comes after that) The "wide" price doesn't look good, but there's not much you can do about that Using "0.00" instead of "##.## means the last price is "0.50" rather than ".5" You can use String.format to format all of your data, controlling the width of fields with the format specifier. You might want to use spaces instead of tabs to make it easier to ensure it's aligned.
score: 0
accepted answer of: http://stackoverflow.com/q/23791751

http://stackoverflow.com/a/23881591
has body: In order to find out if a site is blocked by your network administrator, you need to check the content received : URL url = new URL("http://www.gmail.com"); URLConnection connection = url.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); byte[] b = new byte[1024]; while(is.available()&gt;0) { is.read(b); System.out.println(new String(b)); } You should analyze the content from input stream and based on that you can decide. I tried it and it gave me the HTML page set by network admin. If your company using any proxy than you need to set following as well: System.setProperty("http.proxyHost", "&lt;proxy address&gt;"); System.setProperty("http.proxyPort", "&lt;proxy port&gt;"); Hope this helps
has comment: http://stackoverflow.com/comment/36763835
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36763955
score: 2
answers question: http://stackoverflow.com/q/23881410
downvote count: 0

http://stackoverflow.com/comment/36657117
type: Comment
has text: why are you calling getText and setText on a method, rather than on a component?
type: QuestionComment
comment on: http://stackoverflow.com/q/23825805
score: 0

http://stackoverflow.com/q/23780135
has answer: http://stackoverflow.com/a/23782045
type: AnsweredQuestion
score: 3
favorite count: 0
has title: Association class Mapping in Hibernate
tagged with: mapping
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1153409
accepted answer: http://stackoverflow.com/a/23782045
linked to: http://stackoverflow.com/q/8971643
upvote count: 3
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23782417
has answer: http://stackoverflow.com/a/23782417
downvote count: 0
has body: I'm a student and I'm new in Hibernate framework, I have a association class and I want to know how to map it the Situation : Entity_1[0..\*]-------------------------[0..\*]Entity_2 | | | | | Association class Date_affectation Date_expiration What the association rule should I use ?

http://stackoverflow.com/a/23990636
answers question: http://stackoverflow.com/q/23923534
score: 0
accepted answer of: http://stackoverflow.com/q/23923534
type: AcceptedAnswer
type: Answer
has body: There is NO problem with multiple connections in embedded mode. Full stop. That said, what you may have come across, is that only one jvm process can access the Derby database files at a time. But that jvm may well have 1000s of threads each with their own connection to Derby (resources permitting, of course).

http://stackoverflow.com/q/23893118
answer count: 1
has comment: http://stackoverflow.com/comment/110064567
tagged with: avro
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23957375
score: 3
downvote count: 0
favorite count: 0
has body: I'm looking to map Avro models. Given an input of Avro A, I need to transform it and return back Avro B. The use case is that I receive Avro models from a service, transform them to match our use case, and restore them in a new Avro model. Currently I'm looking into Dozer as a possibility, but I'm wondering if I'm missing something or if there are better options out there. Googling about isn't yielding much, or I'm searching for the completely wrong things. Avro returns random plane parts, and map tends to get confused with the Java variant of a Hash, making it interesting to find results for. For context, I refer to map as a function that is applied to a list of elements to transform them.
type: Question
tagged with: dictionary
tagged with: dozer
has comment: http://stackoverflow.com/comment/37127544
upvote count: 3
tagged with: java
has title: Mapping Avro Models

http://stackoverflow.com/comment/36671124
type: Comment
type: QuestionComment
has text: Yes, I'm calling a RESTful service
comment on: http://stackoverflow.com/q/23832707
score: 0

http://stackoverflow.com/comment/36781536
has text: Didn't work yet with JBehave but possibly this [article](http://www.javacodegeeks.com/2012/09/behavior-driven-development-bdd-with.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JavaCodeGeeks+%28Java+Code+Geeks%29) helps
type: Comment
comment on: http://stackoverflow.com/a/23888993
score: 0
type: AnswerComment

login-attempts
type: Tag
tag name: login-attempts
tags question: http://stackoverflow.com/q/23923730

http://stackoverflow.com/a/23883748
answers question: http://stackoverflow.com/q/23883724
score: 3
has comment: http://stackoverflow.com/comment/36767899
downvote count: 0
type: Answer
has body: (username.equals(modUsernames)) You should not compare String to Array and if username is an array than you can't check whether both are eqaul like this. Use Arrays.equals(ar1,ar2) for this. Or use array index and use loop to check one by one. username.equals(modUsernames[0]) Or you can use Arrays.toString() and use contains method Arrays.toString(modUsernames).contains(username);
has comment: http://stackoverflow.com/comment/36767637
upvote count: 3

http://stackoverflow.com/comment/37183080
has text: The fields are encapsulated: The fields `x`, `y` and `z` are private. The reason why the first code works: The method `dot` is inside `Vector3D`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24050316
score: 0
type: Comment

titan
tags question: http://stackoverflow.com/q/23798563
tags question: http://stackoverflow.com/q/23801992
tag name: titan
type: Tag

http://stackoverflow.com/comment/36591687
comment on: http://stackoverflow.com/a/23791025
type: Comment
has text: You have to create the JTextField object before you can add it to your JFrame: BonusB = new JTextField(); add(BonusB);
score: 0
type: AnswerComment

http://stackoverflow.com/q/23888941
has title: Replace old fragment to add new fragment inside viewpager
answer count: 3
has body: I have this code. in setting fragment i had button when click that button i want to view new fragment. public class TabsPagerAdapter extends FragmentPagerAdapter { public TabsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { switch (index) { case 0: // Top Rated fragment activity Log.i("TAB", "Home"); return new HomePage(); case 1: // Games fragment activity Log.i("TAB", "Contact"); return new GetContacts(); case 2: // Movies fragment activity Log.i("TAB", "Setting"); return new Settings(); } return null; } i extends FragmentPageAapter.
has answer: http://stackoverflow.com/a/23890075
has comment: http://stackoverflow.com/comment/36777722
has comment: http://stackoverflow.com/comment/36777776
linked to: http://stackoverflow.com/q/18413309
tagged with: android
has comment: http://stackoverflow.com/comment/36779834
has answer: http://stackoverflow.com/a/23889068
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/41220585
has comment: http://stackoverflow.com/comment/36777619
tagged with: android-fragments

jtextfield
tags question: http://stackoverflow.com/q/23856818
tags question: http://stackoverflow.com/q/23823071
tags question: http://stackoverflow.com/q/23893082
tags question: http://stackoverflow.com/q/23874584
tags question: http://stackoverflow.com/q/23907498
tags question: http://stackoverflow.com/q/23803762
tags question: http://stackoverflow.com/q/23904731
tags question: http://stackoverflow.com/q/23907758
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/23924363
tags question: http://stackoverflow.com/q/23872862
tags question: http://stackoverflow.com/q/23843027
tags question: http://stackoverflow.com/q/23857430
tags question: http://stackoverflow.com/q/23903749
tags question: http://stackoverflow.com/q/23814551
tags question: http://stackoverflow.com/q/23874256

http://stackoverflow.com/a/23828787
has body: Why shouldn't you? The adapter pattern even offers itself to be used with DTOs. You can use it to "translate" your DTOs into whatever is suitable for your application and back. Lets say you have an API that is using DTOs. Now you want to use that API. There could be a lot of reasons why you don't want to use the DTOs in your client code as they are. Maybe your client already exists and you don't wan't to change it. Or the data structure of the DTOs is just not suitable to be shown in a GUI. In this case you can introduce an adapter. It's API would use the classes used in your client and it would call your existing API with the DTOs.
accepted answer of: http://stackoverflow.com/q/23828669
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23828669
upvote count: 2
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36664143
has comment: http://stackoverflow.com/comment/36664286
has comment: http://stackoverflow.com/comment/36664789

http://stackoverflow.com/a/23951166
score: 0
answers question: http://stackoverflow.com/q/23939937
type: Answer
has body: Tim B's answer is probably the best approach, I would just like to mention that since the class is just an int and a string, you can use the predefined datastructure std::pair. Just have an array of these pairs and sort by the string. To do this you can use std::sort() defined in , if I'm not wrong std::sort is a MergeSort. You can override the compare function defined with your own. I find it extremely convenient to use pair in such situations as yours. Make sure you include . Look into http://www.cplusplus.com/reference/utility/pair/ for reference. Look into http://www.cplusplus.com/reference/algorithm/sort/ for reference.

http://stackoverflow.com/comment/36804695
has text: +1 I appreciate your answer having the way to handle test scenarios
type: Comment
comment on: http://stackoverflow.com/a/23899722
type: AnswerComment
score: 0

http://stackoverflow.com/q/23892521
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23892647
tagged with: java
has title: Android :add spinner and editText dynamically raising an exception
type: Question
tagged with: android-spinner
score: 0
has body: I'm trying to add dinamically spinner and two editText , but i'm having an exception . Well i suspect this line of code : ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,R.id.simple_spinner_item,items); Because when i tryed to display an empty spinner and two editTexts ,it worked perfectly, but when added values to the spinner ,it crashed. I think the problem is comming from : R.id.simple_spinner_item ,i added the simple simple_spinner_item in xml file. This my java code : LinearLayout linearLayout = (LinearLayout) findViewById(R.id.SSIDZone); String[] items = new String[]{ "3","4","5","6","7","8","9","10","11","12","13"}; for (int i =0;i&lt;number;i++) { LinearLayout l = new LinearLayout(this); l.setOrientation(LinearLayout.HORIZONTAL); Spinner spin = new Spinner(this); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,R.id.simple_spinner_item,items);//suspected line LayoutParams lp3 = new LayoutParams(); l.addView(spin,lp3); spin.setAdapter(adapter); EditText text1 = new EditText(this); LayoutParams lp1 = new LayoutParams(); l.addView(text1,lp1); EditText text2 = new EditText(this); LayoutParams lp2 = new LayoutParams(); l.addView(text2,lp2); linearLayout.addView(l); } And this my xml layout : &lt;LinearLayout android:id="@+id/SSIDZone" android:layout_width="312dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/linearLayout1" android:layout_marginTop="88dp" android:layout_weight="0.46" android:background="#30ad9e" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/simple_spinner_item" android:layout_width="100dp" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; And finaly this is my LogCat : 05-27 15:36:25.989: E/AndroidRuntime(24818): FATAL EXCEPTION: main 05-27 15:36:25.989: E/AndroidRuntime(24818): android.content.res.Resources$NotFound…
answer count: 1

http://stackoverflow.com/comment/36773555
comment on: http://stackoverflow.com/a/23884802
has text: Should be a comment not an answer.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/36572055
has text: Could you explain in bit more detail please? With regards to this example? Thanks
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23780715
type: Comment

http://stackoverflow.com/q/23923923
has comment: http://stackoverflow.com/comment/36844725
tagged with: calculator
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/23923965
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6841333
downvote count: 6
tagged with: java
has title: How does google calculate time
has comment: http://stackoverflow.com/comment/36846376
type: Question
has body: I'm working on a java program that calculates a given amount of seconds to the amount of years, days, hours, all the way to plancks. I can enter in the google search bar "31 years, 259 days, 5 hours, 54 minutes" and i'll get a result stating "31.7097916 years." How does it calculate this? I'd like to implement this into my program if possible.
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36844685

http://stackoverflow.com/q/23779450
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/23780829
has body: I am trying to get all permutations of strings(words) in a java array list with two words.Following is the code i tried but i am not getting all permutations of words in the list. for (int y = 0; y&lt;newList.size(); y++){ String first = newList.get(y); String second = ""; if(y+1&lt;newList.size()){ second = newList.get(y+1); } ArrayList&lt;String&gt; tmpArr = new ArrayList&lt;String&gt;(); tmpArr.add(first); tmpArr.add(second); ArrayList&lt;String&gt; retArray = combine(tmpArr); for (int c = 0; c &lt;retArray.size(); c++) { System.out.println(retArray.get(c)); } } public static ArrayList&lt;String&gt; combine(ArrayList&lt;String&gt; arr){ ArrayList&lt;String&gt; retArr = new ArrayList&lt;String&gt;(); if(arr.size()==0){ retArr.add(""); return retArr; } ArrayList&lt;String&gt; tmpArr = (ArrayList&lt;String&gt;)arr.clone(); tmpArr.remove(0); for(String str1 : combine(tmpArr)){ for(String str2 : arr){ retArr.add(str2+","+str1); if(retArr.size() == 10) return retArr; } } return retArr; } Please let me know how to correct the code to get all permutations of words in the list with size 2(all permutations of words with two words as output) For example if the input data is as follows Input - [visit,party,delegation] Expected Output - [visit,party visit,delegation party,visit party,delegation delegation,visit delegation,party] Current Output - [visit,party, party,party, party,delegation, delegation,delegation,]
score: 0
has comment: http://stackoverflow.com/comment/36572188
has answer: http://stackoverflow.com/a/23780522
has comment: http://stackoverflow.com/comment/36572636
type: UnansweredQuestion
has title: how to get all permutations of strings in an array list by specified size
tagged with: java
has comment: http://stackoverflow.com/comment/36569844
type: Question

http://stackoverflow.com/q/23832959
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/23841275
tagged with: android
has comment: http://stackoverflow.com/comment/36671238
tagged with: service
has answer: http://stackoverflow.com/a/23841275
type: AnsweredQuestion
tagged with: java
has title: Image Button state is needed in my service
type: Question
has body: So I have a service that is started when a button is clicked. When the service starts I disable the button that was clicked, but I want to enable it again once the service is finished. If I create an instance of the calling class in the service class, I get a null pointer exception. I have no idea how to enable the button again. If I do it just after I call the "stopService()" then the button just stays enabled. Please help. Thanks guys. Code -> service class package com.project.llb; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.widget.Toast; public class SetupTimer extends Service { Handler handler; runGraphics runG; int timerCount = 0; @Override public IBinder onBind(Intent intent) { return null; }//end onBind function @Override public void onCreate() { super.onCreate(); handler = new Handler(); timerCount++; handler.postDelayed(runnable, 1000); }//end onCreate function private Runnable runnable = new Runnable() { public void run() { timerCount++; if (timerCount &lt; 3) { handler.postDelayed(runnable, 1000); }//end if else { runG.polarCap1.setEnabled(true); //this will not work handler.removeCallbacks(runnable); }//end else }//end run function };//end runnable @Override public int onStartCommand(Intent intent, int flags, int startId) { return Service.START_NOT_STICKY; }//end onStartCommand function }//end SetupTimer class and here is my button function in the calling class: polarCap1 = (ImageButton) findViewById(R.id.polarCapButton1); polarCap1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //button cannot be clicked polarCap1.setEnabled(false); //start service for timer startService(new Intent(runGraphics.this, SetupTimer.class)); //stop service for timer stopService(new Intent(runGraphics.this, SetupTimer.class)); //button can be clicked again //polarCap1.setEnabled(true); }//end onClick function });//end setOnClickListener and this is my logcat:…
tagged with: handler
has comment: http://stackoverflow.com/comment/36671533
answer count: 1
score: 0

http://stackoverflow.com/comment/36679390
has text: The font is not a default one on the system. I must specify it from I file I assume? I do not want to have the user install it either.
comment on: http://stackoverflow.com/a/23836247
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36844661
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23919468
has text: Even then, I'm pretty sure you can set up breakpoint actions that also log in eclipse. http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_add_brk_action.htm

http://stackoverflow.com/a/23830609
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23830283
has body: You can refactor the application for example to create the Scanner on start and closing it when the application exits. public static void main(String[] args) { Scanner reader = new Scanner(System.in); do { showMainMenu(); setMainMenuChoice(getChoiceFromUser(reader)); } while (getMainMenuChoice() != '5'); reader.close(); } . . . private static char getChoiceFromUser(Scanner reader) { char choice = reader.next().charAt(0); return choice; }

http://stackoverflow.com/a/23788216
has body: I'm not a part of Akka team so i can only guess here. But here's my understanding why i would object to the approach you've described. When message is not implemented in the receive function, it does nothing. Most importantly, it doesn't break my system! I can compose behaviors - say, I want uninitialized behavior that is composed of initializationHandler orElse lifecycleHandler orElse unknownMessageHandler and easily switch to businnessProcessHandler orElse lifecycleHandler orElse unknownMessageHandler, which in your case will lead either to code duplication, and/or storing local state I can parameterize my behavior! You can safely have the code like def receive = businessProcessHandler(timeout = 5 millis), and my partial function will have the timeout available without actually storing it in the actor object.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23785766
upvote count: 2
has comment: http://stackoverflow.com/comment/36586956

opencv
type: Tag
tags question: http://stackoverflow.com/q/23922005
tags question: http://stackoverflow.com/q/23921906
tags question: http://stackoverflow.com/q/23860014
tag name: opencv
tags question: http://stackoverflow.com/q/23828078
tags question: http://stackoverflow.com/q/23829935
tags question: http://stackoverflow.com/q/23875462
tags question: http://stackoverflow.com/q/23871459

http://stackoverflow.com/comment/36683063
comment on: http://stackoverflow.com/q/23839072
score: 2
has text: Are you using an IDE? Because it doesn't compile in Eclipse but does with javac for me.
type: QuestionComment
type: Comment

multidimensional-array
tags question: http://stackoverflow.com/q/23790396
tags question: http://stackoverflow.com/q/23847936
type: Tag
tags question: http://stackoverflow.com/q/23788496
tags question: http://stackoverflow.com/q/23832922
tags question: http://stackoverflow.com/q/23785828
tag name: multidimensional-array

http://stackoverflow.com/q/23842928
has body: So I have this code in my main class: import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JLabel; @SuppressWarnings("serial") public class Main extends JPanel{ private final int height = 285; private final int width = 416; private static final double appversion = 0.1; private BufferedImage sdk001; private static final String appname = "App's Name"; private static final String appstage = "Alpha"; private JFrame frame; public Main() { try { sdk001 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk001.png")); frame = new JFrame(appname + " (" + appversion + " " + appstage + ")"); frame.add(new Main()); frame.setSize(1020, 680); frame.setVisible(true); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); } catch (IOException e) { Logger LogErr = Logger.getLogger(Main.class.getName()); System.err.println("Caught IOException: " + e.getMessage()); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(sdk001, 0, 0, height, width, null); } public static void main(String[] args) { Main main = new Main(); JFrame frame = main.getFrame(); } public JFrame getFrame() { return frame; } And I tried to call it in my "A" class, here's the code: import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.Graphics; import java.awt.image.BufferedImage; public class A { public A(Main main){ JFrame frame = main.getFrame(); frame.add(new JLabel("Hi OtherClass did this") ); } The code returns without error but no JFrame, or any GUI, showing up. Can anyone help me with this; I'm quite baffled by this. Thanks.
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23842966
accepted answer: http://stackoverflow.com/a/23842966
upvote count: 1
has comment: http://stackoverflow.com/comment/36689877
has title: Calling another JFrame/JPanel from another Class
answer count: 1
favorite count: 0
tagged with: netbeans

http://stackoverflow.com/a/23804216
has comment: http://stackoverflow.com/comment/36616094
answers question: http://stackoverflow.com/q/23804094
has comment: http://stackoverflow.com/comment/36615737
has comment: http://stackoverflow.com/comment/36615965
score: 0
type: Answer
has body: Why don't you add all the event names as the first element in your &lt;string-array&gt;. This way your event names will be tightly coupled to their respective times.

http://stackoverflow.com/comment/36841765
type: Comment
has text: Just by any mean, do you have declared some class with name `String` among your classes?
score: 1
comment on: http://stackoverflow.com/q/23922387
type: QuestionComment

http://stackoverflow.com/comment/36844689
has text: I've double checked, it and it seems perfectly fine
comment on: http://stackoverflow.com/a/23923769
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23828078
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/29048085
has comment: http://stackoverflow.com/comment/36665163
has title: neither findContour for largest rectangle nor corner detection by hough transform working for me
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: opencv
tagged with: hough-transform
has comment: http://stackoverflow.com/comment/36662055
linked to: http://stackoverflow.com/q/17512234
has body: I have been trying to detect largest rectangle/square on clicked image. I tried both contour Android OpenCV Find Largest Square or Rectangle and hough transform http://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/ . Both work like charm on image selected from gallery. But when I integrate with image taken from camera , it fails most of the times. Can anyone tell me what is the reason behind it ? what am I missing here ? As far as I know ,it's possible as many scan apps like camscanner does it very beautifully with more than 90% accuracy. Please suggest. I have tried alot. For reference : public static String houghTransform(Mat original_image ,String outFile) { Mat imgSource = original_image; Mat untouched = original_image.clone(); //convert the image to black and white Imgproc.cvtColor(imgSource, imgSource, Imgproc.COLOR_BGR2GRAY); //apply gaussian blur to smoothen lines of dots Imgproc.GaussianBlur(imgSource, imgSource, new Size(5, 5), 0); //adaptive threshold thresholds the image taking an optimum value for a local neighbourhood. //Imgproc.adaptiveThreshold(imgSource, imgSource, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY, 3, 1); //convert the image to black and white does (8 bit) Imgproc.Canny(imgSource, imgSource, 80, 100); Mat lines = new Mat(); int threshold = 70; int minLineSize = 20; int lineGap = 20; Imgproc.HoughLinesP(imgSource, lines, 1, Math.PI/180, threshold, minLineSize, lineGap); ArrayList&lt;Point&gt; corners = new ArrayList&lt;Point&gt;(); for (int i = 0; i &lt; lines.cols(); i++) { for (int j = i+1; j &lt; lines.cols(); j++) { Point pt = computeIntersect(lines.get(0,i), lines.get(0,j)); if (pt.x &gt;= 0 &amp;&amp; pt.y &gt;= 0) corners.add(pt); } } L.v("Points corner size: ", ""+corners.size()); if(corners.size()&lt;4){ return ""; } Point center = new Point(0,0); // Get mass center for (int i = 0; i &lt; corners.size(); i++){ center.x += corners.get(i).x; center.y+= corners.get(i).y; } cen…
tagged with: contour
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23924999
answers question: http://stackoverflow.com/q/23924827
upvote count: 1
has body: The package names have changed in the newest versions. Change your AdView to match the following: com.google.android.gms.ads.AdView Here is a complete tutorial on making all of the changes: https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23924827

http://stackoverflow.com/comment/36863125
comment on: http://stackoverflow.com/q/23898332
has text: Throwing an exception is not triggering a restart.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36866164
has text: That is very true. However if you want to mitigate issues use an enumeration to save via the serializer instead of the objects themselves. That way when you change the code you are adjusting that the enumerations mapping only. Basically you have Map<Location<>,TileEnum> that you save and use a switch case or some other construct to relate the TileEnum to the tiles you want to use in the game. Note this will not work if you are trying to save game state and the tiles have a state they can be in.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23934209

http://stackoverflow.com/comment/36572716
has text: I assume you use ; as delimeter? have you tried putting something between the last two ;'s? at this moment, there is no String there, so pretty normal it won't return anything
comment on: http://stackoverflow.com/q/23781142
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36656906
has text: @DownVoter: Bother to mention the reason for downvote.
type: AnswerComment
comment on: http://stackoverflow.com/a/23822909
score: 0
type: Comment

http://stackoverflow.com/q/23899515
has answer: http://stackoverflow.com/a/23899884
has comment: http://stackoverflow.com/comment/36799195
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37063707
has title: Swing PixelGrabber - Sorting Data
accepted answer: http://stackoverflow.com/a/23899884
tagged with: image-processing
has comment: http://stackoverflow.com/comment/36798981
tagged with: swing
type: Question
tagged with: java
tagged with: image
score: 0
has body: I am working on sorting an images colors into a 2d array (rows/columns) of colors. I've implemented a PixelGrabber, but I'm having trouble understanding exactly whats happening, and what I can do with data to sort into a 2d array. Thanks! File file = fc.getSelectedFile(); try { BufferedImage img = ImageIO.read(file); PixelGrabber grabber = new PixelGrabber(img, 0, 0, -1, -1, false); if (grabber.grabPixels()) { int width = grabber.getWidth(); int height = grabber.getHeight(); int[][] imageColors = new int[width][height]; //I want to store colors in here int[] data = (int[]) grabber.getPixels(); } } catch (Exception f) { }
has comment: http://stackoverflow.com/comment/36799215
answer count: 1

http://stackoverflow.com/a/24221503
downvote count: 0
answers question: http://stackoverflow.com/q/23798847
type: Answer
upvote count: 1
score: 1
has body: I don't know how to do it from an Android client, but I can show you how we did it from a javascript client as it might give you some pointers. Client side is quite simple (this is an angular.js controller), we get the url to use and upload to it // model file upload $scope.onFileSelect = function ($files) { $scope.uploadStatus = 'loading'; for (var i = 0; i &lt; $files.length; i++) { var file = $files[i]; console.log(file); $http.get('/endpoints/prototype/' + $scope.prototype.key + '/file/url') .success((function (data) { console.log(data); $scope.upload = $upload.upload({ url: data, withCredentials: true, file: file }) .success(function (data) { console.log(data); $scope.prototype.modelFile = data; }) .error(function (data, status) { console.error(data); $scope.uploadStatus = 'error'; $scope.uploadError = status; }); })) .error((function (data, status) { console.error(data); $scope.uploadStatus = 'error'; $scope.uploadError = status; })); } }; Server side, we have the endpoint which returns the URL to use for the post (this is a Spring MVC controller). Note that we specify the success path in createUploadUrl() @RequestMapping(value = "/endpoints/prototype/{key}/file/url", method = RequestMethod.GET) @ResponseBody public String getFileUploadUrl(@PathVariable("key") String prototypeKey) { final UploadOptions uploadOptions = Builder.withDefaults() .googleStorageBucketName("palmyra-prototype-store"); return blobstoreService.createUploadUrl("/endpoints/prototype/" + prototypeKey + "/file", uploadOptions); } Finally, the endpoint invoked after the upload is succeesful @RequestMapping(value = "/endpoints/prototype/{key}/file", method = RequestMethod.POST) @ResponseBody public String handleFileUpload(@PathVariable("key") String prototypeKey, HttpServletRequest request) { final Map&lt;String, List&lt;BlobKey&gt;&gt; blobs = blobstoreService.getUploads(request); final Map&lt;String, List&lt;FileInfo&gt;&gt; allFileInfos = blobstoreService.getFileInfos(request); final List&l…

http://stackoverflow.com/q/23855860
has body: We want to realize a SSO-infrastructure with some IBM Domino / Websphere products and one custom web application. All IBM products are configured for SSO. Therefore, the WebSphere Application Server 8 generates an LTPAToken2 after successful login in one of the IBM products. We want to achieve the same behaviour for our own custom web application. After login into this web app, a LTPAToken2 should be generated. Therefore my question: Is it possible to generate a valid LTPAToken2 in our custom web application? Or maybe, is it possible to use the WebSphere Application Server APIs for this generation? Which steps would be nessecary to achieve this? At the moment, our custom web application is not hosted in a WAS, but on a Tomcat. Thanks and best regards Ben
downvote count: 0
tagged with: websphere-8
favorite count: 0
has title: Generate LTPAToken 2 in custom Web Application
tagged with: single-sign-on
has answer: http://stackoverflow.com/a/23872486
has answer: http://stackoverflow.com/a/23865522
upvote count: 2
possible better answer: http://stackoverflow.com/a/23872486
type: AnsweredQuestion
score: 2
tagged with: ltpa
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23865522
answer count: 2
tagged with: websphere

http://stackoverflow.com/q/23807104
tagged with: sql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36625034
has answer: http://stackoverflow.com/a/23819040
has body: I'm doing a school project so I'm really not an advanced programmer and need a little help with a query that I need to make. My db structure looks like this. RECIPE table: ID BIGINT 19 DESCRIPTION CLOB 2147483647 NAME VARCHAR 255 INGREDIENT table: ID BIGINT 19 NAME VARCHAR 255 RECIPE_INGREDIENT table: RECIPE_ID BIGINT 19 INGREDIENTS_ID BIGINT 19 This is my model class Recipe @Entity public class Recipe extends Model { @ManyToMany(cascade=CascadeType.ALL) public List&lt;Ingredient&gt; ingredients; @Required @Unique public String name; @Lob @Required public String description; This is my model class Ingredient @Entity public class Ingredient extends Model { @Required @Unique public String name; The query I want to make is... I have a string with comma separated ingredients like milk,flour,egg for example. With that string I'd like to fetch all recipes which has exact those ingredients, lets say one Recipe only has flour as ingredient then that's true. Also a recipe with all mentioned etc etc. I've modified a query string I found yesterday(can't remember where) but I can't get it to work. I get this error: IllegalArgumentException occured : org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 68 [select Recipe.name from models.Recipe inner join Recipe_Ingredient on Recipe.ID = Recipe_Ingredient.Recipe_ID inner join Ingredient on Recipe_Ingredient.Ingredient_ID = Ingredient.ID where Ingredient.name in ( 'milk') group by Recipe.name having count(*) = 2] Any help would be much appreciated! And sorry if I made any mistakes with this post. It is my first here :) Edit: Query right now looks like this: Query query = JPA.em().createQuery("SELECT Recipe.name " + "FROM Recipe INNER JOIN " + "Recipe_Ingredient ON Recipe.ID = Recipe_Ingredient.Recipe_ID " + "INNER JOIN Ingredient " + "ON Recipe_Ingredient.Ingredient_ID = Ingredient.ID " + "WHERE Ingredient.name " + "IN ("+ingredientsCSV+") " + "GROUP BY Recipe.name HAVING count(*) = 2");
has answer: http://stackoverflow.com/a/23807433
has title: Many to Many query Find all "recipes" with XX ingredients
tagged with: java
has comment: http://stackoverflow.com/comment/36623725
type: Question
tagged with: many-to-many
has comment: http://stackoverflow.com/comment/36623117
score: 0
has comment: http://stackoverflow.com/comment/36624284
answer count: 2
tagged with: playframework

http://stackoverflow.com/q/23913101
has answer: http://stackoverflow.com/a/23913198
has title: How can call a method from another class for Test
favorite count: 0
possible better answer: http://stackoverflow.com/a/23913526
has body: I'm trying to invoke a method from another class using java. So what i have is a class invoking log method from another class, it's working well. After this i want to invoke another method from another class to get current url. So here my classe A and B question: how can i invoke the method to get thr current url? Thank you public class A{ private String url; public A(WebDriver driver){ url = driver.getCurrentUrl(); System.out.println("The current URL is:"+url); Util.wait(5); } public class B { @BeforeClass public static void Log(){ //some code here to check if log is ok } @Test public void A(){ A test1 = new A(driver); String url2 =test1.A(); }
has answer: http://stackoverflow.com/a/23913526
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/23913198

http://stackoverflow.com/q/23813076
tagged with: java
tagged with: hibernate
answer count: 3
has answer: http://stackoverflow.com/a/43751671
has body: I am having a problem inserting a parent and associated children records into an Oracle 11g database using Hibernate 4.3.5. I have a Record class that contains a set of Image objects. Record class mapping: <?xml version="1.0"?> <column name="REC_ID" precision="10" scale="0"/> RECORDS_SEQ ... <key column="IMG_REC_ID"/> <one-to-many class="com.wts.service.model.Image"/> Image class mapping: <?xml version="1.0"?> <column name="IMG_ID" precision="10" scale="0"/> IMAGES_SEQ <many-to-one name="record" column="IMG_REC_ID" not-null="true"/> When I call session.save() on the record, I get the following error: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("IMAGES"."IMG_REC_ID") I followed the bidirectional one-to-many hibernate association guide and many different variations, but I could never get Hibernate to insert Record's primary key into the Image's foreign key column! This is a very simple association (and common use case), so I must be doing something a little bit off here. Does anyone have any idea what I am doing wrong here?? EDIT: I have also tried setting the key to not-null, and I get the same error: <key column="IMG_REC_ID" not-null="true"/> <one-to-many class="com.wts.service.model.Image"/> Also, as a side note, I am able to get this to work when I don't have inverse="true" set. The following code works (the Record and Image(s) are persisted to the database), but the Images object isn't able to have the many-to-one association set: <key column="IMG_REC_ID" not-null="true"/> <one-to-many class="com.wts.service.model.Image"/> EDIT 2: Here is my code where I am calling session.save(). The images are already associated with the record and are populated via a REST web service POST. The record and the images were not previously persisted. public void createRecord(Record record) { //set the create bys for the images and actions record.setCreateDt(new Date()); for (Image image : record.getImages()) { image.setCreateBy(record.getC…
has answer: http://stackoverflow.com/a/23814737
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23814737
favorite count: 0
possible better answer: http://stackoverflow.com/a/23813498
has answer: http://stackoverflow.com/a/23813498
type: Question
tagged with: oracle-database
score: 1
has title: Problems inserting many-to-one row in Hibernate with Oracle
tagged with: hibernate-mapping
upvote count: 1

http://stackoverflow.com/a/23808499
downvote count: 0
has comment: http://stackoverflow.com/comment/36623880
type: Answer
upvote count: 47
has body: There are so many ways, You can store your JSON file in assets folder and read them like this - https://stackoverflow.com/a/19945484/713778 You can store it in res/raw folder and read the same as show here - https://stackoverflow.com/a/6349913/713778 For basic JSON parsing, Android's in-built JSONObject should work - https://developer.android.com/reference/org/json/JSONObject.html For more advanced JSON parsing (json-java mapping), you can look at GSON library - https://code.google.com/p/google-gson/
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23808365
score: 47
answers question: http://stackoverflow.com/q/23808365

http://stackoverflow.com/q/23880833
has comment: http://stackoverflow.com/comment/36762300
score: -3
accepted answer: http://stackoverflow.com/a/23880896
has comment: http://stackoverflow.com/comment/36762326
has body: Okay following is my Simmulation.java file and I am supposed to write main method for it to work. But I have no idea how to do it. I have tried like following, but it didn't work! public static void main(String args[]) { new Simmulation(args[0]); } Any help is much appreciated. Thank you in advance This is my Simmulation.java file import java.io.File; import java.util.LinkedList; import java.util.Queue; import java.util.*; import java.util.Scanner; import java.io.*; public class Simmulation implements Operation { Queue &lt; CashewPallet &gt; inputQueue = new LinkedList &lt; CashewPallet &gt; (); Stack &lt; CashewPallet &gt; stBay1 = new Stack &lt; CashewPallet &gt; (); Stack &lt; CashewPallet &gt; stBay2 = new Stack &lt; CashewPallet &gt; (); FileOutputStream fout4; PrintWriter pw; static int tick = 0; CashewPallet c1; String temp; Scanner sc; public Simmulation(String fn) { int index = 0; String nutType = ""; int id = 0; Scanner s2; try { sc = new Scanner(new File(fn)); fout4 = new FileOutputStream("nuts.txt"); pw = new PrintWriter(fout4, true); String eol = System.getProperty("line.separator"); // Reading string line by line while (sc.hasNextLine()) { tick++; s2 = new Scanner(sc.nextLine()); if (s2.hasNext()) { while (s2.hasNext()) { String s = s2.next(); if (index == 0) { nutType = s; } else { id = Integer.parseInt(s); } index++; } System.out.println("Nuttype " + nutType + " Id is " + id + "tick " + tick); if ((nutType.equalsIgnoreCase("A") || nutType.equalsIgnoreCase("P") || nutType.equalsIgnoreCase("C") || nutType.equalsIgnoreCase("W")) &amp;&amp; id != 0) inputQueue.add(new CashewPallet(nutType.toUpperCase(), id)); System.out.println("Size of Queue " + inputQueue.size()); int k = 0; if (!inputQueue.isEmpty()) { while (inputQueue.size() &gt; k) { // stBay1.push(inputQueue.poll()); process(inputQueue.poll()); k++; } // System.out.println("Size of input "+inputQueue.size() +" Size of stay "+stBay1.size()); } } else { fout4.write(" ".getBytes()); } index = 0; if (…
downvote count: 3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23880896
tagged with: java
has title: How to write main method for this code?
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/36762253
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36762313
has comment: http://stackoverflow.com/comment/36762250
has comment: http://stackoverflow.com/comment/36762296

http://stackoverflow.com/a/23865157
accepted answer of: http://stackoverflow.com/q/23865115
answers question: http://stackoverflow.com/q/23865115
has comment: http://stackoverflow.com/comment/36733207
score: 0
has comment: http://stackoverflow.com/comment/36733081
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36733123
has body: You can do this. Enter the name of columns you need to insert String sqlInsert= "INSERT INTO " + "'"+name+"' (Type,Text,OtherFormats ,Date,Image,RealName )VALUES ("+"'"+ID+"'"+","+"'"+Type+"'"+","+"'"+Text+"'"+","+ "'"+OtherFormats+"'"+","+"'"+Date+"'"+" ,"+"'"+Image+"'"+","+"'"+RealName+"')"; db.execSQL(sqlInsert);

http://stackoverflow.com/comment/36599930
type: Comment
type: QuestionComment
has text: @costa , I do not familiar with java. Tuple are sound like a good idea if there are no better solutions. :/
comment on: http://stackoverflow.com/q/23795376
score: 0

http://stackoverflow.com/q/23901070
accepted answer: http://stackoverflow.com/a/23901125
score: 0
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
has title: Match the request URL to the correct URL pattern in web.xml
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/23901125
answer count: 1
tagged with: tomcat
tagged with: web.xml
has body: I am trying to learn how to map a request URL to a url pattern in deployment descriptor. I got all the answers right, but I am not sure if the thought process is correct. Please help me to confirm or make changes in the reasoning. One foo.DeployTestOne One *.do Two foo.DeployTestTwo Two /fooStuff/bar Three foo.DeployTestThree Three /fooStuff/* 1) http://localhost:8080/MapTest/blue.do Container choice: DeployTestOne (matched the *.do extension pattern) Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/blue.do ? NO. Directory match check: Is there any URL pattern in DD for directory /MapTest ? NO. Extension match: Is there a pattern in DD for files with extension .do ? Yes ! Select DeployTestOne ! Question - When doing an Exact match check, does the container look for blue.do in DD or does it look for /MapTest/blue.do ? 2) http://localhost:8080/MapTest/fooStuff/bar/blue.do Container choice: DeployTestThree (matched the /fooStuff/* directory pattern) Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/fooStuff/bar/blue.do ? NO. Directory match check: Is there any URL pattern in DD for directory /MapTest/fooStuff/bar ? Yes ! Go for the url pattern for longest pat, that is, /fooStuff/* Question - When doing the directory match check, does the Container look for /MapTest/fooStuff/bar/ or just /fooStuff/bar ?

http://stackoverflow.com/comment/36913651
has text: @RobbyPond: I'm not sure to well understand what you are looking for.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23791742
type: Comment

http://stackoverflow.com/a/23795883
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23795757
has body: You can use this Regular expression : import java.util.regex.Matcher; import java.util.regex.Pattern; String str3 = "MonkeysDogsCatsPandasPolarBear"; String str1 = "Cats"; String str2 = "Bear"; Pattern pattern = Pattern.compile("(?&lt;=" + str1 + ")(.*?)(?=" + str2 + ")"); Matcher matcher = pattern.matcher(str3); if (matcher.find()) { System.out.println(matcher.group(1)); } output : PandasPolar
upvote count: 2
has comment: http://stackoverflow.com/comment/36600740
type: Answer
has comment: http://stackoverflow.com/comment/36600676

http://stackoverflow.com/q/23819008
has title: How do open a internal frame only once
type: AnsweredQuestion
has body: The following code opens a JInternalFrame when a button is clicked. But I want this window to be opened once, so if the user clicks that button again it will not open another frame instead it would bring to the front the window whether it is iconified, behind another window, etc. I have tried a couple of ways mainly using a counter, but the problems is once the frame is closed it doesn't open it again either. Is there another easy way to do this, cause I am not able to make it work properly. Thanks in advance. Below is the code I am working on: public class About implements ActionListener{ private int openFrameCount; private JDesktopPane desk; private JTextArea Tarea; private JScrollPane scroll; private BufferedReader in ; int count =0; MyInternalFrame frame; public About(JDesktopPane desktop) { // TODO Auto-generated constructor stub desk = desktop; System.out.println(count); } @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub count += 1; if(count == 1){ frame = new MyInternalFrame("SAD Imaging"); count +=1; try { in = new BufferedReader(new FileReader("SADInfo.txt")); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String line; String file = ""; try { while((line = in.readLine()) != null) { System.out.println(line); file += line; file +="\n"; } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { in.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Tarea = new JTextArea(); //System.out.println(file); Tarea.setText(file); Font f = new Font("TimesNewRoman", Font.ROMAN_BASELINE, 16); Tarea.setFont(f); Tarea.setBackground(Color.white); Tarea.setAlignmentX(SwingConstants.CENTER); Tarea.setEditable(false); JPanel panel = new JPanel(); panel.add(Tarea); panel.setBackground(Color.white); //scroll = new JScrollPane(Tarea); scroll = new JScrollPane(panel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPa…
tagged with: java
has answer: http://stackoverflow.com/a/23819052
accepted answer: http://stackoverflow.com/a/23819052
tagged with: swing
type: Question
score: 0
tagged with: user-interface
answer count: 1

http://stackoverflow.com/comment/36834847
score: 0
type: Comment
has text: @NathanTempelman I was not aware of the ability to split up the values(or how to do it) and thereby darken the image. Writing 10 lines of code was not the problem.
comment on: http://stackoverflow.com/a/23918630
type: AnswerComment

http://stackoverflow.com/comment/36623071
type: QuestionComment
type: Comment
has text: Your Html is lacking body-tags
comment on: http://stackoverflow.com/q/23807903
score: 0

http://stackoverflow.com/comment/36702671
type: AnswerComment
score: 0
type: Comment
has text: @user2991535 The question was about Java and the JPasswordField Swing component, not about Javascript and html
comment on: http://stackoverflow.com/a/23805723

http://stackoverflow.com/q/23894986
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/36790324
has comment: http://stackoverflow.com/comment/36789699
tagged with: java
upvote count: 1
answer count: 1
tagged with: google-analytics
has body: My ad isn't showing when I put the adview within a layout that contains a listview. Here's my XML code: <?xml version="1.0" encoding="utf-8"?> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-1596992408570157/3380743224" /> I get this LogCat error message: "Not enough space for ad. Needs 960 X 150 pixels, but only has 1080 X 75 pixels." I tried placing the ad before the listview and that works, but that's not how I want it.
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/23895027
tagged with: listview
has title: Admob not showing ad in a layout with listview

http://stackoverflow.com/comment/36630731
comment on: http://stackoverflow.com/a/23811612
type: AnswerComment
has text: So that Java 8 method token is duck-typed?
score: 0
type: Comment

http://stackoverflow.com/comment/36579695
type: QuestionComment
type: Comment
has text: Becouse the FileUtils.listFiles consume a lot of time to process a big directory.
comment on: http://stackoverflow.com/q/23784587
score: 0

http://stackoverflow.com/comment/36643871
has text: My java code is not using absolute paths -> i was just pointing out where they are on the filesystem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813669
score: 0

http://stackoverflow.com/a/23828831
has body: I would implement Comparable and would make a static Method to get the SectionId from the value Compareable returns; then call Collections.min() instead of the loop and call the static method to get the String for the value of the minimun id. Then every detail would be in the MyData class. The Class MyData class MyData implements Comparable, SectionId { public int property; public String section; public int compareTo(MyData o) if (o.section.equals("HEAD") { return 100; } else if (o.section.equalsIgnoreCase("SENIOR")) { return 50; } else if (o.section.equalsIgnoreCase("JUNIOR")) { return 10; } return 0; } public static String parseSectionId(MyData o) { if (o.section.equals("HEAD")) { return "A"; } else if (o.section.equalsIgnoreCase("SENIOR")) { return "B"; } else if (o.section.equalsIgnoreCase("JUNIOR")) { return "C"; } else { return ""; // DEFAULT } } } The loop would be not needed, instead the Collection.max() - Method would return the maximum SectionId - afterwards you can parse this maxId to the appropriate String-Literal: boolean preselectionDefined; private String setSection(ArrayList &lt; MyData &gt; myDatas) { int accountCount = myDatas.size(); String sectionId = ""; // Set Default here if (preselectionDefined) { sectionId = MyData.parseSectionId(Collections.max(myDatas)); } return sectionId; }
score: 1
has comment: http://stackoverflow.com/comment/36735366
upvote count: 1
has comment: http://stackoverflow.com/comment/36665928
answers question: http://stackoverflow.com/q/23828068
type: Answer
has comment: http://stackoverflow.com/comment/36741158
has comment: http://stackoverflow.com/comment/36727859
downvote count: 0
has comment: http://stackoverflow.com/comment/36737974
has comment: http://stackoverflow.com/comment/36665286

http://stackoverflow.com/q/23891128
has title: How to read File Objects out of a jar
has comment: http://stackoverflow.com/comment/36781742
tagged with: java-io
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23891980
accepted answer: http://stackoverflow.com/a/23893028
tagged with: jar
tagged with: imageicon
has body: I have a jar file that contains a folder structure ie... jar/com/foo/bar/images Inside the Images directory I have several images. I have tried to read them out with getResourceAsStream() and also attempted to get at them via ZipEntries. All of my attempts have been fruitless, if someone could please give me an example on how this would be done. P.S don't worry about closing resources and error handling etc. I will be able to put that part in. Thanks for the help. here is the zipfile entry code I tried private File[] getFilesFromPath(String location) { File[] files = null; try { CodeSource src = this.getClass().getProtectionDomain().getCodeSource(); if (src != null) { URL jar = src.getLocation(); ZipInputStream zip = new ZipInputStream(jar.openStream()); while(true) { ZipEntry e = zip.getNextEntry(); if (e == null) break; String name = e.getName(); if (name.endsWith(location)) { files = new File(name).listFiles((new FileFilter() { @Override public boolean accept(File f) { return f.isFile(); } })); for (File file : files){ System.out.println(file.getName()); } } } } }catch (IOException e) { e.printStackTrace(); } return files; }
tagged with: http://stackoverflow.com/tag/zip
tagged with: java
has comment: http://stackoverflow.com/comment/36782720
has answer: http://stackoverflow.com/a/23893028
has comment: http://stackoverflow.com/comment/36782207
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36781854
has answer: http://stackoverflow.com/a/23891980

http://stackoverflow.com/q/23843507
favorite count: 0
accepted answer: http://stackoverflow.com/a/24390673
possible better answer: http://stackoverflow.com/a/23843607
score: 2
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
has body: Is it safe to cache and re use the instances of java.lang.invoke.MethodHandle? I check the JavaDoc and couldn't find anything about thread safety.
has title: MethodHandle and thread safety
answer count: 2
has answer: http://stackoverflow.com/a/24390673
has answer: http://stackoverflow.com/a/23843607
tagged with: java-7
downvote count: 0

http://stackoverflow.com/tag/svg
tags question: http://stackoverflow.com/q/23929746
tag name: svg
tags question: http://stackoverflow.com/q/23849905
tags question: http://stackoverflow.com/q/23789819
type: Tag

http://stackoverflow.com/comment/61780900
has text: Duplicate question: http://stackoverflow.com/questions/12465540/scroll-listener-first-distancey-always-negative-for-downward-scroll
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23824123

http://stackoverflow.com/a/23808149
type: AcceptedAnswer
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36623576
has comment: http://stackoverflow.com/comment/36623690
type: Answer
accepted answer of: http://stackoverflow.com/q/23807375
answers question: http://stackoverflow.com/q/23807375
has comment: http://stackoverflow.com/comment/36623518
upvote count: 4
has body: Your xml file should start with something like this: &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; and the .xsd schemas are in spring-security-config jar.

http://stackoverflow.com/a/23887255
has comment: http://stackoverflow.com/comment/36774371
has comment: http://stackoverflow.com/comment/36775152
has body: You can specify command line arguments here: From the menu bar Go to Run>Run Configurations...>Arguments tab Hope this was helpful and sufficient.
type: Answer
has comment: http://stackoverflow.com/comment/36791163
answers question: http://stackoverflow.com/q/23886919
score: 0

http://stackoverflow.com/comment/36677744
comment on: http://stackoverflow.com/q/23836533
score: 0
type: Comment
type: QuestionComment
has text: first of all debug you code and make sure that the key listeners are being invoked... try to understand your code

http://stackoverflow.com/comment/36706681
score: 0
type: AnswerComment
has text: Well I can't tell where blue/red squares come from since the code you posted only uses WHITE. All I can suggest is that you read the Swing tutorial on `How to Use GridLayout` for a working example. Compare your code with the tutorial to see what is different.
type: Comment
comment on: http://stackoverflow.com/a/23847121

http://stackoverflow.com/comment/36639650
has text: Please avoid asking primarily opinion-based questions. Refer to http://stackoverflow.com/help/dont-ask.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23816473

http://stackoverflow.com/q/23922134
has comment: http://stackoverflow.com/comment/36842164
has comment: http://stackoverflow.com/comment/45760535
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36842287
has comment: http://stackoverflow.com/comment/36841438
tagged with: java
tagged with: option-type
type: Question
has comment: http://stackoverflow.com/comment/36841959
possible better answer: http://stackoverflow.com/a/23922262
has comment: http://stackoverflow.com/comment/36842148
score: 44
has title: Is Java 8 missing an OptionalBoolean?
has comment: http://stackoverflow.com/comment/36841356
tagged with: boolean
downvote count: 2
has answer: http://stackoverflow.com/a/28737310
has body: As a primitive version of Optional*, Java 1.8 provides OptionalInt, OptionalLong and OptionalDouble. But I cannot find the equivalent OptionalBoolean class. Are there any technical reasons against having an OptionalBoolean? * An Optional may or may not have the presence of a value, is used as an alternative to null.
tagged with: monads
linked to: http://stackoverflow.com/q/28738231
has comment: http://stackoverflow.com/comment/36841912
has answer: http://stackoverflow.com/a/23922673
accepted answer: http://stackoverflow.com/a/23922673
upvote count: 46
favorite count: 0
linked to: http://stackoverflow.com/q/22918847
has answer: http://stackoverflow.com/a/23922262
has answer: http://stackoverflow.com/a/28737852
has comment: http://stackoverflow.com/comment/36841583
tagged with: java-8
answer count: 4

http://stackoverflow.com/comment/36808505
type: Comment
has text: From the question it's pretty obvious the OP is using a windows machine
comment on: http://stackoverflow.com/a/23904100
score: 0
type: AnswerComment

http://stackoverflow.com/q/23860287
score: 2
type: AnsweredQuestion
has body: I need to clear the screen after using a grid of g.drawRect(x * 32, y * 32, 32, 32); But I need to dispose of what was there before that frame. Is there a 'clear' method, or something like that?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36723898
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23860332
accepted answer: http://stackoverflow.com/a/23860332
has comment: http://stackoverflow.com/comment/36723952
has comment: http://stackoverflow.com/comment/36723807
has title: How can I clear the screen using a graphics object?
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36936106
comment on: http://stackoverflow.com/a/23877689
has text: I'm not sure you understand what I'm trying to do. I want to make a change in jump height for example for 4 seconds after the player hits the power box. With this code, it changes every 4 seconds regardless of whether the player collides with the power box or not. Think of it like the star power up in super mario.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23870371
has comment: http://stackoverflow.com/comment/36744889
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23870454
tagged with: arrays
has comment: http://stackoverflow.com/comment/36742605
has comment: http://stackoverflow.com/comment/36742393
score: 0
has comment: http://stackoverflow.com/comment/36744271
tagged with: compare
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36743467
has answer: http://stackoverflow.com/a/23871826
has title: java multiple string array compare
has body: I have 9 string arrays that I've read from file. One of the array(main) is going to be compared to the other arrays respectively. The arrays have different length. I write a match function that checks each news item equals to the other array items. If match occurs then write the label of the array. If match is not done then "/o" is printed. The problem is i have eight functions for each array and i want to decrease the complexity and do it in one function. How could i achieve it? My sample code is : The sample is only for arr1, so I need to write it 7 times for the other arrays. String[] main = "g, a1, c1, r,..." String[] arr1 = "a1, b1, c1" String[] arr2 = "e, r, g" String[] arr3 = "g, m, l, x" String[] arr4 = "s, b, l" String[] arr5 = "a, f, o, t, e" String[] arr5 = "g, h, j" String[] arr5 = "q, b" String[] arr5 = "z, v, n" for (int j = 0; j &lt; main.length; j++) { for (int i = 0; i &lt; arr1.length; i++){ int varLength = arr1[i].length(); for (int e = 3; e &lt; varLength; e++) { // substring is done by 3 String substr1 = arr1[i].substring(0, e) if (substr1.equalsIgnoreCase(main[j])) { main[j] = main[j] + "/arr1"; } } } } Expected Output : arr1 = "g/O, a1/arr1, c1/arr1, r/O" arr2 = "e/O, r/arr2, g/arr2 " arr3 = "g/arr3, m/O, l/O, x/O" And goes like this for the other arrays
has comment: http://stackoverflow.com/comment/36742598
tagged with: java

http://stackoverflow.com/comment/36587637
comment on: http://stackoverflow.com/a/23789110
score: 1
type: AnswerComment
has text: @Braj, sure, `TestThread1` will not even enter its loop at any point: `t1.thread.thread` is always `null`, as I said.
type: Comment

http://stackoverflow.com/q/23904748
type: Question
has answer: http://stackoverflow.com/a/23904849
answer count: 2
has comment: http://stackoverflow.com/comment/36808427
has title: how to load .class file in java application
downvote count: 0
has body: I have a .class file as(JJJ.class) at location C:\Users\user\Desktop\jk ... i want to load dynamically this .class file in java application.here i want to load .class file dynamically in the project package com.load.data; public class JJJ { public static void main(String[] args)throws ClassNotFoundException,MalformedURLException { File file = new File("C:\\Users\\user\\Desktop\\jk"); URL url = file.toURL(); URL[] urls = new URL[]{url}; ClassLoader cl = new URLClassLoader(urls); Class cls = cl.loadClass("com.load.data.JJJ"); } }
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23905227
has comment: http://stackoverflow.com/comment/36812235
has comment: http://stackoverflow.com/comment/36808837
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36808661

http://stackoverflow.com/comment/36617073
comment on: http://stackoverflow.com/q/23804973
score: 0
has text: why would you do that? just let your db generate the key using autoincrement.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23823044
has answer: http://stackoverflow.com/a/23823388
has title: JSON Array String to Json Array
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/36652180
type: Question
possible better answer: http://stackoverflow.com/a/23823388
accepted answer: http://stackoverflow.com/a/23823418
has comment: http://stackoverflow.com/comment/36652484
has comment: http://stackoverflow.com/comment/36652306
has comment: http://stackoverflow.com/comment/36652262
score: 0
answer count: 3
has body: I have a string as below that I receive from web service [ { "id": "AEC56A1C-E590-4CCE-B3DD-7AFF8FEE9216", "itemname": "tyuytuytuytuytutyu", "itemdescription": "hdfg dag dg sd gsg sdg sdg sg sgd", "itemprice": 40, "specialprice": 0, "itemimageurl": "no-url", "catid": "6A1A4E13-6AFD-44DD-998D-3A51E35C2C23", "status": true, "itemlongname": "yutyuyut", "iscombodeal": false }, { "id": "E29249B2-E620-487C-9D66-1BC07A1B1D93", "itemname": "rrrr", "itemdescription": "rrrrr", "itemprice": 20, "specialprice": 0, "itemimageurl": "no-url", "catid": "6A1A4E13-6AFD-44DD-998D-3A51E35C2C23", "status": true, "itemlongname": "rrrr", "iscombodeal": false }, { "id": "D273D888-0526-4487-8113-6405C8E216D5", "itemname": "vTD", "itemdescription": "vTDvTD", "itemprice": 0, "specialprice": 0, "itemimageurl": "no-url", "catid": "6A1A4E13-6AFD-44DD-998D-3A51E35C2C23", "status": true, "itemlongname": "vTD", "iscombodeal": false }, { "id": "DF6DC5E3-25E9-4D57-89F4-C2BA8A719866", "itemname": "NO option", "itemdescription": "NO option", "itemprice": 45.78, "specialprice": 0, "itemimageurl": "no-url", "catid": "6A1A4E13-6AFD-44DD-998D-3A51E35C2C23", "status": true, "itemlongname": "NO option", "iscombodeal": false }, { "id": "AD1739A6-B50A-4780-B71E-9E4E98AF19B5", "itemname": "ttttt", "itemdescription": "tttt", "itemprice": 12, "specialprice": 0, "itemimageurl": "no-url", "catid": "6A1A4E13-6AFD-44DD-998D-3A51E35C2C23", "status": true, "itemlongname": "tttttt", "iscombodeal": false }, { "id": "C3206E79-BD92-4F49-B291-C57EB36AFCCC", "itemname": "Marinara (Seafood)", "itemdescription": "(Anchovies optional), shrimps, crab, mussels, squids, mozzarella", "itemprice": 0, "specialprice": 0, "itemimageurl": "no-url", "catid": "9960CA1F-46D3-4532-95E7-84F75B3771FE", "status": true, "itemlongname": "Marinara (Seafood)", "iscombodeal": false }, { "id": "FD3603B9-1175-463F-A6AD-CCF1141E135D", "itemname": "Hawaiian", "itemdescription": "Double ham, double pineapple, mozzarella", "itemprice": 0, "specialprice":…
has answer: http://stackoverflow.com/a/23823128
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/23823418
type: AnsweredQuestion

http://stackoverflow.com/q/23910354
has comment: http://stackoverflow.com/comment/36818500
has comment: http://stackoverflow.com/comment/36818407
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36818814
has comment: http://stackoverflow.com/comment/36818482
has body: I have to do a select query on a database which I will execute often. It works completely fine with a normal statement: List&lt;Invoice&gt; l = this.jdbcTemplate.query( "SELECT id, name, stuff FROM example WHERE amount &gt; ?", new Object[] { "100" }, new RowMapper&lt;Invoice&gt;() {...} ); I execute the above statement very frequently, so for performance reason I want to use a prepared statement. However I'm now unsure how I correctly would use the spring API to achieve this. I'm confused why spring would like me to give an instance of a PreparedStatementCreator as an argument for query? I thought that it's exactly the point that I do not create a new prepared statement every time I use the query method. So I think something along the line of the following snippet would be absolutely pointless as the prepared statement is created newly every time I call the query-method: List&lt;Invoice&gt; l = this.jdbcTemplate.query( new PreparedStatementCreator() { String query = "SELECT id, name, stuff FROM example WHERE amount &gt; ?"; public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { return connection.prepareStatement(query); } }, new PreparedStatementSetter() {...}, new RowMapper&lt;Invoice&gt;() {...} ); Do I have to create my own ReusablePreparedStatementCreator? Which would only create a new method on the first call of createPreparedStatement. Could the PreparedStatementCreatorFactory help me? So to rephrase, how would I correctly create a select query that uses a prepared statement with Spring JDBCTemplate to really gain a performance advantage without losing the advantage of the RowMapper?
favorite count: 0
has answer: http://stackoverflow.com/a/23910617
tagged with: spring
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23910617
tagged with: java
score: 6
has title: How to use a prepared statement correctly with Spring JDBCTemplate?
tagged with: jdbctemplate
type: Question
has comment: http://stackoverflow.com/comment/36818721

http://stackoverflow.com/comment/36805174
type: Comment
comment on: http://stackoverflow.com/a/23890748
type: AnswerComment
has text: Thanks for your inputs, after making modification perfectly given by you... my problem got solved... many thanks!!!
score: 0

http://stackoverflow.com/a/23804308
score: 13
has body: http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html#getText() getText() delivers the innerText of a WebElement. Your input field does not have any inner Text. The text is found inside your value-attribute, hence accessing it via getAttribute("value") is the correct way to do it.
type: AcceptedAnswer
downvote count: 0
upvote count: 13
type: Answer
accepted answer of: http://stackoverflow.com/q/23804123
answers question: http://stackoverflow.com/q/23804123

http://stackoverflow.com/a/23889821
score: 4
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23889749
has body: Create objects within a loop and place them in the array You need to create each object individually, then place it in the array. These are two seperate operations (although they can be within the same line). A loop will make this far more pleasent. cc = new customer[100]; for(int i=0;i&lt;cc.length;i++){ cc[i]=new customer(1); } Its the same for objects with no-argument constructors Although the compiler did not complain I do not believe bb = new barber[3]; does what you think it does. It creates an array large enough to fit 3 references to a Barber object. But it doesn't create those objects, only the the array. At this point bb contains {null, null, null} so you would need to use a similar loop to fill bb with Barber objects. Java naming convention It is also convention to use UpperCamelCase for class names. So customer should be Customer and barber should be Barber. Equally variable names should be lowerCamelCase so WaitSeat should be waitSeat and WaitRoom should be waitRoom.

http://stackoverflow.com/q/23833705
linked to: http://stackoverflow.com/q/6359847
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36677549
type: UnansweredQuestion
has title: cosine function with strange behaviour - same input, different return value - Nexus 4
tagged with: android
has comment: http://stackoverflow.com/comment/36677300
has body: Today I have just discovered the oddest bug that I have ever seen, which took me several hours to find. I've narrowed down the problem to a single line of code which simply is: double cosAngle = Math.cos(angleInRadians); For certain angles (or periods of time?) the function returns the wrong answer! I'm certain that it's not due to incorrect conversion of degrees to radians or other common mistakes that people make with the cos function. It only happens to my Nexus 4 device running 4.4.2 and I ran a little test from the main thread: Log.d("test", "---------------- Beginning Test ---------------------- "); for(int i = 0; i &lt; 1000; i++) { Log.d("test", "Math.cos(1.603635633038609d):\n" + Math.cos(1.603635633038609d)); } When I print the solution to logcat I get: D/test ( 7875): Math.cos(1.603635633038609d): D/test ( 7875): -0.03283340413433994 D/test ( 7875): Math.cos(1.603635633038609d): D/test ( 7875): -0.04844533640025519 And it randomly fluctuates between these two values. The correct answer being -0.0328.. Has anyone any insight as to what might be happening? Is this a software/hardware issue? It has visual implications as it causes pixels to flicker and other weird effects.
score: 3
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36680570
has comment: http://stackoverflow.com/comment/39684511
type: Question
has comment: http://stackoverflow.com/comment/36682822

http://stackoverflow.com/q/23852593
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/23852671
answer count: 1
has body: Main Class Game class Player class - parent class PlayerType class - child class I want to set attributes of both player - number of games played,games won,Player name and playertype - stores the type of player - dummy or computer. Earlier I was calling Player() in Game class, where it sets the default values to Player's attributes. Main class creates array-List of type player. However, now with requirement of type of player too, I am confused. How to implement this? 1) Main Class static ArrayList&lt;Player&gt; players = new ArrayList&lt;Player&gt;(); //Array-List is created of type Player. 2) Game Class Game() { Player player1 = new Player(); Player player2 = new Player(); } 3) Player Class Player() { //some attributes } 4) PlayerType extends Player //some attributes PlayerType() { //initialize attributes. } I want Game class to initialize all the attributes of player. In addition to this, PlayerType has some getters,setters and functions, and so does Player. Can I use those by creating their respective objects, and calling these functions?
has title: Using inheritance in Java with array-List
tagged with: inheritance
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36708864
has answer: http://stackoverflow.com/a/23852671
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36708811
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/36684444
score: 0
type: Comment
has text: in my case could be the mac address, becoz the app is like a online voting and the ppl needs to turn wifi on to vote, so i can get the mac adress, and yes 3G is a problem, i will handle latter. the ppl only can vote with wifi now, is life hehe. is kind of complicated do all this stuff, hehe i will try here.
type: AnswerComment
comment on: http://stackoverflow.com/a/23839639

http://stackoverflow.com/a/23847603
has body: You're performing a compound operation. You're both displaying it and modifying it. In itself both operations are thread safe, but when combined like that, they're not. One thread can modify the contents while another thread is displaying the individual characters.
score: 4
answers question: http://stackoverflow.com/q/23847570
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/36767693
type: Comment
has text: I see less reason for the "only one return rule" in languages, such as Java, that include try-finally or equivalent, because adding code to every return path does not require editing every return path.
type: QuestionComment
comment on: http://stackoverflow.com/q/23879732
score: 0

http://stackoverflow.com/q/23917900
tagged with: r.java-file
answer count: 2
has comment: http://stackoverflow.com/comment/36833378
downvote count: 0
favorite count: 0
has title: wrong generation of R.java drawables
has comment: http://stackoverflow.com/comment/36833816
type: UnansweredQuestion
tagged with: android
has body: Heyho, I have a problem concerning the R.java file. Actually I caused it myself by creating a drawable icon called 'ic_tab_debate.png' in all drawable folders (mdpi, hdpi, ...) but also creating and XML file in the drawable folder called 'ic_tab_debate.xml'. This of course led to the problem. But after deleting the XML file there still is something wrong in the R.java! My drawable part of the R.java file looks like this: public static final class drawable { public static final int =0x7f020022; //Here is the problem public static final int common_signin_btn_icon_dark=0x7f020000; public static final int common_signin_btn_icon_disabled_dark=0x7f020001; public static final int common_signin_btn_icon_disabled_focus_dark=0x7f020002; public static final int common_signin_btn_icon_disabled_focus_light=0x7f020003; public static final int common_signin_btn_icon_disabled_light=0x7f020004; public static final int common_signin_btn_icon_focus_dark=0x7f020005; public static final int common_signin_btn_icon_focus_light=0x7f020006; public static final int common_signin_btn_icon_light=0x7f020007; public static final int common_signin_btn_icon_normal_dark=0x7f020008; public static final int common_signin_btn_icon_normal_light=0x7f020009; public static final int common_signin_btn_icon_pressed_dark=0x7f02000a; public static final int common_signin_btn_icon_pressed_light=0x7f02000b; public static final int common_signin_btn_text_dark=0x7f02000c; public static final int common_signin_btn_text_disabled_dark=0x7f02000d; public static final int common_signin_btn_text_disabled_focus_dark=0x7f02000e; public static final int common_signin_btn_text_disabled_focus_light=0x7f02000f; public static final int common_signin_btn_text_disabled_light=0x7f020010; public static final int common_signin_btn_text_focus_dark=0x7f020011; public static final int common_signin_btn_text_focus_light=0x7f020012; public static final int common_signin_btn_text_light=0x7f020013; public static final int common_signin_b…
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36833695
has comment: http://stackoverflow.com/comment/36833678
has answer: http://stackoverflow.com/a/23920303
has answer: http://stackoverflow.com/a/23918829
tagged with: resources
type: Question
has comment: http://stackoverflow.com/comment/36833010
has comment: http://stackoverflow.com/comment/36833309

http://stackoverflow.com/comment/36719876
type: QuestionComment
comment on: http://stackoverflow.com/q/23858203
has text: yeah i see it now, but i tried to move the buttons to the main_activity.xml but I actually have no idea what to do, since after i do it, it gives me an error...
score: 0
type: Comment

http://stackoverflow.com/comment/36763544
comment on: http://stackoverflow.com/q/23875257
type: QuestionComment
score: 0
has text: What is your goal? Do you wan't to show error messages in view? Then use Spring Error Tag. Do you wan't to log missing values? Then enable logging for the right (Spring) class.
type: Comment

http://stackoverflow.com/a/23850818
has body: The final solution I used (inspired by @assylias' answer): public static void main(String args) { boolean numeric = false; Trolley&lt;? extends Comparable&lt;?&gt;&gt; trolley = null; if (numeric) { Trolley&lt;Integer&gt; trolleyN = new Trolley&lt;Integer&gt;(); trolleyN.addItem(42); trolley = trolleyN; } else { Trolley&lt;String&gt; trolleyS = new Trolley&lt;String&gt;(); trolleyS.addItem("42"); trolley = trolleyS; } // use trolley in "read-only" mode }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23850693
upvote count: 1

http://stackoverflow.com/comment/36642455
has text: possible duplicate of [How do you use getDocumentBase() and getCodeBase() in Java Applets?](http://stackoverflow.com/questions/23817257/how-do-you-use-getdocumentbase-and-getcodebase-in-java-applets)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23817796

http://stackoverflow.com/a/23821313
downvote count: 1
has comment: http://stackoverflow.com/comment/97057391
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/97056532
has comment: http://stackoverflow.com/comment/97057767
has comment: http://stackoverflow.com/comment/97056918
type: Answer
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/97057335
has body: You could have public class ExceptionWithPayload&lt;T&gt; extends Exception { private final T payload; public ExceptionWithPayload(T payload) { this.payload = payload; } public T getPayload(){ return payload; } } and then in some other class, you could write throw new ExceptionWithPayload&lt;MyClass&gt;(myObject); so as to be able to pass any object you like back to the thing that catches the exception, but with type checking in the catch clause.
accepted answer of: http://stackoverflow.com/q/23821202
has comment: http://stackoverflow.com/comment/97054004
answers question: http://stackoverflow.com/q/23821202
has comment: http://stackoverflow.com/comment/97054514

http://stackoverflow.com/tag/zip
tags question: http://stackoverflow.com/q/23798879
tags question: http://stackoverflow.com/q/23930630
type: Tag
tags question: http://stackoverflow.com/q/23869228
tags question: http://stackoverflow.com/q/23891128
tag name: zip
tags question: http://stackoverflow.com/q/23858706

http://stackoverflow.com/q/23853396
type: Question
score: 0
tagged with: xml-parsing
has body: I have this method for removing a node from an XML file: public static void deleteElement(Document doc, String elementType, String tagName, String valueToCheck) { // <elementType> NodeList nodes = doc.getElementsByTagName(elementType); System.out.println("NODES: "+nodes.getLength()); for (int i = 0; i < nodes.getLength(); i++) { Element person = (Element) nodes.item(i); // <tagName> Element name = (Element) person.getElementsByTagName(tagName).item(0); String pName = name.getTextContent(); System.out.println(pName); if (pName.equals(valueToCheck)) { person.getParentNode().removeChild(person); System.out.println("match" + pName); } } System.out.println("NODES AFTER DELETE: "+nodes.getLength()); } Where i specify the root element, the tag to be checked and the value to be checked. On my XML: <?xml version="1.0"?> 1 Person 1 1 Person 2 3 Person 3 4 Person 3 the output after executing the method with the parameters person, name, Person 3 is this: <?xml version="1.0" encoding="UTF-8"?> 1 Person 1 1 Person 2 4 Person 3 I.e. only the first appearance was removed... any ideas why?
has answer: http://stackoverflow.com/a/23854274
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36710802
accepted answer: http://stackoverflow.com/a/23854274
type: AnsweredQuestion
tagged with: java
has title: JAVA XML remove Node - only first appearance is removed
tagged with: dom

http://stackoverflow.com/comment/36719251
comment on: http://stackoverflow.com/a/23857324
has text: Basically the table represents a chessboard 8x8 , and i want to put pictures of dominoes in each cell , so it looks like a checkboard/table with pictures/dominoes on it. The value table[i][j]="f" shows that that cell is free/unused and be placing the picture or "u" (means used table cell) so the next time inside the for loop it will not place another Picture on the picture(or replace "u" again with another "u").
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36667530
type: QuestionComment
comment on: http://stackoverflow.com/q/23827574
score: 0
has text: also, while it's probably not your problem, don't do `lang(?label) = 'en'`. Language tags are more complicated than that. Use `langMatches(lang(?label),'en')`.
type: Comment

http://stackoverflow.com/comment/36980451
type: Comment
comment on: http://stackoverflow.com/a/23957552
has text: "you could have multiple Data Sources each one having it's own session factory". It's actually the case, as far as i understand we have so one hibernate session per datasource and jta transaction. Intersting link anyway thanks
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36842377
score: 0
has text: Selenium 2.5.0 is the latest available, why you are saying that it is outdated?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23921149

http://stackoverflow.com/q/23835271
tagged with: string
favorite count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/23835363
type: UnansweredQuestion
tagged with: java.util.scanner
tagged with: java
has comment: http://stackoverflow.com/comment/36675160
upvote count: 1
downvote count: 1
type: Question
has body: I have a tag maker class that needs to print out two tags. one needs to print out the user input, and then I have to clear the scanner buffer and print out an empty tag right afterwards. as of now, I get two tags that print the original user input. package stupidtag; import java.util.Scanner; public class StupidTag { String first; String last; String org; String s; Scanner scanMe = new Scanner(System.in); public void setFirst(String first){ this.first = first; } public void setLast(String last){ this.last = last; } public void setOrganization(String org){ this.org = org; } void tagMaker() { s = ("———————NAME TAG———————" + "\n" + "Name: " + last + ", " + first + "\n" + "Organization: " + org + "\n"+ "---------------------"); if((first.equals(first)) || (last.equals(last)) || (org.equals(org))) { System.out.println(s); } else{ System.out.println("Invalid input. Please try again."); scanMe.nextLine(); // --&gt;important System.out.println(); } scanMe.reset(); System.out.println(s); } } } and here's the tester: import java.util.Scanner; public class stupidTagTester { public static void main(String args[]){ Scanner scanMe = new Scanner( System.in ); StupidTag tag = new StupidTag(); System.out.print("This program will print out a name tag"); System.out.println("for each delegate."); System.out.println("Please enter first name:"); tag.first = scanMe.nextLine(); System.out.println("Please enter last name:"); tag.last = scanMe.next(); System.out.println("Please enter organization or affilation:"); tag.org = scanMe.next(); tag.tagMaker(); } }
has title: Clearing the scanner to print out empty string
score: 0
answer count: 1

http://stackoverflow.com/comment/37197594
has text: @mauriciotl, I tried to solve this by coding but I couldn't take a look at my post http://stackoverflow.com/questions/23904391/why-different-answer-from-same-string/23923431?noredirect=1#comment36876053_23923431
comment on: http://stackoverflow.com/a/23902863
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23824693
has comment: http://stackoverflow.com/comment/36663248
answers question: http://stackoverflow.com/q/23823463
score: 0
has body: I would suggest the "purist" way of doing this is to accept an XYZMapper instance in your constructor and store it in a local field. In production use, you can pass an e.g. SQLXYZMapper, which will interact with your database. In test use, you can pass in a mocked object that you can verify interactions with.
type: Answer
has comment: http://stackoverflow.com/comment/36659109

http://stackoverflow.com/comment/63912292
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/38245517

http://stackoverflow.com/comment/36748700
score: 0
comment on: http://stackoverflow.com/q/23873878
type: QuestionComment
type: Comment
has text: Is there an access violation in the Windows app logs?

http://stackoverflow.com/a/23830956
accepted answer of: http://stackoverflow.com/q/23797939
answers question: http://stackoverflow.com/q/23797939
has body: There is no way to change the types on a mapping without re-indexing your data. There are several strategies you can use to re-index your data though -- one is deleting it, creating the mapping, then indexing it (that's what you are doing). The second option is to use something like elasticsearch-exporter (https://www.npmjs.org/package/elasticsearch-exporter) to copy your data from one index to another (so create the settings/mapping you want on the new index and then copy data from old index to new). You can then setup an alias that maps the old index name to the new index name.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36683406
type: AnswerComment
score: 0
type: Comment
has text: @RichardTingle We don't know where the method `tGen()` gets the value from. Could also be external and not under his control.
comment on: http://stackoverflow.com/a/23838995

http://stackoverflow.com/comment/36868713
has text: The exception is NullPointerException, but what happens exactly? It fails when it reaches the connectDialog and the dialog isn't displayed, the listener is not a problem. Part of the log: E/AndroidRuntime(22953): FATAL EXCEPTION: main 05-29 18:27:10.542: E/AndroidRuntime(22953): java.lang.NullPointerException When i comment out the line: connectDialog.setItems(pairedDevicesArray, connectDialogClickListener); the program runs successfully and shows a dialog with a title only. So that line makes the problem. What could be the issue?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23934191
type: QuestionComment

http://stackoverflow.com/a/23832687
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23832593
downvote count: 0
has body: The regex would be "\\\\" In the source code: "\\\\" After compiling, the string is: "\\" And the regex parser interperets this as look for a \, So it matches one backslash '\'

http://stackoverflow.com/comment/36696708
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23846498
has text: The thing is even I'll delete whole new code from MainActivity, it will not work.
type: Comment

http://stackoverflow.com/comment/36813751
has text: Thanks. I was totally in the jsf world and forgot about simple js ;) But now I got an additional autocomplete field: I can set the string in the field but it does not convert it to a real object like it would do if I enter the content manually. Maybe this might be a new question :)
comment on: http://stackoverflow.com/a/23907290
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23918067
has answer: http://stackoverflow.com/a/56390477
has body: I am trying to write a program to transfer a file between client and server using java tcp sockets I am using buffer size of 64K but The problem I am facing is that when when the tcp sometimes fail to send the whole 64K it sends the remaing part for example 32K in anther go There for A garbage data of some Spaces or so is being taken by the buffer at reading side to make 64K complete and thus unnecessary data is making the file useless at receiving side. Is there any solution to overcome this problem ??? I am using TCP protocol this code is using to send data to client Server-side code File transferFile = new File ("Document.txt"); byte [] bytearray = new byte [1024]; int byRead=0; FileInputStream fin = new FileInputStream(transferFile); BufferedInputStream bin = new BufferedInputStream(fin); OutputStream os = socket.getOutputStream(); while(byRead&gt;-1) { byRead=bin.read(bytearray,0,bytearray.length); os.write(bytearray,0,bytearray.length); os.flush(); } Client-side code byte [] bytearray = new byte [1024]; InputStream is = socket.getInputStream(); FileOutputStream fos = new FileOutputStream("C:\\Users\\NetBeansProjects\\"+filename); BufferedOutputStream bos = new BufferedOutputStream(fos); bytesRead = is.read(bytearray,0,bytearray.length); currentTot = bytesRead; System.out.println("Data is being read ..."); do { bytesRead = is.read(bytearray, 0, (bytearray.length)); if(bytesRead == 0) continue; if(bytesRead &gt;= 0) currentTot += bytesRead; bos.write(bytearray,0,bytearray.length); } while(bytesRead &gt; -1); here I tried to skip the loop if the byte is empty by continue; statement but it is not working.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23922779
has comment: http://stackoverflow.com/comment/36838183
tagged with: buffer
tagged with: byte
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/36837733
has comment: http://stackoverflow.com/comment/36833296
has comment: http://stackoverflow.com/comment/36833585
has title: avoiding garbage data while reading data using a byte buffer
tagged with: tcp
tagged with: java
type: Question

http://stackoverflow.com/comment/36622835
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23807219
score: 0
has text: Maybe the last 8 bits was erroneous. I was carried away by the `int` -> `byte` casting. What I meant was I just want the truncated value of `float` as in 5.0 -> 5. As for the performance this casting is going to happen some million times so the more efficient the better

http://stackoverflow.com/q/23895338
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23895551
has answer: http://stackoverflow.com/a/23895472
has answer: http://stackoverflow.com/a/23895400
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23895356
has comment: http://stackoverflow.com/comment/36790256
has answer: http://stackoverflow.com/a/23895531
has body: It's my understanding that IllegalArgumentException doesn't need to be thrown because it's a runtime error, and therefore in theory there shouldn't be a way to recover from it. My question is should it be thrown in the throw close? I've tried and it complies both ways. With throws public static void test() throws IllegalArgumentException { throw new IllegalArgumentException(); } Without throws public static void test() { throw new IllegalArgumentException(); }
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/23895390
has title: Should IllegalArumentException be declared in the throws clause?
tagged with: exception

http://stackoverflow.com/q/23921906
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23980492
has body: So I tried to install openCV in Mac OS X and use it in my project, and I find some ways to do it, but when I install it, and use the command line trying to come up with the opencv2.4.9.jar file, but I can't find it anywhere. This is what I did $ cd opencv-2.4.9 $ mkdir build $ cd build/ $ cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -D CMAKE_C_COMPILER=/usr/bin/gcc -D WITH_CUDA=ON .. $ make -j8 $ make install Based on the tutorial, this should create a jar file in the opencv-2.4.9/build/bin, but I'd tried so many times, still can't find it. Can someone tell me what is the problem? Thanks
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 3
downvote count: 1
has title: opencv 2.4.9 can't find .jar file for my eclipse java project
type: Question
tagged with: opencv
has answer: http://stackoverflow.com/a/26529845

http://stackoverflow.com/a/23890976
type: Answer
has body: I gave a unsatisfying answer, thanks to @OlegEstekhin for pointing that out. As noone else answered yet, and a solution is not a two-liner, here it goes. Make a wrapping InputStream that throws away escape sequences. I have used a PushbackInputStream, where a partial sequence skipped, may still be pushed back for reading first. Here a FilterInputStream would suffice. public class EscapeRemovingInputStream extends PushbackInputStream { public static void main(String[] args) { String s = "\u001B[kHello \u001B[H12JWorld!"; byte[] buf = s.getBytes(StandardCharsets.ISO_8859_1); ByteArrayInputStream bais = new ByteArrayInputStream(buf); EscapeRemovingInputStream bin = new EscapeRemovingInputStream(bais); try (InputStreamReader in = new InputStreamReader(bin, StandardCharsets.ISO_8859_1)) { int c; while ((c = in.read()) != -1) { System.out.print((char) c); } System.out.println(); } catch (IOException ex) { Logger.getLogger(EscapeRemovingInputStream.class.getName()).log( Level.SEVERE, null, ex); } } private static final Pattern ESCAPE_PATTERN = Pattern.compile( "\u001B\\[(k|m|H\\d+J|\\d+:\\d+H|\\?\\d+\\w|\\d*i)"); private static final int MAX_ESCAPE_LENGTH = 20; private final byte[] escapeSequence = new byte[MAX_ESCAPE_LENGTH]; private int escapeLength = 0; private boolean eof = false; public EscapeRemovingInputStream(InputStream in) { this(in, MAX_ESCAPE_LENGTH); } @Override public int read(byte[] b, int off, int len) throws IOException { for (int i = 0; i &lt; len; ++i) { int c = read(); if (c == -1) { return i == 0 ? -1 : i; } b[off + i] = (byte) c; } return len; } @Override public int read() throws IOException { int c = eof ? -1 : super.read(); if (c == -1) { // Throw away a trailing half escape sequence. eof = true; return c; } if (escapeLength == 0 &amp;&amp; c != 0x1B) { return c; } else { escapeSequence[escapeLength] = (byte) c; ++escapeLength; String esc = new String(escapeSequence, 0, escapeLength, StandardCharsets.ISO_8859_1); if (ESCAPE_PATTERN.matcher(esc).matc…
accepted answer of: http://stackoverflow.com/q/23886788
answers question: http://stackoverflow.com/q/23886788
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36642595
has text: Right. And that's why I came to SO hoping for an "oh, so that's the way you do it" solution from somebody with greater knowledge. I obviously do not want to recommend the method above to anybody. ;]
comment on: http://stackoverflow.com/q/23817840
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23804114
type: Answer
has body: Pros: Simple and easy, all of a sudden everything works. Cons: Everything now uses the new version - which may not be the desired effect. Pros: You can put it anywhere you like and make sure it is only accessible by code you expect. Cons: More work involved - usually requires manual intervention.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23803851
downvote count: 0

http://stackoverflow.com/comment/36668883
has text: Also I sincerely doubt its a bug with the engine. Is there any way I could accidentally trigger this behavior?
score: 0
comment on: http://stackoverflow.com/q/23814987
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23823097
has body: Here is specification of addRow addRow public void addRow(Vector rowData) Adds a row to the end of the model. The new row will contain null values unless rowData is specified. Notification of the row being added will be generated. Parameters: rowData - optional data of the row being added addRow public void addRow(Object[] rowData) Adds a row to the end of the model. The new row will contain null values unless rowData is specified. Notification of the row being added will be generated. Parameters: rowData - optional data of the row being added and you are passing model.addRow(data[i]); but it requires Object[]
answers question: http://stackoverflow.com/q/23822957
score: 0
type: Answer

http://stackoverflow.com/comment/36829475
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23907413
has text: it's better to not rely on drawing (and therefore on OpenGL too), because it's not a visualization problem...
score: 0

http://stackoverflow.com/a/23826364
has comment: http://stackoverflow.com/comment/36670832
has body: It may be the locale/timezone issue. You can solve it by passing value as long (time in milliseconds) or string (date as string). Just form the date object back at the server side. My another post might help you Setting locales in gwt.xml do not work How you can form the the date object back at server side based on client locale? Sample code: Locale locale = httpRequest.getLocale(); // Get the client browser locale SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM, locale);
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36671049
answers question: http://stackoverflow.com/q/23824835
score: 1
downvote count: 0

http://stackoverflow.com/comment/36714711
comment on: http://stackoverflow.com/a/23854784
score: 0
type: AnswerComment
type: Comment
has text: i did pretty much the same thing, deleted the errors, but i'm encountering other along the way of my project that include this nightmare of a BaseGameUtils library. i don't know why this is happening, i just hope that android studio will be 100% better than eclipse

http://stackoverflow.com/comment/36855595
comment on: http://stackoverflow.com/q/23929229
has text: @AleksandrM, doesn't work either
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23780871
type: Question
has comment: http://stackoverflow.com/comment/36575818
accepted answer: http://stackoverflow.com/a/23783147
has comment: http://stackoverflow.com/comment/36572285
answer count: 1
downvote count: 0
favorite count: 0
has title: getting the argument names of a function like netbeans does
has answer: http://stackoverflow.com/a/23783147
score: 2
type: AnsweredQuestion
tagged with: netbeans
has body: Ok, this could be a tricky one. For a code generating tool I need to know methods and arguments of a class. The method name and argument types are the easy ones - just using reflection. But the argument name - and I need the real argument name - is a tricky one because this information is in the javadoc. In my case I use Netbeans 8 and I am pretty sure if Netbeans can get the arguments name I can too. Does anyone know how to read the javadoc to get the argument names of a method? PS I know this question will pop up. I need the real argument names because the generated code provides an api and it is not very helpful for a developper to use an api where the api methods are something like set_a1, set_a2, and so on.
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/36717030
type: Comment
comment on: http://stackoverflow.com/a/23856658
score: 0
type: AnswerComment
has text: I've added a bit to show you how to print out the values as well. Make sure you import `java.util.Map.Entry;`

http://stackoverflow.com/a/41302618
type: Answer
answers question: http://stackoverflow.com/q/23858263
has body: A new Thread when started will only have its own execution context. It wont create a copy of objects and won't maintain its own memory space. It will instead share the heap memory. In your case, you had created a object on heap and passed the same object reference to two threads. while two threads are being executed simultaneously, they are sharing the same object which arises a race condition while accessing count variable and performing count++. This is causing inconsistent in your output. If you are sharing same object and like to see the result constantly as 8, put count++ in synchronized block as below public void run() { for(int i=1; i&lt; 5; i++){ processSomething(i); synchronized(this) { count++; } } } If you are sharing the object out of which you don't want to share particular object variable, then declare it as thread local.
score: 0

http://stackoverflow.com/q/23855362
tagged with: spring-mvc
score: 2
tagged with: reload
has title: reload popup page by using spring MVC
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23864187
type: Question
upvote count: 2
answer count: 2
has body: I am using a controller to get the form values from the html. And doing some kind of validations. If validation fails i want to reload that popup by throwing the validation message and the popup page view name to reload the popup page. Like If i have a page A, in that page A there is a button B. Now if i click the button B, there will be open a popup window C. Here in the page C, if i click the form submit. It will goes to the controller. Here in the controller i do some validations, if validation fails i just want to reload that popup page C with the error message. Any body can help to overcome the issues.
accepted answer: http://stackoverflow.com/a/23855529
downvote count: 0
tagged with: jquery
favorite count: 0
has answer: http://stackoverflow.com/a/23855529
tagged with: spring
possible better answer: http://stackoverflow.com/a/23864187

http://stackoverflow.com/q/23896893
possible better answer: http://stackoverflow.com/a/23897165
has comment: http://stackoverflow.com/comment/36793545
has comment: http://stackoverflow.com/comment/36793636
has comment: http://stackoverflow.com/comment/36793383
has comment: http://stackoverflow.com/comment/36793727
tagged with: class
has answer: http://stackoverflow.com/a/23897165
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/36793701
downvote count: 0
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/23896913
accepted answer: http://stackoverflow.com/a/23896913
has comment: http://stackoverflow.com/comment/36793449
type: AnsweredQuestion
tagged with: constructor
has title: Why can´t I create a class object within a method from a different class in Java?
tagged with: java
tagged with: methods
has body: I tried something in my code and it didn´t work (the error when compiling was "The local variable fundo is never read"). I´ve made some changes and it worked, but I would like to know why it didn´t work in the first place. I have a class called Setor, in my code I´m trying to create an object from that class in the class Vendedor Here is my first code: class Vendedor{ void abreTeatro(int codigoCamarote, int capacidadeCamarote, int precoCamarote, int codigoFrente, int capacidadeFrente, int precoFrente, int codigoMeio, int capacidadeMeio, int precoMeio, int codigoFundo, int capacidadeFundo, int precoFundo) { Setor camarote = new Setor(codigoCamarote, capacidadeCamarote, precoCamarote); Setor frente = new Setor(codigoFrente, capacidadeFrente, precoFrente); Setor meio = new Setor(codigoMeio, capacidadeMeio, precoMeio); Setor fundo = new Setor(codigoFundo, capacidadeFundo, precoFundo); }; } If I create the objects outside the method it works as you can see below: class Vendedor{ Setor camarote; Setor frente; Setor meio; Setor fundo; void abreTeatro(int codigoCamarote, int capacidadeCamarote, int precoCamarote, int codigoFrente, int capacidadeFrente, int precoFrente, int codigoMeio, int capacidadeMeio, int precoMeio, int codigoFundo, int capacidadeFundo, int precoFundo) { camarote = new Setor(codigoCamarote, capacidadeCamarote, precoCamarote); frente = new Setor(codigoFrente, capacidadeFrente, precoFrente); meio = new Setor(codigoMeio, capacidadeMeio, precoMeio); fundo = new Setor(codigoFundo, capacidadeFundo, precoFundo); }; } Here is the Setor class: public class Setor { int _codigo; int _capacidade; int _preco; public Setor (int codigo, int capacidade, int preco){ _codigo = codigo; _capacidade = capacidade; _preco = preco; System.out.println(_codigo + " " + _capacidade + " " + _preco); }; } I would like to know what´s wrong with my first try. Also, I might be using some terminology wrong. I´m sorry for that, edits are very welcome!
type: Question
has comment: http://stackoverflow.com/comment/36793627
has comment: http://stackoverflow.com/comment/36793518

http://stackoverflow.com/comment/36734959
score: 0
type: Comment
type: QuestionComment
has text: I am not sure about what you are asking. Did setting those environment variables solve the problem? Have you tried to open a ticket with the system owner about this? By the way, in my experience, -Xmx512 seems a bit low for a full gradle build and tests (it depends on your project, of course). Have you tried with -Xmx2048 or something like that?
comment on: http://stackoverflow.com/q/23866385

http://stackoverflow.com/q/23797400
tagged with: google-sheets
has title: VBA code to Google Script (Find difference in dates, find average, on Form Submit)
downvote count: 0
has body: I am currently working on creating an app in google sheets from code I wrote in excel VBA. There are 2 sheets, one contains user submitted info. This info is dates and it populates row by row. There are 8 columns of dates (8 entries per row). The other sheet finds the difference in the dates (i.e. days in between), calculates and calculates an average. I am having trouble with the script language and syntax but here is what I have so far: function calcValues() { //var ss = SpreadsheetApp.getActiveSheet(); //ss.insertRowAfter(ss.getLastRow()); //ss.getRange(ss.getLastRow(),1,1,ss.getLastColumn()).copyTo(ss.getRange(ss.getLastRow()+1,1)); //spreadsheet variable declared var ss = SpreadsheetApp.getActiveSpreadsheet(); //FormResponses sheet declared as variable var sFR = ss.setActiveSheet(ss.getSheetByName("FormResponses")); //Last row on form response sheet var last = sFR.getLastRow(); //Declare calcData sheet var sCD = ss.setActiveSheet(ss.getSheetByName("CalcData")); //Loop to write values to CalcData sheet for( var i = 2; i &lt; last; i++) if(sFR.getRange(i,1) !== 0){ sCD.getRange(3, 1, 1, 8).copyTo(sCD.getRange(i+2,1)) } } function FormSubmitUpdate() { //spreadsheet variable declared var ss = SpreadsheetApp.getActiveSpreadsheet(); //FormResponses sheet declared as variable var sFR = ss.setActiveSheet(ss.getSheetByName("FormResponses")); //Last row on form response sheet var last = sFR.getLastRow(); //Declare calcData sheet var sCD = ss.setActiveSheet(ss.getSheetByName("CalcData")); //sCD.getRange("B4").setValue(sFR.getRange("C3").getValue()- sFR.getRange("B3").getValue()) //sCD.insertRowAfter(sCD.getLastRow()); sCD.getRange(sCD.getLastRow(),1,1,sCD.getLastColumn()).copyTo(sCD.getRange(sCD.getLastRow()+1,1)); I currently have the formulas set in the cells and this code simply copies the formula down. calcValues counts how many user inputs there are and performs that many copies. formSubmitUpdate copies the previous row down one row. When I attempt to perform the sub…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36627475

http://stackoverflow.com/q/23821406
tagged with: android-edittext
tagged with: java
has comment: http://stackoverflow.com/comment/36649090
accepted answer: http://stackoverflow.com/a/23821539
downvote count: 3
has comment: http://stackoverflow.com/comment/36649145
possible better answer: http://stackoverflow.com/a/23821680
type: Question
has title: Convert Editable to Edittext
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36649191
favorite count: 0
has body: I have set a tag to An Edittext variable.i want get that tag inside text TextWatcher afterTextChanged method.but there is a Editable parameter not Edittext. here is my code..... EditText filled = new EditText(DamageCount.this); filled.setId(100); filled.setTag(5); and i want get that tag in @Override public void afterTextChanged(Editable s) { } this method ------Edited---------------- my whole java class public class DamageCount extends Activity { private Button button_next; static TableLayout tl = null; private DbWorker dbworker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_damage_count); DamageCount.this .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); button_next = (Button) findViewById(R.id.button_next); tl = (TableLayout) findViewById(R.id.show_competitor_product); dbworker = new DbWorker(this); Static_Values.arrayListdam_no = new ArrayList&lt;DamegeItemSerialNoModel&gt;(); button_next.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /*Intent new_one = new Intent(DamageCount.this, Invoice_or_prev.class); startActivity(new_one); finish();*/ for(DamegeItemSerialNoModel dmmm :Static_Values.arrayListdam_no) { System.out.println("Item id is "+dmmm.getItem_id()+" serial no is "+dmmm.getSerial_no()); } } }); Cursor cur_products= dbworker.getAllProduct(); int i=0; if(cur_products.moveToFirst()) { do{ i++; // Static_Values.item.put(, value) add_tbl_row(i,cur_products.getString(3),cur_products.getString(1)); } while(cur_products.moveToNext()); } else { } cur_products.close(); } public void add_tbl_row(int value, String name, String tag) { Static_Values.damaged_id=tag; TableRow new_row = new TableRow(DamageCount.this); System.out.println(Static_Values.damaged_id+" id bbb"); ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.ic_launcher); new_row.addView(imageView); TextView size = new TextView(DamageCoun…
has comment: http://stackoverflow.com/comment/36649590
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/23821539
has answer: http://stackoverflow.com/a/23821680
type: AnsweredQuestion

overriding
tags question: http://stackoverflow.com/q/23821606
tags question: http://stackoverflow.com/q/23900735
type: Tag
tag name: overriding

http://stackoverflow.com/comment/36692485
has text: Where have you put the `jarbundler` jar?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23844379
score: 0

http://stackoverflow.com/comment/42687858
type: Comment
has text: Be careful. Have you checked whether it parsed escape sequences properly? For example, in TSV inputs, '\' followed by '\t' represents a tab character inside a value. If you use a CSV parser to parse that, you'll get the escape sequence instead of the tab character. There are other escape sequences in TSV as well. Another thing to consider: if the value in your TSV field contains ", or worse, if it starts with ", your CSV parser may interpret that as a quoted value and won't stop reading until it finds another ", maybe a few hundred records later.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27086925

http://stackoverflow.com/comment/36616022
type: Comment
type: QuestionComment
has text: @AndrewThompson OP doesn't two documents pointing to the same "subject" to be opened.
comment on: http://stackoverflow.com/q/23802312
score: 0

http://stackoverflow.com/comment/36818114
comment on: http://stackoverflow.com/q/23910160
has text: Why do you want to start a Java Swing (Desktop) application on the server through JSP? You will most likely not see anything from the Swing UI ...
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/23875822
accepted answer of: http://stackoverflow.com/q/23875725
has body: Just declare the "everything" as global variable for the class in the class,so don't declare the variable "everything" inside the method. Just do like this public class yourclassname { String everything=""; private void buttonEncryptActionPerformed(java.awt.event.ActionEvent evt) { //and do you stuff here } private void buttonOKEncryptActionPerformed(java.awt.event.ActionEvent evt) { //and do you stuff here } }
type: Answer
answers question: http://stackoverflow.com/q/23875725
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23877814
has comment: http://stackoverflow.com/comment/130003740
has body: Samudra Gupta explains in his book1: The Logger object is the main object that an application developer uses to log any message. The Logger objects acting within a particular instance of an application follow a parent-child hierarchy. If you have the following configuration: log4j.rootLogger=WARN, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout log4j.logger.com.me.proj2=INFO This is how the logger hierarchy could end up looking:2 Samudra Gupta continues to explain: At the top of the hierarchy exists a root logger. The root logger exists outside the scope of any custom logger hierarchy that we may come up with. It always exists as the root logger for all possible logger hierarchies, and it has no namespace. All the other application-specific Logger objects are child objects to the root logger. The parent-child relationship of loggers signifies the dependency of the loggers acting within the same application. A child logger can inherit properties from its parent logger recursively up the tree. Typically, a child logger will inherit the following properties from its parent logger(s): Level: If the child logger has no explicit tree level specified, it will use the level of its closest parent or the first proper level it finds recursively up the hierarchy. Appender: If there is no appender attached to a logger, the child logger uses the appender of its closest parent logger or the first appender it finds recursively up the tree. ResourceBundle: ResourceBundles are key-value pattern properties files used for the localization of logging messages. A child logger inherits any ResourceBundle associated with its parent logger. NOTES 1 Samudra Gupta, Pro Apache Log4j, Second Edition (Berkeley, CA: Apress, 2005), 24-25, ISBN13: 978-1-59059-499-5 2 Dominic Mitchell, Logging in Java, http://happygiraffe.net/blog/2008/09/03/logging-in-java/, Retrieved 26 May 2014.
has comment: http://stackoverflow.com/comment/64248178
downvote count: 0
answers question: http://stackoverflow.com/q/23869207
has comment: http://stackoverflow.com/comment/92056494
has comment: http://stackoverflow.com/comment/66823753
type: Answer
score: 115
upvote count: 115
has comment: http://stackoverflow.com/comment/77118872

http://stackoverflow.com/comment/36624384
type: AnswerComment
score: 0
has text: I've worked with Microsoft Azure in a business enviroment. I really liked it but I'm not sure if setting up a server is not a little bit too much for this... Do you know swarmconnect (android)? Their services are free. Among other things they have a cloud storage that is exactly what I would need. I think I'll have a deeper look into it. Thank you for your input
type: Comment
comment on: http://stackoverflow.com/a/23793456

http://stackoverflow.com/comment/36643639
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23817909
type: AnswerComment
has text: I commented the line in log4j.xml that was causing the syslog error but I still get / "Failed". When I open the Syslog.Appender.class eclipse says the log4j-1.2.12.jar can't be found. It's located at ~/.m2/repository/log4j/log4j/1.2.12 and I've defined the M2_REPO variable.

http://stackoverflow.com/comment/36731596
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23864439
has text: Yes because I did this (I edit my post)

http://stackoverflow.com/comment/36652002
type: QuestionComment
has text: Whats the harm in removing(commenting out) the references to the package?
score: 0
comment on: http://stackoverflow.com/q/23822969
type: Comment

http://stackoverflow.com/comment/36771212
comment on: http://stackoverflow.com/q/23884914
score: 0
type: Comment
type: QuestionComment
has text: @Brian Didnt test on special characters / extremities! Thanks for suggesting it!

http://stackoverflow.com/q/23907168
has answer: http://stackoverflow.com/a/23913306
tagged with: intellij-idea
downvote count: 0
has body: As per the subject, I am trying to structurally search against all methods annotated with a specific annotation and with a specific return type. To be clearer, if I have methods like the followings: @MyAnnotation public String myMethod1(){} and @MyAnnotation public Integer myMethod2(){} I would like to find a way to formulate a structural search in IntelliJ to find, e.g., "all methods annotated with @MyAnnotation and with return type of String" and such search would return only myMethod1(). I am using IntelliJ 13 Ultimate. Thanks.
favorite count: 0
has answer: http://stackoverflow.com/a/27591254
tagged with: structural-search
score: 1
type: UnansweredQuestion
upvote count: 1
has title: Structural Search against return type of Annotated method in IntelliJ 13
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/23921936
answers question: http://stackoverflow.com/q/23921826
has body: Try adding the following permissions to your manifest. &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
score: 0
type: Answer

http://stackoverflow.com/comment/37659955
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24333586
has text: I am using IntelliJ IDEA 13.1.1 I will try this version :)
score: 0

http://stackoverflow.com/comment/36776414
type: QuestionComment
type: Comment
has text: what error it is showing?
comment on: http://stackoverflow.com/q/23888240
score: 0

http://stackoverflow.com/q/23907035
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to modify an XML document with JDOM, the problem is that does not change anything in the file. I've been searching the internet to modify the file and in any site explains how to save the file. I would like you to tell me what I do wrong or or if there is another way. Method code is: public void ocuparPlazaParking(){ //Se crea un SAXBuilder para poder parsear el archivo SAXBuilder builder = new SAXBuilder(); File xmlFile = new File( "C:/Users/Alejandro/Parking/parking.xml"); try { Document document = (Document) builder.build( xmlFile ); //Se obtiene la raiz 'parking' Element elementoParking = document.getRootElement(); //Obtengo las plantas List listadePlantas = elementoParking.getChildren( "planta" ); for ( int i=0; i &lt; listadePlantas.size(); i++ ){ Element elementoPlanta = (Element) listadePlantas.get(i); //Obtengo las filas List listadeFilas = elementoPlanta.getChildren( "fila" ); for ( int j = 0; j &lt; listadeFilas.size(); j++ ){ //obtengo la fila Element elementoFila = (Element) listadeFilas.get(j); //Obtengo los bloques List listadeBloques = elementoFila.getChildren( "bloque" ); for ( int k = 0; k &lt; listadeBloques.size(); k++ ) { Element elementoBloque = (Element) listadeBloques.get(k); List listadeElementos = elementoBloque.getChildren( "elemento" ); for ( int l = 0; l &lt; listadeElementos.size(); l++ ){ Element elementoElemento = (Element) listadeElementos.get(l); if(elementoElemento.getChildText("numero").equals("1003")){ elementoElemento.getChild("estado").setText("ocupada"); } } } } } } catch ( IOException io ) { System.out.println( io.getMessage() ); }catch ( JDOMException jdomex ) { System.out.println( jdomex.getMessage() ); } } And the DTD of the XML is: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!ELEMENT parking (planta+)&gt; &lt;!ATTLIST parking nombreParking CDATA #REQUIRED&gt; &lt;!ATTLIST parking direccion CDATA #REQUIRED&gt; &lt;!ATTLIST parking poblacion CDATA #REQUIRED&gt; &lt;!ATTLIST parking pais CDATA #IMPLIED&gt; &l…
has comment: http://stackoverflow.com/comment/36826034
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23914282
accepted answer: http://stackoverflow.com/a/23914282
has comment: http://stackoverflow.com/comment/36813382
tagged with: java
has comment: http://stackoverflow.com/comment/36815364
tagged with: jdom-2
tagged with: dtd
score: 0
answer count: 1
has title: Modifying XML using JDOM
favorite count: 0
upvote count: 3
downvote count: 3

http://stackoverflow.com/comment/36735559
comment on: http://stackoverflow.com/q/23866772
has text: You can use `BigDecimal`.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36777424
type: AnswerComment
score: 0
has text: Please carefully read the code in the gist. Each collision (for example bullet/player or player/wall) will have their own "contact lifecycle". That means in case two of those collisions happen, there will be twice a `beginContact`/`preSolve`/`postSolve`/`endContact`. Disabling one of them does not affect the other contact/collision at all. Thus they can also be handled by completely different handlers. One would disable the contact, the other would not.
type: Comment
comment on: http://stackoverflow.com/a/23886503

http://stackoverflow.com/q/23857481
tagged with: android
accepted answer: http://stackoverflow.com/a/23858779
has title: How to enter two activity links in another activity?
possible better answer: http://stackoverflow.com/a/23857723
has comment: http://stackoverflow.com/comment/36725535
has answer: http://stackoverflow.com/a/23857723
type: AnsweredQuestion
tagged with: java
tagged with: hyperlink
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23858779
tagged with: button
has body: I know my question might be stupid but I am new in Android App development and the Eclipse things but reached to e problem that can't find solution in internet. I am making multi-activity application and reached to a point where when i have two buttons in one of the activities and want each of them to lead to different other activities, the application crashes. When I lead them both to one activity, everything is fine. Here is my code and hope really my question not to be so stupid as I am thinking. public class Home extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Button myButton = (Button) findViewById(R.id.tables); myButton.setOnClickListener(goToTables); Button mySecondButton = (Button) findViewById(R.id.reservations); mySecondButton.setOnClickListener(goToMenu); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.home, menu); return true; } private OnClickListener goToTables = new OnClickListener(){ @Override public void onClick(View v) { doButton(); }}; private void doButton() { startActivity(new Intent(this, Tables.class)); } private OnClickListener goToMenu = new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub doSecondButton(); }}; private void doSecondButton() { startActivity(new Intent(this, Menu.class)); } } The goToTables works perfectly but I am missing something important to change in goToMenu. My other activities are: Tables and Menu. Can somebody please tell me where I am wrong? Thanks in advance!
score: 0

http://stackoverflow.com/q/23793305
answer count: 1
has answer: http://stackoverflow.com/a/27324540
tagged with: hudson
favorite count: 0
tagged with: jelly
tagged with: jenkins
has body: For anyone who is familiar with the Jelly tags for Jenkins plugins, you know that there is a specific getter/setter format used for the @checked value for the tag. My plugin parses an XML with interface values, and I need to dynamically create checkboxes for each of the values in the XML on the project page (via floatingBox.jelly). I have the XML file being input from the config page, the plugin action parsing the xml and passing a list of strings to the jelly, wherein it currently generates checkboxes based on the list. My dilemma is structuring my java/jelly relationship in a way that allows the plugin to communicate the @checked value to 1) pass the checked value to some unique dynamically created java boolean variable 2) hold the value in said variable and return. I'm currently using a Hashtable to store my key,value pairs but am not able to set values and return values using a single method call successfully. My floatingBox.jelly: <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:local="local"> Select Build Interfaces <j:forEach var="i" items="${it.getActions().get(0).getInterfaces()}"> <f:checkbox title="${i}" checked="${it.getActions().get(0).getCheckedInterfaces(i)}"/> </j:forEach> My Plugin Action code: public boolean getCheckedInterfaces(String name) { for (Map.Entry entry : checkedInterfaces.entrySet()) { if (entry.getValue().equals(name)) { return (Boolean)entry.getKey(); } } return false; } public void setCheckedInterfaces(String name) { checkedInterfaces.put(name, true); } public void parseInterfaces() throws IOException, InstantiationException, IllegalAccessException { if (getInterfacesPath()!=null || getInterfacesPath()!="") { GroovyClassLoader loader = new GroovyClassLoader(); Class groovyClass = loader.parseClass(new File("C:\\...\\src\\main\\groovy\\xmlTest.groovy")); GroovyObject groovyObj = (GroovyObject)groovyClass.newInstance()…
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: jenkins-plugins
type: Question
accepted answer: http://stackoverflow.com/a/27324540
has title: Dynamically create variables for Jelly checkboxes for Jenkins plugin
upvote count: 3

http://stackoverflow.com/comment/36717145
comment on: http://stackoverflow.com/q/23856838
type: Comment
has text: if you say that is the line where you have null pointer exception then json is null. Make sure its not. It will not work by re-install. That is obvious
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36605410
score: 0
type: QuestionComment
type: Comment
has text: @I wish I could think of a good - this is not Http, this is Https
comment on: http://stackoverflow.com/q/23798402

http://stackoverflow.com/comment/36827322
has text: @Mena I'm editing the question, sry
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23914287

http://stackoverflow.com/q/23916341
has title: How to add an attribute 'node-identifier' to transactions subsystem using jboss-cli?
score: 1
tagged with: java
tagged with: wildfly-8
tagged with: jboss
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23916535
type: UnansweredQuestion
tagged with: wildfly
upvote count: 1
has body: There's an XML element in standalone-full.xml: <uuid/> <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/> How to add an attribute node-attribute="MyNode" to the core-environment XML element? The result should look like: <uuid/> <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>

http://stackoverflow.com/a/23801742
upvote count: 1
downvote count: 0
type: AcceptedAnswer
has body: A preferred solution would be to use CardLayout, which will allow you to switch out views easily... The direct approach (which you are doing now) should be fixed by calling frame.revalidate() after you've added the gamePanel...but I'd still recommend the CardLayout
type: Answer
accepted answer of: http://stackoverflow.com/q/23801693
answers question: http://stackoverflow.com/q/23801693
score: 1

http://stackoverflow.com/comment/37211472
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23912772
has text: Same error still occurring?
type: Comment

http://stackoverflow.com/a/23807458
has comment: http://stackoverflow.com/comment/36622007
has body: You're not suppose to be able to call method2 on an object with static type Abstractclass1 (or s). You can't call bark() if you have an Animal (who knows, it might be a Cat in runtime) So, what to do? Either you change the static type to Abstractclass2 or you do a downcast, as such: ((Abstractclass2) yourObject).method2.
accepted answer of: http://stackoverflow.com/q/23807358
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/23807358
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/36716945
type: QuestionComment
has text: @user432 Woops, fixed.
comment on: http://stackoverflow.com/q/23856935
type: Comment
score: 0

http://stackoverflow.com/comment/77461239
type: Comment
comment on: http://stackoverflow.com/a/24011373
type: AnswerComment
has text: I suspect that `tlab` stands for Thread Local Allocation Buffer (https://blogs.oracle.com/jonthecollector/the-real-thing)
score: 0

http://stackoverflow.com/comment/36649770
comment on: http://stackoverflow.com/q/23821813
score: 4
has text: How is the percent over 100, so weird?
type: Comment
type: QuestionComment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/23885271
tags question: http://stackoverflow.com/q/23833561
tags question: http://stackoverflow.com/q/23874920
tags question: http://stackoverflow.com/q/23839506
tags question: http://stackoverflow.com/q/23898935
tags question: http://stackoverflow.com/q/23829753
tags question: http://stackoverflow.com/q/23899264
tags question: http://stackoverflow.com/q/23891382
tags question: http://stackoverflow.com/q/23856959
tags question: http://stackoverflow.com/q/23912554
tags question: http://stackoverflow.com/q/23858620
tags question: http://stackoverflow.com/q/23854986
tags question: http://stackoverflow.com/q/23811583
tags question: http://stackoverflow.com/q/23834744
tags question: http://stackoverflow.com/q/23817968
tags question: http://stackoverflow.com/q/23880942
tags question: http://stackoverflow.com/q/23869061
tags question: http://stackoverflow.com/q/23900115
tags question: http://stackoverflow.com/q/23802295
tags question: http://stackoverflow.com/q/23794262
tags question: http://stackoverflow.com/q/23808474
tags question: http://stackoverflow.com/q/23815537
tags question: http://stackoverflow.com/q/23926833
tags question: http://stackoverflow.com/q/23898266
tags question: http://stackoverflow.com/q/23888054
tags question: http://stackoverflow.com/q/23864882
tags question: http://stackoverflow.com/q/23816356
tags question: http://stackoverflow.com/q/23808460
tags question: http://stackoverflow.com/q/23881999
type: Tag
tags question: http://stackoverflow.com/q/23925722
tags question: http://stackoverflow.com/q/23825010
tags question: http://stackoverflow.com/q/23871265
tags question: http://stackoverflow.com/q/23787504
tags question: http://stackoverflow.com/q/23882251
tags question: http://stackoverflow.com/q/23812273
tags question: http://stackoverflow.com/q/23920740
tags question: http://stackoverflow.com/q/23939109
tags question: http://stackoverflow.com/q/23785789
tags question: http://stackoverflow.com/q/23837253
tags question: http://stackoverflow.com/q/23783279
tags question: http://stackoverflow.com/q/23857455
tags question: http://stackoverflow.com/q/23912288
tags question: http://stackoverflow.com/q/23883769
tags question: http://stackoverflow.com/q/23816716
tags question: http://stackoverflow.com/q/23919605
tags question: http://stackoverflow.com/q/23794317
tags question: http://stackoverflow.com/q/23780696
tags question: http://stackoverflow.com/q/23826520
tags question: http://stackoverflow.com/q/23874658
tags question: http://stackoverflow.com/q/23871694
tag name: json
tags question: http://stackoverflow.com/q/23784709
tags question: http://stackoverflow.com/q/23792220
tags question: http://stackoverflow.com/q/23896586
tags question: http://stackoverflow.com/q/23795230
tags question: http://stackoverflow.com/q/23896723
tags question: http://stackoverflow.com/q/23824462
tags question: http://stackoverflow.com/q/23832707
tags question: http://stackoverflow.com/q/23823044
tags question: http://stackoverflow.com/q/23898245
tags question: http://stackoverflow.com/q/23806690
tags question: http://stackoverflow.com/q/23854005
tags question: http://stackoverflow.com/q/23887739
tags question: http://stackoverflow.com/q/23839904
tags question: http://stackoverflow.com/q/23912587
tags question: http://stackoverflow.com/q/23929296
tags question: http://stackoverflow.com/q/23851132
tags question: http://stackoverflow.com/q/23907273
tags question: http://stackoverflow.com/q/23778614
tags question: http://stackoverflow.com/q/23882552
tags question: http://stackoverflow.com/q/23911891
tags question: http://stackoverflow.com/q/23875588
tags question: http://stackoverflow.com/q/23781783
tags question: http://stackoverflow.com/q/23832125
tags question: http://stackoverflow.com/q/23906650
tags question: http://stackoverflow.com/q/23908021
tags question: http://stackoverflow.com/q/23918580
tags question: http://stackoverflow.com/q/23846926
tags question: http://stackoverflow.com/q/23896610

http://stackoverflow.com/comment/47266907
type: AnswerComment
comment on: http://stackoverflow.com/a/23926548
type: Comment
has text: It should be `Toy toy` and not a `one-to-many` association. Check the question.
score: 0

http://stackoverflow.com/comment/37005675
has text: To be honest I never tried Kamon with Java, but according to the google group some people are doing it https://groups.google.com/forum/#!searchin/kamon-user/java/kamon-user/v0AvKmld9X4/PcBnlczhZRQJ
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23906952

http://stackoverflow.com/q/23825549
tagged with: class
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/36656768
tagged with: android
favorite count: 0
has body: I know there are many different causes for NPE but mine is slightly weird (At least to me). So I have converted my Activities to Fragments successfully, but my problem appears to be coming from the function that displays the date. When the application is running, everything works just fine. But as soon as you press the back button. The app force closes, then in the log it says I'm getting NullPointerException at line 102. So looking at the code, I did research on this but unfortunately got nothing. This is the line where the error is coming from when you press the back button. getActivity().runOnUiThread(new Runnable(){ Also I have tried disabling the back button (As I'm building a launcher and it's not needed). But it doesn't seem to be working. Here is the code for the whole date displaying method/function. // (Calendar) Date function - Displays dateview on Card final boolean keepRunning1 = true; Thread thread_two = new Thread(){ @Override public void run(){ while(keepRunning1){ // Make the thread wait half a second. If you want... try { Thread.sleep(500); } catch (InterruptedException e) { Toast.makeText(getActivity().getApplicationContext(), "Default Signature Fail", Toast.LENGTH_LONG).show(); e.printStackTrace(); } getActivity().runOnUiThread(new Runnable(){ @Override public void run(){ TextView date = (TextView) getView().findViewById(R.id.date); date.setText(DateUtils.formatDateTime(getActivity().getBaseContext(), System.currentTimeMillis(),DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR)); } }); } } }; thread_two.start(); Thanks for your time, hopefully you can shed some light on what I'm doing wrong. Logcat - 05-23 21:17:33.216: E/AndroidRuntime(6906): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.runOnUiThread(java.lang.Runnable)' on a null object reference 05-23 21:17:33.216: E/AndroidRuntime(6906): at com.activelauncher.fragments.UtilsFragment$2.run(U…
possible better answer: http://stackoverflow.com/a/23825719
has answer: http://stackoverflow.com/a/23825645
answer count: 5
has answer: http://stackoverflow.com/a/23825719
has answer: http://stackoverflow.com/a/23825732
type: AnsweredQuestion
has title: NullPointerException on getActivity().runOnUiThread(new Runnable(){
tagged with: java
has answer: http://stackoverflow.com/a/23825788
tagged with: eclipse
type: Question
upvote count: 43
linked to: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/23825732
has comment: http://stackoverflow.com/comment/36656682
downvote count: 0
has answer: http://stackoverflow.com/a/23825803
duplicate of: http://stackoverflow.com/q/218384
score: 43

http://stackoverflow.com/comment/36915140
comment on: http://stackoverflow.com/q/23867299
score: 0
type: Comment
type: QuestionComment
has text: Is KonyServerConnection extending JavaService?

http://stackoverflow.com/q/23789198
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23797675
tagged with: java
has answer: http://stackoverflow.com/a/23797675
tagged with: struts
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/23789896
tagged with: ognl
has title: How can we append 2 strings in Struts
downvote count: 0
tagged with: jsp
score: 4
favorite count: 0
tagged with: struts2
has comment: http://stackoverflow.com/comment/36606385
accepted answer: http://stackoverflow.com/a/23789896
has body: I need to append 2 String class variables using Struts 2 I tried like this &lt;s:set var="Name" value="#variable1+#variable2"/&gt; but no result.
linked to: http://stackoverflow.com/q/8242704
type: Question
has comment: http://stackoverflow.com/comment/36587781

eclipse
tags question: http://stackoverflow.com/q/23817051
tag name: eclipse
tags question: http://stackoverflow.com/q/23779322
tags question: http://stackoverflow.com/q/23821642
tags question: http://stackoverflow.com/q/23801310
tags question: http://stackoverflow.com/q/23888000
tags question: http://stackoverflow.com/q/23899336
tags question: http://stackoverflow.com/q/23838290
tags question: http://stackoverflow.com/q/23857246
tags question: http://stackoverflow.com/q/23883978
tags question: http://stackoverflow.com/q/23858817
tags question: http://stackoverflow.com/q/23845710
tags question: http://stackoverflow.com/q/23867762
tags question: http://stackoverflow.com/q/23856549
tags question: http://stackoverflow.com/q/23918491
tags question: http://stackoverflow.com/q/23779758
tags question: http://stackoverflow.com/q/23782196
tags question: http://stackoverflow.com/q/23922005
tags question: http://stackoverflow.com/q/23810940
tags question: http://stackoverflow.com/q/23807845
tags question: http://stackoverflow.com/q/23900401
tags question: http://stackoverflow.com/q/23898218
tags question: http://stackoverflow.com/q/23822529
tags question: http://stackoverflow.com/q/23849001
tags question: http://stackoverflow.com/q/23811574
tags question: http://stackoverflow.com/q/23800943
tags question: http://stackoverflow.com/q/23826874
tags question: http://stackoverflow.com/q/23886919
tags question: http://stackoverflow.com/q/23805028
tags question: http://stackoverflow.com/q/23872779
tags question: http://stackoverflow.com/q/23893946
tags question: http://stackoverflow.com/q/23806493
tags question: http://stackoverflow.com/q/23856908
tags question: http://stackoverflow.com/q/23780147
tags question: http://stackoverflow.com/q/23875766
tags question: http://stackoverflow.com/q/23867063
tags question: http://stackoverflow.com/q/23861049
tags question: http://stackoverflow.com/q/23895087
tags question: http://stackoverflow.com/q/23931732
tags question: http://stackoverflow.com/q/23854986
tags question: http://stackoverflow.com/q/23875084
tags question: http://stackoverflow.com/q/23855807
tags question: http://stackoverflow.com/q/23925344
tags question: http://stackoverflow.com/q/23798001
tags question: http://stackoverflow.com/q/23794354
tags question: http://stackoverflow.com/q/23867322
tags question: http://stackoverflow.com/q/23864472
tags question: http://stackoverflow.com/q/23861449
tags question: http://stackoverflow.com/q/23870654
tags question: http://stackoverflow.com/q/23863522
tags question: http://stackoverflow.com/q/23841103
tags question: http://stackoverflow.com/q/23811253
tags question: http://stackoverflow.com/q/23834385
tags question: http://stackoverflow.com/q/23830188
tags question: http://stackoverflow.com/q/23808365
tags question: http://stackoverflow.com/q/23840234
tags question: http://stackoverflow.com/q/23778513
tags question: http://stackoverflow.com/q/23822969
tags question: http://stackoverflow.com/q/23870728
tags question: http://stackoverflow.com/q/23884611
tags question: http://stackoverflow.com/q/23796197
tags question: http://stackoverflow.com/q/23781719
tags question: http://stackoverflow.com/q/23818931
tags question: http://stackoverflow.com/q/23848075
tags question: http://stackoverflow.com/q/23834220
tags question: http://stackoverflow.com/q/23905725
tags question: http://stackoverflow.com/q/23876637
tags question: http://stackoverflow.com/q/23880942
tags question: http://stackoverflow.com/q/23883014
tags question: http://stackoverflow.com/q/23884755
tags question: http://stackoverflow.com/q/23939294
tags question: http://stackoverflow.com/q/23929937
tags question: http://stackoverflow.com/q/23816738
tags question: http://stackoverflow.com/q/23896229
tags question: http://stackoverflow.com/q/23855030
tags question: http://stackoverflow.com/q/23872008
tags question: http://stackoverflow.com/q/23858266
tags question: http://stackoverflow.com/q/23896341
tags question: http://stackoverflow.com/q/23904882
tags question: http://stackoverflow.com/q/23894986

http://stackoverflow.com/q/23871508
has comment: http://stackoverflow.com/comment/36746124
has comment: http://stackoverflow.com/comment/36744883
linked to: http://stackoverflow.com/q/6309407
tagged with: java
tagged with: swing
has title: How to redirect user from one frame to another?
has answer: http://stackoverflow.com/a/23873107
type: Question
has answer: http://stackoverflow.com/a/23871965
score: -2
has comment: http://stackoverflow.com/comment/36744239
has comment: http://stackoverflow.com/comment/36744305
has comment: http://stackoverflow.com/comment/36744350
has comment: http://stackoverflow.com/comment/36744842
answer count: 2
downvote count: 3
has body: I'm trying to set a logon frame using Java Swing - Eclipse. I can't find how to redirect the user to another frame on success of the operation. Any brilliant idea, please?
upvote count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36744688
has comment: http://stackoverflow.com/comment/36744820
linked to: http://stackoverflow.com/q/9554636

http://stackoverflow.com/comment/36806200
type: Comment
comment on: http://stackoverflow.com/q/23903494
type: QuestionComment
has text: Please understand when to use REGEX and when not . if you want to replace a String literal , use string#replace with the String literal as the argument
score: 0

http://stackoverflow.com/q/23854669
has answer: http://stackoverflow.com/a/23854680
has body: public class Main { public static void main(String[] args) { long product = 1L; product = (9 * 9 * 9 * 9 * 9 * 9 * 9 * 9 * 9 * 9 * 9 * 9 * 9); System.out.println(product); product = 9L; for (int i = 0; i != 12; i++) { product *= 9; } System.out.println(product); } } Output :-754810903 2541865828329 //this one is correct
score: 4
has comment: http://stackoverflow.com/comment/36712763
upvote count: 4
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36712805
favorite count: 0
duplicate of: http://stackoverflow.com/q/12758338
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23854690
tagged with: java
has title: product of thirteen 9s are different in both approach in java
linked to: http://stackoverflow.com/q/12758338
type: Question

http://stackoverflow.com/comment/36723117
comment on: http://stackoverflow.com/a/23859101
type: AnswerComment
has text: That post still docent provide me with the information that I need. I somehow need to figure out how the get the Cdma networks dbm.
score: 0
type: Comment

dialog
tag name: dialog
type: Tag
tags question: http://stackoverflow.com/q/23787319
tags question: http://stackoverflow.com/q/23914599

http://stackoverflow.com/comment/36717751
type: QuestionComment
comment on: http://stackoverflow.com/q/23857246
type: Comment
has text: NO. The key has a **name**, which is **always a String**. But it also has a **value**, which is, in your case, the highScore **int** to save (and to retrieve).
score: 0

http://stackoverflow.com/a/23938832
has comment: http://stackoverflow.com/comment/36872278
has body: I might be wrong here, but as far as I know, you can't start an Intent passing a DialogFragment, you should pass an Activity. Here's what's wrong: Intent intent = new Intent(MainActivity.this, NewDialog.class); startActivity(intent); Since NewDialog is declared as a DialogFragment and not as an Activity subclass. If what you are trying to do is show the dialog, then you should do: NewDialog dialog = NewDialog(); // use getSupportFragmentManager() if using support fragments instead of native fragments, or // use getChildFragmentManager() if this code is inside a fragment rather than an activity dialog.show(getFragmentManager(), "pass-any-string-here");
answers question: http://stackoverflow.com/q/23938516
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23938516
has comment: http://stackoverflow.com/comment/36872908
type: Answer
has comment: http://stackoverflow.com/comment/36875004
score: 0

http://stackoverflow.com/q/23845710
accepted answer: http://stackoverflow.com/a/24223174
possible better answer: http://stackoverflow.com/a/23846863
favorite count: 0
has answer: http://stackoverflow.com/a/23846863
has body: Im am trying to deploy the app engine sample Guestbook. I selected JDK instead of jre in the paths as this is required to remove the error of the guestbook.jsp file. But now I am trying to deploy the app and i got this message: Cannot get the System Java Compiler. Please use a JDK, not a JRE. I read that I have to add the lines below to the eclipse.ini: -vm C:\Program Files (x86)\Java\jdk1.7.0_60\bin\javaw.exe But after doing this my eclipse wont start anymore. I get this: I dont know what to do now, so any help is welcome :)
has comment: http://stackoverflow.com/comment/36695077
has comment: http://stackoverflow.com/comment/36730866
tagged with: google-app-engine
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24223174
tagged with: eclipse
has title: Google app engine deploy does not work
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/19404733
upvote count: 0
has comment: http://stackoverflow.com/comment/36696073

http://stackoverflow.com/comment/57089520
score: 2
has text: After searching lots of QA.. I reached here. It makes me happy. Thanks Richard. one note, "mypersonalclass.data.model" this is not required for me. just check.
type: AnswerComment
comment on: http://stackoverflow.com/a/23826357
type: Comment

http://stackoverflow.com/q/23854005
upvote count: 1
linked to: http://stackoverflow.com/q/23726008
favorite count: 0
has title: error org.json.JSONObject cannot be converted to JSONArray
has answer: http://stackoverflow.com/a/23854026
tagged with: php
downvote count: 1
type: AnsweredQuestion
has body: I have a php file for my android project. I want it to show the array data from my php codes. but it show the error like "error parsing data org.json.JSONException ... error org.json.JSONObject cannot be converted to JSONArray" Here's the php codes : $rows = array(); $rows['nama_makanan'] = "you have yet to input"; $rows['Jtakaran'] = "-"; $data = "{food:".json_encode($rows)."}"; echo $data; I'm guessing the error is in the php code. because when I try to retrieve data from mysql the program is working fine. I'm sorry for my bad English . Any help would be appreciated, thank you ps : I want the data to retrieve as JSONArray because this is for expanadablelistview.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36711511
accepted answer: http://stackoverflow.com/a/23854026
score: 0

http://stackoverflow.com/comment/36850493
score: 0
has text: What is `removitems` defined as?
type: Comment
comment on: http://stackoverflow.com/q/23927054
type: QuestionComment

http://stackoverflow.com/comment/36625301
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23809129
has text: I would stick to the documented functionality of hashmap.

http://stackoverflow.com/q/23814665
has comment: http://stackoverflow.com/comment/36636127
has comment: http://stackoverflow.com/comment/36636125
has body: I'm told that for the android app I am trying ot help develop to work, I need to have Java 6, not 7 or 8. Unfortunately I have 7 installed. I know that on Linux, multiple copies of the JDK can be installed. Is this possible with OSX? Or to at least tell the IDE to use a different JDK?
tagged with: macos
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10424528
has comment: http://stackoverflow.com/comment/36636800
tagged with: android-studio
has title: Can I install multiple JDK's on OSX?
tagged with: java
has answer: http://stackoverflow.com/a/23815124
has comment: http://stackoverflow.com/comment/36642247
type: Question
has comment: http://stackoverflow.com/comment/36636751
has answer: http://stackoverflow.com/a/23814777
score: 0
answer count: 2

http://stackoverflow.com/comment/36666911
has text: please post the manifest.xml
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23830657
type: Comment

http://stackoverflow.com/q/23840468
has title: Downloading webpages and their resources within Java
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/36685768
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: apache-commons-httpclient
has answer: http://stackoverflow.com/a/23841850
linked to: http://stackoverflow.com/q/22600531
type: Question
has body: I am trying to download all comments for a given news article (in www.theguardian.com) I can get the article in Java and parse with Jsoup to obtain the url for the comments but when I try to download I get only a default page and number of comments (50). For instance the url for the comments might be http://discussion.theguardian.com/discussion/p/2nzaq If I load this page in Firefox and login with my user id I get the option to display all comments and the url becomes .../p/2nzaq#show-all but still java when given this url downloads only the default 50 comments same with .../p/2nzaq?orderby=newest&amp;per_page=50&amp;commentpage=1 Now I thought of trying wget or aria2 at the command prompt (windows) or through executing a shell command within java to obtain the comments with any of these urls and still the same default comment page and number. Firefox seems to have no problem displaying and downloading all comments. How can I automate this in java? Thanks per comment below Tried HttpClient with public class DownloadFile { public static void getFile(String url, String filepath) throws ClientProtocolException, IOException { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { //long len = entity.getContentLength(); InputStream inputStream = entity.getContent(); BufferedInputStream bis = new BufferedInputStream(entity.getContent()); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filepath))); int inByte; while((inByte = bis.read()) != -1) bos.write(inByte); bis.close(); bos.close(); } } public static void main(String[] args) throws IOException { Integer ii = 3; String MyUrl = "http://discussion.theguardian.com/discussion/p/2nzaq?orderby=newest&amp;per_page=50&amp;commentpage=" + ii.toString(); String MyFilePath = "./testfile" + ii.toString() + ".htm"; getFile(MyUrl,MyFilePath); } } Also tr…
tagged with: java
has comment: http://stackoverflow.com/comment/36687834
score: 0
has comment: http://stackoverflow.com/comment/36686335

http://stackoverflow.com/comment/36815563
type: AnswerComment
has text: We differ in our point of view, for me shorter arrays should appear before larger ones. However your point of view seems to match better the OP's: "...dictionary sorting/ lexicographically... " it is true that in the dictionary "apple" is located before "clue". So +1
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23907444

http://stackoverflow.com/comment/36773968
has text: can you make it more clear do you want two fields(url and host) in your document or just one field with data "www.example.com"
comment on: http://stackoverflow.com/q/23876100
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23848090
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23848160
accepted answer: http://stackoverflow.com/a/23848160
has answer: http://stackoverflow.com/a/23848181
type: Question
answer count: 2
upvote count: 1
has title: How to pass value for a treeset in spring?
has body: How to Set the argument value for a TreeSet in Spring? public class Trainer { String name; TreeSet<String> batches; public Trainer(String name, TreeSet<String> batches) { super(); this.name = name; this.batches = batches; } @Override public String toString() { StringBuilder x=new StringBuilder(); x.append("trainer:").append(name).append("\n"); x.append("batches:\n"); for(String a :batches) { x.append(a).append("\n"); } return x.toString(); } } //here is the configuration file kasdaskdnas sjbdlsas;dkas This throws an exception when trying to Create a object for it,could not convert constructor argument value of type [java.util.LinkedHashSet] to required type [java.util.TreeSet]:
possible better answer: http://stackoverflow.com/a/23848181
favorite count: 0
tagged with: spring
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/36761612
type: Comment
type: QuestionComment
has text: Only couple of other beans have been defined in this context file. The project is packaged as war and deployed in tomcat. In tomcat catalina.properties, config.base variable has been defined. This is the setup. As i mentioned, this variable works in other places but when defining constructor argument, the values is taken as given without replacing variables.
score: 0
comment on: http://stackoverflow.com/q/23880254

http://stackoverflow.com/a/23785613
has body: This is because when your class Consumer tries to consumer.execute(new Runnable() {, its executor is already shutdowned. Why? Because after line consumer.start(); your program terminates instantly: you don't wait until tasks will be executed. You should modify your code smthng like that: use submit method, instead of execute: producer.submit(new Runnable() {...} receive from execute() method Future&lt;?&gt; object: Future f = producer.submit(new Runnable() { ... } wait until that object will terminate: consumer.start(); f.get(); UPDATE According to updated code in question, we should discuss theese two new lines: consumer.start(); consumer.stop(); consumer.start(); You should known, that after your executor was stopped once, you will be not able to execute new task in it. So this explains why you receive this exception in last line consumer.start();.
type: Answer
has comment: http://stackoverflow.com/comment/36581134
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23785292
downvote count: 0

http://stackoverflow.com/a/23823282
has comment: http://stackoverflow.com/comment/36659030
type: Answer
answers question: http://stackoverflow.com/q/23823172
has body: May be this can help, Calendar cal = Calendar.getInstance(); //Set the Calendar date to 1st of the current month cal.set(Calendar.DATE, 1); // Subtract a day from it cal.set(Calendar.DATE,cal.get(Calendar.DATE)-1); // Prints the previous month end date System.out.println(cal.get(Calendar.DATE)); From the Calendar instance, you can get the Date by Date date = cal.getTime(); Finally, you can use SimpledateFormat to format your date as needed SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy"); System.out.println( "The date is: "+ sdf.format(date)); Hope, it helps!
score: 0
has comment: http://stackoverflow.com/comment/36660309

http://stackoverflow.com/q/23875629
tagged with: java
has comment: http://stackoverflow.com/comment/36752014
type: Question
upvote count: 2
has title: In what units are glVertex arguments measured in?
has comment: http://stackoverflow.com/comment/36751864
has comment: http://stackoverflow.com/comment/36791646
has answer: http://stackoverflow.com/a/23875700
accepted answer: http://stackoverflow.com/a/23875700
has body: So i recently started learning JOGL after being bored if Vanillla Java since no ideas came to my mind. I have learned how to draw triangles, lines and everything simple but theres what i do not understand. What are opengl measurement units because it clearly doesnt count pixels by default. My render method: private void render(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glBegin(GL.GL_LINES); gl.glVertex3f( 0.25f, -0.25f, 0); gl.glVertex3f(-0.25f, 0.25f, 0); gl.glEnd(); } Even a dumb person would undestand that to render out a line which is 0.25 pixels wide is impossible. So what's the catch here? :) Looking forward to your answer! Best regards!
has comment: http://stackoverflow.com/comment/36753319
has comment: http://stackoverflow.com/comment/36752894
answer count: 1
has comment: http://stackoverflow.com/comment/36751997
favorite count: 0
tagged with: jogl
has comment: http://stackoverflow.com/comment/36753195
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36752801
tagged with: opengl

timeout
tags question: http://stackoverflow.com/q/23784881
tags question: http://stackoverflow.com/q/23816711
type: Tag
tags question: http://stackoverflow.com/q/23812386
tags question: http://stackoverflow.com/q/23927420
tag name: timeout

http://stackoverflow.com/q/23929296
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23929440
possible better answer: http://stackoverflow.com/a/23929440
tagged with: android
has answer: http://stackoverflow.com/a/23929347
type: AnsweredQuestion
has title: How to get data from a very big JSON array?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I am using an API for a game and it returns a very big JSON object. The problem is when i try to access an integer in it, it is not working and showing a part of JSON Object in logcat with orange text, system.err. How can i access any value i want in this array? The code and the structure of the json object is shown bellow. private class getGame extends AsyncTask&lt;Integer, Integer, String&gt;{ Context context; private getGame(Context context) { this.context = context.getApplicationContext(); } String response; @Override protected String doInBackground(Integer... params) { HttpClient client = new DefaultHttpClient(); String geturl = "https://eu.api.pvp.net/api/lol/tr/v1.3/game/by-summoner/1795120/recent?api_key=cea2196c-6a12-474f-8f6d-52ad5e612cbc"; HttpGet get = new HttpGet(geturl); HttpResponse responseGet = null; try { responseGet = client.execute(get); HttpEntity resEntityGet = responseGet.getEntity(); response = EntityUtils.toString(resEntityGet); JSONObject jsonObj = new JSONObject(response); JSONObject gamesObj = jsonObj.getJSONObject("games"); JSONObject game0 = jsonObj.getJSONObject("0"); Log.e("test", ""+game0.getInt("gameId")); return ""; } catch (Exception e) { e.printStackTrace(); } return null; } } This is the structure of Json object and logcat warnings and example jsonobject is here
tagged with: arrays
has comment: http://stackoverflow.com/comment/36854229
accepted answer: http://stackoverflow.com/a/23929347
has comment: http://stackoverflow.com/comment/36854282

http://stackoverflow.com/comment/53099558
type: Comment
has text: @TagirValeev: You're right about the thread-safety, good point. How could this be done with combining collectors?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25961951

http://stackoverflow.com/comment/36766360
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/23882873
has text: No, @shekhar, try running 15 through your `squareroot` function. It returns 2, no matter whom you believe.
type: Comment

http://stackoverflow.com/comment/36760283
comment on: http://stackoverflow.com/q/23879732
type: Comment
type: QuestionComment
has text: How about without a switch statement?
score: 0

http://stackoverflow.com/q/23936162
tagged with: web
answer count: 4
favorite count: 0
has title: Register shutDownHook in web application
has body: How we can registerShutdown hook in web application? Is there any whays to register it in web.xml or in applicationContext.xml? I know that if we are using application with main class it's simple. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml"); context.registerShutdownHook(); But what about web application? As it uses ContextListener
has comment: http://stackoverflow.com/comment/75388903
has answer: http://stackoverflow.com/a/23938063
accepted answer: http://stackoverflow.com/a/23938063
possible better answer: http://stackoverflow.com/a/23936455
tagged with: spring
upvote count: 23
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/44186887
tagged with: java
score: 23
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23936455
tagged with: tomcat
has answer: http://stackoverflow.com/a/27823731
tagged with: ioc-container

http://stackoverflow.com/comment/36724847
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23860794
type: Comment
has text: Thanks that did the trick I've been at it for hours now... Thankyou so much!

http://stackoverflow.com/a/23809509
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23803024
answers question: http://stackoverflow.com/q/23803024
has comment: http://stackoverflow.com/comment/36819609
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: One option is to attach the Storm tuple to the Esper input event as a property and make sure the Esper EPL selects the property either by "select *" or "select originaltuple". The listener can then use that. The other option is to track this outside of Esper by using some event id that you may have. Or use the input event identity via identity hashmap mapping the input event to the tuple. The listener would then need to do some lookup based on the Esper input event that is the same reference that Esper also delivers to the listener, and remove.

http://stackoverflow.com/comment/36618397
has text: Do you understand what a null-pointer exception means?
score: 3
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23805638

http://stackoverflow.com/comment/36745978
type: Comment
comment on: http://stackoverflow.com/a/23872326
type: AnswerComment
score: 0
has text: I get this `Error:(21, 21) non-static method getContext() cannot be referenced from a static context`

http://stackoverflow.com/a/23842883
answers question: http://stackoverflow.com/q/23842814
type: Answer
has comment: http://stackoverflow.com/comment/36696322
has comment: http://stackoverflow.com/comment/36696169
has comment: http://stackoverflow.com/comment/36695652
has body: When using JpaTransactionManager, you should specify the dialect as well as below. <property name="entityManagerFactory" ref="entityManagerFactory"/> <property name="jpaDialect" ref="jpaDialect"/> Update: No transaction is required to read data from database but active transaction is required to write data to database. If you don't configure the transactionManager correctly, @Transaction annotation will be ignored silently and all your operation will run as if no transaction is available; therefore, your write operation will fail.
has comment: http://stackoverflow.com/comment/36695856
score: 0

http://stackoverflow.com/comment/36650022
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23821055
score: 0
has text: <constant name="struts.patternMatcher" value="regex"/> try this

http://stackoverflow.com/comment/36852991
has text: So you want to add a newline character at the end of every line
comment on: http://stackoverflow.com/q/23928536
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23911857
has comment: http://stackoverflow.com/comment/36827169
has title: comparing a map and returning right value
tagged with: dictionary
has comment: http://stackoverflow.com/comment/36822406
has comment: http://stackoverflow.com/comment/36825184
has comment: http://stackoverflow.com/comment/36822274
accepted answer: http://stackoverflow.com/a/23913816
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36821726
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36823032
has comment: http://stackoverflow.com/comment/36825045
has comment: http://stackoverflow.com/comment/36822744
type: Question
has comment: http://stackoverflow.com/comment/36832113
has comment: http://stackoverflow.com/comment/36824589
has comment: http://stackoverflow.com/comment/36826382
tagged with: java
tagged with: sorting
has comment: http://stackoverflow.com/comment/36825015
has comment: http://stackoverflow.com/comment/36832147
score: 0
has answer: http://stackoverflow.com/a/23913816
tagged with: arrays
answer count: 1
favorite count: 0
has body: I am trying to retrieve a double value from my map however the data is coming back in array form e.g. [value]. What am i doing wrong? I want the original value to be returned without the []. I can convert to a string, remove then convert it but that is messy List&lt;Map&lt;Object,List&lt;Map&lt;String,Object&gt;&gt;&gt;&gt; tempValues = new ArrayList&lt;Map&lt;Object,List&lt;Map&lt;String,Object&gt;&gt;&gt;&gt;() for (Map&lt;Object,List&lt;Map&lt;String,Object&gt;&gt;&gt; map : tempValues) { List&lt;Object&gt; temp = new ArrayList&lt;Object&gt;(); for (Entry&lt;Object, List&lt;Map&lt;String, Object&gt;&gt;&gt; entry : map.entrySet()) { for(int i =0; i &lt; entry.getValue().size(); i++) temp.add(entry.getValue().get(i).values()); } } }

http://stackoverflow.com/comment/36763021
comment on: http://stackoverflow.com/a/23870203
score: 0
type: AnswerComment
has text: I just created this to solve the problem of writing Text area content to text file, I am not explaining layout here. And ya I am not a Swing programmer
type: Comment

http://stackoverflow.com/q/23928210
type: UnansweredQuestion
tagged with: maven
tagged with: web-services
tagged with: spring
has comment: http://stackoverflow.com/comment/36854680
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36853085
has comment: http://stackoverflow.com/comment/36855098
answer count: 0
has comment: http://stackoverflow.com/comment/36852970
tagged with: java
has comment: http://stackoverflow.com/comment/36854899
has comment: http://stackoverflow.com/comment/36858293
type: Question
has comment: http://stackoverflow.com/comment/36852493
has comment: http://stackoverflow.com/comment/36857339
has body: Could someone give me list of jars required to create spring web service project? I visited both MVN Repo and Spring Web Site but did not understand which are manadatory jars to create a spring-ws project.
score: 0
has title: Jars required to create a spring web service project
has comment: http://stackoverflow.com/comment/58149572

http://stackoverflow.com/q/23921864
type: Question
has title: NPE accessing Application method from AlerDialog OnClick method
accepted answer: http://stackoverflow.com/a/23923207
tagged with: java
has comment: http://stackoverflow.com/comment/36840978
has comment: http://stackoverflow.com/comment/36840862
answer count: 1
has comment: http://stackoverflow.com/comment/36840944
has comment: http://stackoverflow.com/comment/36841696
has comment: http://stackoverflow.com/comment/36841800
score: 0
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/36840916
has answer: http://stackoverflow.com/a/23923207
tagged with: android-alertdialog
type: AnsweredQuestion
has body: Building on a theme from yesterday...I'm getting an NPE accessing a method in a singleton Application class from within an AlertDialog. Activity SavedMealsActivity sets OnLongClickListenerSavedMeals as the listener for a series of TextViews in a ScrollView. OnLongClickListenerSavedMeals is defined as a separate class. OnLongClickListenerSavedMeals displays an AlertDialog which gives the option of going to a different Activity, but it first needs to fire the methods of an Application class which is defined as a singleton (MealTimerApplication). This is the first line of the onClick method (line 25 in the first code sample below), and it throws the NPE because the activity is null at the time. I've tried passing in the activity from the calling Activity (SavedMealsActivity) but for some reason it's not working as I'd hoped. Any ideas? OnLongClick listener class - OnLongClickListenerSavedMeals: public class OnLongClickListenerSavedMeals implements OnLongClickListener { Context context; String id; private Activity activity; public OnLongClickListenerSavedMeals(Activity activity) { this.activity = activity; this.context = activity; } @Override public boolean onLongClick(View view){ // TODO Auto-generated method stub this.context = context; id = view.getTag().toString(); final CharSequence[] items = { "Edit", "Delete" }; //Set activity to allow context to be used in the OnClickListener/onClick method below this.activity = activity; new AlertDialog.Builder(context).setTitle("Meal Item") .setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { //Set the global meal_id variable and invoke the MealActivity ((MealTimerApplication) activity.getApplication()).setMealId(Long.getLong(id)); Intent myIntent = new Intent(activity.getBaseContext(),MealActivity.class); activity.startActivityForResult(myIntent, 0); } else if (item == 1) { boolean deleteSuccessful = new TableControllerMeal(context).delete(id); if (d…

http://stackoverflow.com/q/23821548
has comment: http://stackoverflow.com/comment/36649608
tagged with: spring
downvote count: 1
has body: I am new to Spring &amp; Hibernate. I have to develop some REST API. So i need help to choose correct version of Spring &amp; Hibernate. Some beginner developer suggest spring 3.0 &amp; Hibernat2 2.0. Does it a right choice or i have to go with spring 3.0 and spring 3.0?
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23821675
tagged with: java
tagged with: hibernate
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23821608
has answer: http://stackoverflow.com/a/23821664
has title: Which Spring & Hibernate Version to be used
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/23821675
possible better answer: http://stackoverflow.com/a/23821664
upvote count: 3

http://stackoverflow.com/q/23842117
upvote count: 1
has comment: http://stackoverflow.com/comment/36689346
answer count: 1
has title: Searching String Array item in a nested HashMap
downvote count: 1
tagged with: hashmap
has body: I have a nested HashMap (outer_map), which has another HashMap inside of it as a value (inner_map), such implemented as Map&lt;String, HashMap&lt;String, String&gt;&gt; outer_map = new HashMap&lt;String, HashMap&lt;String, String&gt;&gt;(); Map&lt;String, String&gt; inner_map = new HashMap&lt;String, String&gt;(); The figure below illustrates the whole structures of the maps: To make the long story short, I need to compare and search values inside the outer_map's vlaue (inner_map) by String Array items, and then produce another String Array to add matched items. If the String Array has there elements which are the same as one of the inner_map's random (for example; value2, value1, and value7) values, how can I search and compare these items to add to another String Array? The latest code snippet I tried and I couldn't succeed: if( !( theStringArray.equals("") ) ) { while( outer_map.keySet().iterator().hasNext() ) { for( int i=0; i &lt;= theStringArray.length; i++) { // outer_map keys are order as 1,2,3,..,8 theStringArray[i] = outer_map.get(String.valueOf(i+1)).get("key1"); ... } } } EDIT: Map generating function private void parse(String in) throws IOException { reader = new JsonReader(new StringReader(in)); ... int nodeCounter = 1; while(reader.hasNext()) { ... String nameAsKey1 = "blabla"; // value1 inner_map.put("name", nameAsKey1); String surnameAsKey2 = "blabla"; // value2 inner_map.put("surname", surnameAsKey2); ... outer_map.put(String.valueOf(nodeCounter), (HashMap&lt;String, String&gt;) inner_map); inner_map = new HashMap&lt;String, String&gt;(); nodeCounter++; } } EDIT: I don't know how I can explain the issue more clearly, but may be this will help to understand about it: Map structure
tagged with: arrays
type: AnsweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36688626
has answer: http://stackoverflow.com/a/23936757
has comment: http://stackoverflow.com/comment/36688878
has comment: http://stackoverflow.com/comment/36689195
accepted answer: http://stackoverflow.com/a/23936757
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36688665

http://stackoverflow.com/comment/36760663
type: Comment
has text: I typed it myself. The idea was to create a "Settings" dialog that could change private variables in the outer-class. However, given the feedback from @MadProgrammer, I guess the way I should do this is by passing the different 'settings' (or possibly the outer-class itself) to the stand-alone form and retrieving new values once the dialog is closed.
comment on: http://stackoverflow.com/q/23879650
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36576813
has text: show your JSON string - I think it contains the word "NULL" in it - I've updated my answer with that.
type: Comment
comment on: http://stackoverflow.com/q/23782750
type: QuestionComment
score: 1

http://stackoverflow.com/q/23845398
tagged with: tree-traversal
has comment: http://stackoverflow.com/comment/36694683
tagged with: algorithm
downvote count: 0
duplicate of: http://stackoverflow.com/q/5471731
has comment: http://stackoverflow.com/comment/36707463
has comment: http://stackoverflow.com/comment/36694494
has comment: http://stackoverflow.com/comment/36694453
upvote count: 1
has title: Getting the previous few nodes in binary search tree
has comment: http://stackoverflow.com/comment/36694565
favorite count: 0
has comment: http://stackoverflow.com/comment/36694350
tagged with: binary-search-tree
has comment: http://stackoverflow.com/comment/36694475
has body: I've implemented a binary search tree in Java that can search for a particular node. After I find a particular node, I'd also like to retrieve a particular number of nodes (say, 5) that are ordered before the node found. The only way I can think of to achieve this is: Traverse through the entire tree, add each node to an arraylist (or another flat data structure), and then find the node in the arraylist and retrieve the five previous nodes. But this is inefficient and inelegant. Is there a way to do this just by traversing through the tree, backwards?
answer count: 0
has comment: http://stackoverflow.com/comment/36694419
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5471731
has comment: http://stackoverflow.com/comment/36694405
tagged with: tree
has comment: http://stackoverflow.com/comment/36694985
has comment: http://stackoverflow.com/comment/36696793
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36694426
has comment: http://stackoverflow.com/comment/36694531
type: Question

http://stackoverflow.com/q/23831671
type: AnsweredQuestion
tagged with: insert-into
has comment: http://stackoverflow.com/comment/36668360
accepted answer: http://stackoverflow.com/a/23832083
has comment: http://stackoverflow.com/comment/36668631
tagged with: java
tagged with: sqlanywhere
has body: In my java program i'm trying to insert users into my database only if not exists but when i insert java catch exception anyway. Here is the code public void UserToDB(Registered registered) throws SQLException{ Connection conn = SimpleDataSource.getConnection(); try { PreparedStatement stat = conn.prepareStatement("INSERT INTO User(ID,Email,Name,LastName,Password) VALUES(?,?,?,?,?)" + "WHERE NOT EXISTS (SELECT * from User WHERE Email = ?)"); stat.setInt(1,registered.getId()); stat.setString(2,registered.getEmail()); stat.setString(3,registered.getName()); stat.setString(4,registered.getLastName()); stat.setString(5,registered.getPassword()); stat.setString(6,registered.getEmail()); stat.executeUpdate(); }catch(SQLException e){ System.out.println("Error: Email already exists"); } finally { conn.close(); } } Stack trace: Exception in thread "main" com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT * from User WHERE Email = '4444@hotmail.com')' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504) at social_network.DBManager.UserToDB(DBManager.java:51) at social_network.Social_Network.main(Social_Network.java:36) How can i fix?
has answer: http://stackoverflow.com/a/23832213
type: Question
has comment: http://stackoverflow.com/comment/36668315
answer count: 2
tagged with: database
possible better answer: http://stackoverflow.com/a/23832213
has comment: http://stackoverflow.com/comment/36668594
score: 0
has answer: http://stackoverflow.com/a/23832083
has comment: http://stackoverflow.com/comment/36668447
has comment: http://stackoverflow.com/comment/36668692
has title: Java Database "insert into" syntax error

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23814991
type: Tag

http://stackoverflow.com/q/23783857
has title: Is it bad practice to use reflection to determine method to call? Is there a better way?
answer count: 2
score: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23783987
tagged with: reflection
upvote count: 2
tagged with: java
has body: I am currently working on a very complex program that has multiple different components, and is deployed on Client site at different stages. Release management is in place, but is a bit fiddly, and I need to change a fairly fundamental component that will impact all other libraries that will be built with it. My question is, rather than announce it as a breaking change, and forcing all libraries to update to the new component for the next release, I'm thinking I could use reflection to see if the new class I am adding exists, if so use it, otherwise carry on using the old method. Then in a couple months' time, I will go through and remove this, and remove the old method. This means that the various client teams that are at different stages of deployment won't suddenly find they have to upgrade everything at the same time, or nothing at all. Does this seem like it would have any obvious drawbacks, is it considered terrible practice to use reflection to 'detect version', or does this sound ok?
type: Question
has answer: http://stackoverflow.com/a/23784047

http://stackoverflow.com/comment/36655665
type: QuestionComment
has text: The `||` operator doesn't work the way they think they do in regex
score: 2
comment on: http://stackoverflow.com/q/23824930
type: Comment

http://stackoverflow.com/q/23834049
has comment: http://stackoverflow.com/comment/36673050
has comment: http://stackoverflow.com/comment/36672773
favorite count: 0
has comment: http://stackoverflow.com/comment/36672873
has title: how do you sort group of arrays that are paired to each other?
type: Question
has answer: http://stackoverflow.com/a/23834308
has body: how do you sort group of arrays that are paired to each other? for example is that if you have an array of student numbers and student names. how can i make student names adjust too. when you sort it by student number? example output of what i wanted to be: unsorted: ID numbers name course 5 jomar IT 3 karen CS sorted (by ID numbers) ID numbers name course 3 karen CS 5 jomar IT I've tried to use TreeMap but there's this problem that if the value of ID numbers are the same, it will overwrite the other and it will print like this: sorted (by ID numbers) ID numbers name course 3 karen CS in reply to Stultuske i tried to use 1 array that contains id num, name, course. its like this: for(int i=0;i&lt;array.length;i++){ String [][] storeAllArray = {{array[i]},{array2[i]},{array3[i]}}; System.out.println(storeAllArray[0][0] + " " + storeAllArray[1][0] + " " + storeAllArray[2][0]); }
has comment: http://stackoverflow.com/comment/36672909
has answer: http://stackoverflow.com/a/23834242
score: 0
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36672886
downvote count: 1
has answer: http://stackoverflow.com/a/23834447
tagged with: java
tagged with: arrays
tagged with: sorting
type: UnansweredQuestion

http://stackoverflow.com/comment/36657483
comment on: http://stackoverflow.com/q/23825805
has text: Sorry, I corrected code, actually I am adding listener on the component only... nameText is a Text (in SWT)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23816793
tagged with: oauth
type: AnsweredQuestion
tagged with: java
tagged with: linkedin-j
type: Question
score: 0
has title: linkedin-j 401 for URL: https://api.linkedin.com/uas/oauth/requestToken
tagged with: linkedin-jsapi
tagged with: linkedin-api
answer count: 1
accepted answer: http://stackoverflow.com/a/23817014
has body: I try to log in with linkedIn API. But i get exception: 401 for URL: https://api.linkedin.com/uas/oauth/requestToken I used this example : http://karanbalkar.com/2013/09/tutorial-57-connect-to-linkedin-using-java-and-oauth/ There is something with this path http[s]://api.linkedin.com/uas/oauth/requestToken This piece of code call exception: LinkedInRequestToken requestToken= oauthService.getOAuthRequestToken(); But it doesn`t work. Please, help me!
has answer: http://stackoverflow.com/a/23817014

http://stackoverflow.com/comment/36618771
score: 0
type: Comment
has text: can you explain? how i can implements broadcast recivers.
type: AnswerComment
comment on: http://stackoverflow.com/a/23805880

http://stackoverflow.com/q/23856021
accepted answer: http://stackoverflow.com/a/23856246
upvote count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36715257
has answer: http://stackoverflow.com/a/23856246
has title: What is wrong this following code?
favorite count: 0
possible better answer: http://stackoverflow.com/a/23856063
tagged with: joptionpane
has body: I wanted to add an ImageIcon to the JOptionPane when displayed but when i run the JOptionPane shows up but the icon does not ... note : the argument "this" is the Frame and santorini is a game I made and the JOptionPane is supposed to be displayed when game is over to announce the winner ... so any help ? if (santorini.isGameOver()) { JOptionPane.showMessageDialog( this, "Winner is " + santorini.getWinner().getName(), "Winner is", JOptionPane.INFORMATION_MESSAGE, new ImageIcon ("pyramid2nlayer 1.png") ); }
has answer: http://stackoverflow.com/a/23856063
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36730775
type: Question
answer count: 2
downvote count: 2

http://stackoverflow.com/comment/36758610
has text: @SotiriosDelimanolis Well, I've posted what I get when stepping through the code using a breakpoint. Perhaps the debugger translates html entities e.g. `<` is actually something like `&lt;`? However, I think I'll go find a parsing lib instead. Got any suggestions?
comment on: http://stackoverflow.com/a/23878780
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23818748
has body: I'm actually working on such a game myself, so my approach may differ from what's best for you. I personally use one of Google's Guava caches, with a removal listener. When a object is removed for any reason other than my removing it manually, I write it to disk. An example would be: LoadingCache&lt;Position2D, BlockOfTiles&gt; graphs = CacheBuilder.newBuilder() .maximumSize(10000) .expireAfterWrite(10, TimeUnit.MINUTES) .removalListener(new MyTileMapListener()) .build( new CacheLoader&lt;Position2D, BlockOfTiles { public Graph load(Key key) throws AnyException { return loadFromDisk(key); } }); MyTileMapListner might look something like this: private class MyTileMapListener implements RemovalListener&lt;Position2D, MyBlockOfTiles&gt;{ @Override onRemoval(RemovalNotification&lt;K,V&gt; notification){ if(notification.getCause()==RemovalCause.EXPLICIT) return; writeToDisk(notification.getKey(), notification.getValue()); } } Currently, I'm able to keep 30K objects nicely loaded, in spite of their having large int[][][] arrays as fields. A word of caution: The caches create threads internally. Make sure to use at least basic synchronization to keep the removal listener from interfering with your main thread when trying to write. Something as simple as synchronized(someCommonObject){ // read or write } would work, and would be fairly idiomatic if the common object is your file output stream or something. Databases like LevelDB usually handle this for you.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36644052
answers question: http://stackoverflow.com/q/23818646
downvote count: 0
has comment: http://stackoverflow.com/comment/36644080
upvote count: 2

http://stackoverflow.com/q/23892806
tagged with: selenium-rc
type: Question
has body: I have a dedicated test server which runs selenium standalone server with no role specified. I have Xvfb and firefox running on that server. My junit test can successfully connect and create driver object as follows: @Before public void setUp() throws Exception { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); driver = new RemoteWebDriver(new URL("http://192.168.132.102:4444/wd/hub/"), capabilities); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } Everything is normal until I select some element from the reqested URL: driver.get("http://www.google.com"); // works fine logger.info(driver.getTitle()); // working fine also However when i evaluate any method on the result (elem reference) of (in debugging session): RemoteWebElement elem = ((RemoteWebDriver)driver).findElementById("gbqfq"); elem.getLocation(); // exception elem.getText(); // exception elem.getSize(); // exception I get NullPointerException as follows: Session ID: bf2eeaa9-3abd-42d5-9210-8255712b9e63 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.getText(RemoteWebElement.java:152) at match.selenium.testcases.ExampleTest.test2(ExampleTest.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.Delegat…
tagged with: firefox
has title: selenium RemoteWebDriver firefox producing NullPointerException
upvote count: 1
tagged with: junit
answer count: 1
has answer: http://stackoverflow.com/a/24158234
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/36659593
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23826874
type: QuestionComment

http://stackoverflow.com/comment/36599122
score: 0
comment on: http://stackoverflow.com/q/23795033
type: Comment
type: QuestionComment
has text: For example if I select (component N° 2) from the JcomboBox then the image that I need to display is image2.png (j=2)

lemmatization
type: Tag
tag name: lemmatization
tags question: http://stackoverflow.com/q/23853643

http://stackoverflow.com/comment/36757281
has text: In such cases I sometimes create a schema WITH targetNamespace and fix XML before giving it to XML mapping library.
comment on: http://stackoverflow.com/a/23878169
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36742719
score: 0
type: Comment
type: QuestionComment
has text: Yes I suspected that would be the case and didn't flag as duplicate. I don't know an answer off the bat and don't have the time to experiment right now.
comment on: http://stackoverflow.com/q/23870565

http://stackoverflow.com/comment/36754689
has text: Is your loop implemented correctly? Don't seem to see the loop block {} in your code.
type: Comment
comment on: http://stackoverflow.com/q/23876420
score: 0
type: QuestionComment

http://stackoverflow.com/a/23865715
score: 1
type: Answer
has body: This has nothing to do with Tomcat. For one, \\host\share is the Windows-specific way to access a CIFS/SMB share from an Explorer window; it won't work on *nix where you have to mount the share to a directory. If you're willing to change the code in the war, take a look at Java open file on shared location or at JCIFS. Or if you map the share to a network drive, you can do z:\....
upvote count: 1
has comment: http://stackoverflow.com/comment/36764589
answers question: http://stackoverflow.com/q/23865023
downvote count: 0

http://stackoverflow.com/q/23894839
type: Question
tagged with: components
has answer: http://stackoverflow.com/a/23895098
tagged with: java
tagged with: jpanel
answer count: 2
has body: I'm begging with JAVA Swing. But when I use my JPanel can I only add one JTextPane. How can I do so I can add multiple. Here's is what I do JPanel panel = new JPanel(); JTP = new JTextPane(); JTP.setBackground(Color.black); JTP.setForeground(Color.WHITE); Lines = new JTextPane(); new BorderLayout(); panel.add(JTP, BorderLayout.WEST); new BorderLayout(); panel.add(Lines, BorderLayout.EAST); And there's is no errors. I know i not have giving you all the code but it's work.
tagged with: jtabbedpane
score: 0
has title: JAVA JTAB multiple compoments
has answer: http://stackoverflow.com/a/23895037
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/36905310
type: Answer
answers question: http://stackoverflow.com/q/23781700
score: 0
has body: I was facing the same problem after doing those changes mentioned in your question. However, in VideoPlayerHelper.java, I just commented the AssetFileDescriptor code(3 lines) //AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename); //mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),afd.getLength()); //afd.close(); and uncommented/changed the following line mMediaPlayer.setDataSource("http://giftsoninternet.com/android/EngageApp/VuforiaSizzleReel_1.m4v"); I corrected this problem by commenting one line in VideoPlayback.java file, where video player is trying to access video from assets/VideoPlayback folder. // mMovieName[STONES] = "VideoPlayback/VuforiaSizzleReel_1.mp4"; P.S. -I commented only this line because I was using only STONES.jpg target image for Vuforia rendering. If you are using CHIPS, you can comment that line instead.

http://stackoverflow.com/comment/36743775
score: 1
comment on: http://stackoverflow.com/a/23871184
has text: For some reason I've never connected the toString() hash and my _own_ implementation of hashCode(). >< I'll accept your answer as soon as SO will let me.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23807297
type: Question
has comment: http://stackoverflow.com/comment/36621741
accepted answer: http://stackoverflow.com/a/23809018
has title: Java 2D array storing many different types of data
has comment: http://stackoverflow.com/comment/36621795
tagged with: 2d
score: 0
tagged with: java
answer count: 3
has body: This is my first Stack question.. so any help is appreciated(about posting style or given problem) So.. I'm not really "new" in Java, but there are things that I don't know about it. I have a question about how to store following: "Which of these is a fruit", "Orange", "Brick", "Tiger", "(and some kind of indication of right answer)". Bear in mind that there would be no more than 20 of theses kind of records, so i would put them in by hand statically not dynamically I was thinking about using a 2d array, but how and will it work. My tutor also said that 2d arrays would be the best way to go ( i think he is expecting a 2d array even if there is a better way)... He also said that it MUST be as simple as possible so any fancy ways of Java must be hold off. I could manage the 2d array part.. but how do i indicate the right answer? Some kind of Boolean with true or false? The part about collecting answers from the user and checking is not that big of problem for me. I would like your suggestions on how to deal with this task. Thank you! p.s. it MUST be something that applet could handle EDIT: ok guys .. i went whit 2d array here is code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; public class Quiz_applet extends JApplet implements ActionListener { static int rez = 0; static int c=0; static JTextField input = new JTextField(3); static String[][] data = {//q1 is in field data[0][0] {"q1", "A1", "A2", "A3", "A"}, {"q2", "A1", "A2", "A3", "B"}, {"q3", "A1", "A2", "A3", "C"}, {"q4", "A1", "A2", "A3", "B"}, {"q5", "A1", "A2", "A3", "C"}, {"q6", "A1", "A2", "A3", "A"}, {"q7", "A1", "A2", "A3", "A"}, {"q8", "A1", "A2", "A3", "B"}, {"q9", "A1", "A2", "A3", "C"}, {"q10", "A1", "A2", "A3", "A"}, {"q11", "A1", "A2", "A3", "A"} }; public void init() { ShapeCanvas canvas = new ShapeCanvas(); JButton Button = new JButton("Answer!"); Button…
has comment: http://stackoverflow.com/comment/36621636
has answer: http://stackoverflow.com/a/23807725
has answer: http://stackoverflow.com/a/23807489
tagged with: arrays
has comment: http://stackoverflow.com/comment/36621609
possible better answer: http://stackoverflow.com/a/23807489
has comment: http://stackoverflow.com/comment/36621717
tagged with: boolean
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23809018
has comment: http://stackoverflow.com/comment/36621663

http://stackoverflow.com/comment/36600391
has text: You need a `substring`. Many languages provide both `string.Substring()` as well as `string.IndexOf()` to get the character position of that occurrence.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23795757

http://stackoverflow.com/q/23838060
has body: I have been working on Java and I am wondering how could I restrict people from accessing my code? Is user-authorizing all classes (except driver) good enough? Or am I required to take further steps? Any help would be appreciated. Thank you.
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36680659
type: UnansweredQuestion
downvote count: 3
has comment: http://stackoverflow.com/comment/36680756
has comment: http://stackoverflow.com/comment/36680666
has title: How would I run my code without revealing it to the user?
tagged with: java
has comment: http://stackoverflow.com/comment/36680771
has comment: http://stackoverflow.com/comment/36680664
score: -3
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36680806
has comment: http://stackoverflow.com/comment/36680724
type: Question
has answer: http://stackoverflow.com/a/23838089

http://stackoverflow.com/comment/36582842
type: QuestionComment
has text: Do you getting some kind of error?Paste the logcat(if yes)
comment on: http://stackoverflow.com/q/23786428
score: 0
type: Comment

http://stackoverflow.com/comment/36732524
type: AnswerComment
type: Comment
has text: There is a pedagogical value in silently pointing people to the docs which they have to read before using stuff. The case in question is trivial and exactly described by the docs. There is no controversy, no misunderstanding, just laziness on OPs part. There is no excuse, IMO, in reinforcing the laziness by embracing those kind of questions with thorough answers.
comment on: http://stackoverflow.com/a/23864452
score: 10

http://stackoverflow.com/q/23917246
score: 8
favorite count: 0
downvote count: 0
has body: Question is how to get java 1.8 and maven-enunciate-plugin to work together ? With maven plugin org.codehaus.enunciate version 1.29 and OSX JDK 1.7.0_25 all is good. Enunciate depends on apt and I see this runtime warning in 1.7.0_25 [INFO] invoking enunciate:generate step... warning: The apt tool and its associated API are planned to be removed in the next major JDK release. These features have been superseded by javac and the standardized annotation processing API, javax.annotation.processing and javax.lang.model. Users are recommended to migrate to the annotation processing features of javac; see the javac man page for more information. When change to 1.8.0_05 build fails ... apt is indeed gone, hence runtime errors regarding com.sun.mirror.apt.AnnotationProcessorFactory not found. mvn install -pl myProject -e -X ... &lt;snip&gt; urls[46] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-xml/1.29/enunciate-xml-1.29.jar urls[47] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-java-client/1.29/enunciate-java-client-1.29.jar urls[48] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-c/1.29/enunciate-c-1.29.jar urls[49] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-obj-c/1.29/enunciate-obj-c-1.29.jar urls[50] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-csharp/1.29/enunciate-csharp-1.29.jar urls[51] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-ruby/1.29/enunciate-ruby-1.29.jar urls[52] = file:/Users/k1/.m2/repository/org/codehaus/enunciate/enunciate-php/1.29/enunciate-php-1.29.jar Number of foreign imports: 1 import: Entry[import from realm ClassRealm[maven.api, parent: null]] ----------------------------------------------------- at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:165) ... 20 more Caused by: java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory at org.codehaus.enunciate.DocsMojo.…
tagged with: annotations
tagged with: maven
tagged with: apt
has answer: http://stackoverflow.com/a/23922710
accepted answer: http://stackoverflow.com/a/23922710
type: AnsweredQuestion
has title: maven-enunciate-plugin on java 1.8 as apt now removed from latest JDK (i.e. java annotation processing tool)
tagged with: java
upvote count: 8
type: Question
tagged with: enunciate
answer count: 1
has comment: http://stackoverflow.com/comment/36842049
has comment: http://stackoverflow.com/comment/36842303

http://stackoverflow.com/a/23931007
type: Answer
score: 3
downvote count: 0
has body: Add following dependency to your pom.xml: com.day.commons day.commons.datasource.poolservice 1.0.10 provided In general, if you wonder which bundle contains a class, open the Felix Console, choose Main / Packages (relative path: /system/console/depfinder) and enter the full class name (like com.day.commons.datasource.poolservice.DataSourcePool). You'll get a that you can copy & paste to your pom.xml.
upvote count: 3
has comment: http://stackoverflow.com/comment/36862649
has comment: http://stackoverflow.com/comment/36860961
has comment: http://stackoverflow.com/comment/36863043
answers question: http://stackoverflow.com/q/23930526

http://stackoverflow.com/a/23864280
type: Answer
has body: I am not aware of any other installer maker for Windows that can run on Mac OS. What you could do is to setup a VM for Windows that runs on your Mac OS, and in that VM use a tool like Advanced Installer. It has a tutorial that shows you how to build such an installer: http://www.advancedinstaller.com/user-guide/tutorial-java.html
accepted answer of: http://stackoverflow.com/q/23812912
answers question: http://stackoverflow.com/q/23812912
score: 1
has comment: http://stackoverflow.com/comment/36778915
has comment: http://stackoverflow.com/comment/57486450
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23829340
upvote count: 2
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36665140
has body: I'm using the standard Oracle JDBC Driver (JDK6 Thin Driver) and attempting to call a method on PreparedStatement via Reflection. I can call the method directly, but when I attempt to call (what I believe is) the same method via Reflection, I get an IllegalAccessException indicating that the method I'm attempting to call does not have public access. Checking the Method object returned by the class, it shows it is a publci method (i.e. Modifier=1). The same test using other JDBC Drivers (IBM's DB2, Microsoft's SQLServer, PostgreSQL etc.) all work as expected. As this code is ultimately used in a JEE app in a Glassfish container, I'm using DataSource rather than a simple connection. Here's a snippet from a short test program (sensitive items removed) that illustrates the problem:- System.out.println("Creating DataSource"); DataSource ds = new OracleDataSource(); ((OracleDataSource) ds).setUser("HINT"); ((OracleDataSource) ds).setPassword("hint"); ((OracleDataSource) ds).setURL("jdbc:oracle:thin:@server-name:1521:database-name"); Connection dbCon = ds.getConnection(); dbCon.setAutoCommit(true); System.out.println("Connection obtained : " + dbCon.getClientInfo()); PreparedStatement pstmt = (OraclePreparedStatement)dbCon.prepareStatement("SELECT * FROM \"HINT\".\"COUNTRIES1\" WHERE \"COUNTRY_ID\" = ?"); if (useReflection) // True=Fails, False=Works! { Class clazz = pstmt.getClass(); Method method = clazz.getMethod("setString", new Class[]{int.class, String.class}); System.out.println("Modifiers=" + method.getModifiers()); System.out.println(method.toGenericString()); String value = "EG"; Object[] pstmtParams = new Object[]{new Integer(1), value}; method.invoke(pstmt, pstmtParams); // &lt;&lt;&lt; Fails here } else { pstmt.setString(1, "EG"); } And here's the output when useReflection is set TRUE:- Creating DataSource Connection obtained : {} Modifiers=1 public void oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(int,java.lang.String) throws java.sql.SQLExcept…
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36664078
has comment: http://stackoverflow.com/comment/36663874
score: 2
tagged with: reflection
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23829658
has comment: http://stackoverflow.com/comment/36663644
has comment: http://stackoverflow.com/comment/36663811
has comment: http://stackoverflow.com/comment/36663970
answer count: 1
downvote count: 0
has title: Oracle JDBC PreparedStatement method call via Reflection fails
favorite count: 0

http://stackoverflow.com/q/23815320
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23815512
accepted answer: http://stackoverflow.com/a/23815421
tagged with: java
has answer: http://stackoverflow.com/a/23815512
downvote count: 3
has comment: http://stackoverflow.com/comment/36637756
type: Question
has body: I want to get the percentage difference between two times. I have two values one is considered to be the device I am testing and the other is considered my reference. I want to make sure that I am a certain percentage better than the reference, but the smaller the number the better. Here is what I am doing: difPercent = ((dRefDif - dDutDif)/dRefDif) * 100; So when the device under test is 34.695 seconds and the reference is 3.183 seconds this equation gives me -990%....is this correct? Or do I have something mixed up? It should be a negative number, I was just surprised at the percentage difference. Idk, maybe I am confusing myself. I thought this was corrct.
tagged with: math
score: -3
has title: Get percentage differnce between two times java
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23815421
favorite count: 0
tagged with: time
has comment: http://stackoverflow.com/comment/36637505

http://stackoverflow.com/a/23813547
answers question: http://stackoverflow.com/q/23812574
type: Answer
has body: Your spinner is in the fragment layout and not in the activity layout you inflate in onCreate(). That's why it's not found. You should be accessing fragment views in its onCreateView() at earliest. You also seem to have deleted the PlaceholderFragment fragment transaction generated by the code template that would make the fragment to get eventually instantiated. Restore the fragment transaction in onCreate(). Move the findViewById() etc. code to the fragment's onCreateView(). See NullPointerException accessing views in onCreate() for more.
score: 0

http://stackoverflow.com/a/23870815
has body: Solved this problem by deleting this line: provider.addDataDisplay(treeViewer); // not applicable for the arguments (CellTree) and instantiating ListDataProvider before the CellTree.
answers question: http://stackoverflow.com/q/23832614
accepted answer of: http://stackoverflow.com/q/23832614
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36627402
comment on: http://stackoverflow.com/a/23808858
type: AnswerComment
score: 0
has text: @burnaut: Implement a constructor on your `AsyncTask` that takes in a `ContentResolver` and holds onto it in a data member. Then, use that `ContentResolver`.
type: Comment

http://stackoverflow.com/a/23813372
has comment: http://stackoverflow.com/comment/36633682
answers question: http://stackoverflow.com/q/23813174
type: Answer
has comment: http://stackoverflow.com/comment/36633715
upvote count: 1
downvote count: 1
type: AcceptedAnswer
score: 0
has body: I would make sure that none of the logic is in the controller. The controller should only get a request, call another method (which is in the service layer - a lower layer than the API layer) and return the data in the suitable format. So for example: public class MyServiceLayer() { public List&lt;SomeObject&gt; getAllSomeObjects() { // Do some logic to get the object back } } And then you can have a controller like this: @Controller public class MyController { @Autowired private MyServiceLayer myService; // Put annotation for getting it in Json public List&lt;SomeObject&gt; getAllSomeObjectsInJson() { return myService.getAllSomeObjects(); } // Put annotation for getting the view data public ModelAndView getAllSomeObjectsView() { // Return your ModelAndView here. } } In that case you can also split it to 2 controllers if you'd prefer it this way. Anyway you should not have 2 controllers with duplicated code - that's bad! And you shouldn't be enforced to combine 2 different controllers into one. That's why you should take the logic out to a different, packed, layer. Also this way you follow the "do one thing principle" which says that a class should have one purpose. In that case MyServiceLayer has one purpose - to handle the logic of getting the objects. The controller layer has one purpose - communicate the data (in which ever format you want). If tomorrow you want to add, for example, a JMX API you won't have to duplicate your code or extend the original controller. Just add another class for handling JMX calls and uses MyServiceLayer
accepted answer of: http://stackoverflow.com/q/23813174

http://stackoverflow.com/comment/36663845
comment on: http://stackoverflow.com/a/23829458
type: Comment
has text: Please reformulate the question, it clearly specifies "Which is the package from Java where I can use math functions?". The Math class provides math functions, therefore my answer solves his problem.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37018879
comment on: http://stackoverflow.com/q/23885880
score: 0
type: QuestionComment
type: Comment
has text: Yes I tried the apply, and it kind of give me back what I want. But it generates a GetByteArrayElements in the cxx file that makes my app crash.

http://stackoverflow.com/q/23926833
score: 0
tagged with: android
has body: In android app i am trying to submit a form having radio button, check box and edit text fields. after submitting the form, it sends the data to j son and then it suppose to have the previous layout.i have used "setVisibility(View.GONE)" for hiding data. now my question is how to get the blank form again so that i can make entry in form without going backward.
possible better answer: http://stackoverflow.com/a/23926907
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36849911
has title: how to get visibility back with setVisibility
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23926860
accepted answer: http://stackoverflow.com/a/23926860
has answer: http://stackoverflow.com/a/23926907

http://stackoverflow.com/a/23901915
downvote count: 0
upvote count: 3
has body: Don't shadow the "frame" variable. You have the variable defined as an instance variable, which is null and then you define it again as a local variable. Get rid of the local variable: //JFrame frame = new JFrame ("JFrame"); //the pictures frame = new JFrame ("JFrame"); //the pictures Also, the whole structure of you class is wrong. You should NOT be using static variables and methods. This is the sign of a poorly designed class.
answers question: http://stackoverflow.com/q/23901889
type: Answer
score: 3

http://stackoverflow.com/q/23863343
has title: How to use external JAR file in JasperSoft Studio
has answer: http://stackoverflow.com/a/23863422
type: UnansweredQuestion
has body: I have project in iReport, I want to build this in jasper studio,in that I use some external jar file to convert date, but in jasper studio I cant use them, I add those jar file in right click on project folder > properties > java build path > libraries > add External JARs.., I get error when I want to see report preview : net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. com.ghasemkiani.util.icu.PersianDateFormat cannot be resolved to a type value = new com.ghasemkiani.util.icu.PersianDateFormat("yyyy/MM/dd").format(((java.sql.Timestamp)field_ORDERDATE.getValue())); //$JR_EXPR_ID=9$ <----------------------------------------> 2. com.ghasemkiani.util.icu.PersianDateFormat cannot be resolved to a type value = new com.ghasemkiani.util.icu.PersianDateFormat("yyyy/MM/dd").format(((java.sql.Timestamp)field_ORDERDATE.getOldValue())); //$JR_EXPR_ID=9$ <----------------------------------------> so,my question is : how can I add external jar file and use it?
has answer: http://stackoverflow.com/a/26363677
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26418810
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/36729839
downvote count: 0
has comment: http://stackoverflow.com/comment/36729544
answer count: 4
has comment: http://stackoverflow.com/comment/36729725
favorite count: 0
has answer: http://stackoverflow.com/a/44332196

http://stackoverflow.com/q/23925673
favorite count: 0
has body: I'm trying to use RoboSpice + Retrofit + Jackson in an app. When I open an activity, I want to check if a resource is already cached, and if it is, simply update the view, otherwise, make a new request and wait for the answer. All of this is working ok, but I noticed that the getFromCache() method takes a lot of time. I implemented the cache with a LRUCache (by decorating the default Retrofit persister), as follows: @Override public &lt;T&gt; ObjectPersister&lt;T&gt; createObjectPersister(Class&lt;T&gt; clazz) throws CacheCreationException { try { return new LruCacheObjectPersister&lt;T&gt;(new RetrofitObjectPersister&lt;T&gt;(getApplication(), converter, clazz), new LruCache&lt;Object, CacheItem&lt;T&gt;&gt;(20)); // TODO: Set a max size } catch (CacheCreationException e) { throw new RuntimeException("Could not create cache for class '" + clazz.getName() + "'", e); } } As I said, the caches are working ok, I debugged everything and the LRUCache is being used as expected, as well as the RetrofitObjectPersister which in fact is a disk cache. That being said, my question is: Is it normal that the getFromCache() method takes a noticeable time even if the object is in the memory cache? I understand that it should be noticeable for objects that are retrieved from the disk cache, but I cannot understand why it takes that long to get the object from memory? Does it have to do with the RoboSpice's service architecture, perhaps? Any help would be much appreciated. Thank you very much, mato
type: UnansweredQuestion
tagged with: android
upvote count: 1
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24124608
tagged with: robospice
has title: Does RoboSpice's getFromCache() take that long?

http://stackoverflow.com/comment/36586084
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23788278
has text: this is not valid : private T[] child = (T[]) new Object[MagicN];
score: 0

http://stackoverflow.com/a/23818403
type: Answer
has comment: http://stackoverflow.com/comment/36643853
has comment: http://stackoverflow.com/comment/36643833
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36643604
answers question: http://stackoverflow.com/q/23818199
has comment: http://stackoverflow.com/comment/36643886
upvote count: 2
has body: As this is clearly homework, I will give you text only. Your approach may work eventually, but it is laborious and overly complicated, so it's hard to debug and hard to get right. make use of String's API by using the split() method after splitting the sentence into an array of word Strings, return the element at num less one (array are indexed starting at zero check the length of the array first, in case there are less words than num, and take whatever action you think is appropriate in that case For part 2, a solution in a simple form may be: create a new blank string for the result iterate over the characters of the given string adding the character to the front of the result string make use of String's toUpperCase() method

http://stackoverflow.com/comment/36629575
comment on: http://stackoverflow.com/a/23811221
has text: Fixed String test, working on int test...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36713409
type: Comment
comment on: http://stackoverflow.com/a/23854976
has text: It looks good. Numer of elements will not be large, so O(n) is satisfactory.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36991169
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24000453
has text: Sounds like a lot of effort! Thank you very much! For that you're going to get the full bounty!

http://stackoverflow.com/comment/36870561
score: 0
type: Comment
has text: `Will post code if needed.` You should definitely do this.
comment on: http://stackoverflow.com/q/23936701
type: QuestionComment

http://stackoverflow.com/comment/36659839
type: QuestionComment
comment on: http://stackoverflow.com/q/23827251
has text: myClass.temp is not a method call.
score: 0
type: Comment

http://stackoverflow.com/q/23859666
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23859752
has comment: http://stackoverflow.com/comment/36723128
tagged with: android
tagged with: android-activity
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23859752
tagged with: sharedpreferences
has title: How to transfer String from Fragment to Activity in Android
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23859801
accepted answer: http://stackoverflow.com/a/23859801
has body: I'm trying to accomplish the transfer of a string value from a Fragment to an Activity below. The result of the transfer says that the value is empty when transferred to the activity. Please let me know if you need more information. Fragment: //put selected chapter title in memory String selectedChapter = chapters[position]; SharedPreferences pref = getActivity().getPreferences(0); SharedPreferences.Editor edt = pref.edit(); edt.putString("selectedChapter", selectedChapter); edt.commit(); //launch activity Intent intent = new Intent(getActivity(), ChapterDetailActivity.class); startActivity(intent); Activity: //retrieve selected chapter filename from previous view SharedPreferences pref = ChapterDetailActivity.this.getPreferences(0); String filename = pref.getString("selectedChapter", "empty"); Log.e("File: ", filename);

http://stackoverflow.com/a/24710836
has body: Found out myself now. I used the class Scroller, with it you can fling or drag the View around. And you can easily use two dimensional scrolling with updating the scroll in on Draw when scroller.computeScrollOffsets() return true. the fling gesture can be detected with a GestureDetector.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23816608
type: Answer
answers question: http://stackoverflow.com/q/23816608
score: 0

http://stackoverflow.com/q/23797751
type: Question
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/109647244
answer count: 2
tagged with: websocket
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25898079
score: 5
has answer: http://stackoverflow.com/a/23797831
has title: Java websocket server giving 404
has body: I'm trying to build a java websocket server. I've written a simple server endpoint: @ServerEndpoint(value = "/test") public class EndPoint { static Queue<Session> queue = new ConcurrentLinkedQueue<Session>(); public static void send(int a, int b) { try { for(Session session : queue) { session.getBasicRemote().sendText("a = " + a + ",b=" + b); } } catch (IOException e) { System.out.println(e.getMessage()); } } @OnOpen public void openConnection(Session session) { queue.add(session); } @OnClose public void closeConnection(Session session) { queue.remove(session); } @OnError public void error(Session session, Throwable t) { queue.remove(session); } } My web.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> When I hit ws://localhost:8080/websocket-1.0/test from Javascript, I get a 404 response. I'm using tomcat 8 to deploy this. What am I missing here?
tagged with: java

http://stackoverflow.com/a/23804249
score: 0
type: Answer
has body: You need to call getText to retrieve the text from your TextField: x.format("%s", url.getText())
answers question: http://stackoverflow.com/q/23803762

http://stackoverflow.com/comment/52377413
type: Comment
has text: It was a long ago, and now I had no acces to this code, but if I am right and my memory is good then the **SSLContext.class** was one or the only one class which should be ignored! (but this problem is more common I think, I mean you can ignore a lot of java.* class). Please confirm if I am right and problem is solved;)!
comment on: http://stackoverflow.com/a/23949223
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36601938
score: 2
has text: I think you'd find it more educational if you went through with a debugger and figured out where the code stops working as you expected...
comment on: http://stackoverflow.com/q/23796496
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36771699
type: Comment
comment on: http://stackoverflow.com/q/23884268
score: 0
type: QuestionComment
has text: This is not an exception, this is only a warning. It may be very possible that the thread it warns about still is working on something and will complete later.

http://stackoverflow.com/comment/36981779
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23850892
type: Comment
has text: The question was: Will Twilio Trial Account send an actual message? Answer: Yes.

http://stackoverflow.com/q/23840065
tagged with: java
has answer: http://stackoverflow.com/a/23840149
type: Question
has body: I am trying to get a file to read into an Arraylist, then take the numbers read from the file and calculate the average. I am having trouble getting it to read the file and I am opening with a JFileChooser. I have spent three days trying to get this to work. I have seen some similar questions on here but none using a JFileChooser. Here is my code for the JFileChooser. I know how to calculate the average, but I just need to read the numbers in the file. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.JOptionPane; public class Week07 { static JFileChooser fileChooser = new JFileChooser(); public static void main(String[] args) throws IOException { String theFile; theFile = getTheFileName(); double theAverage; theAverage = getTheAverage(theFile); displayTheResult(theAverage,"The average is: "); } public static String getTheFileName() { String status; fileChooser.showOpenDialog(null); status = fileChooser.getSelectedFile().getAbsolutePath(); { return status; } } private static double getTheAverage(String theFile) throws NumberFormatException, IOException{ String fileName = getTheFileName(); FileReader fr = new FileReader(theFile); BufferedReader br = new BufferedReader(fr); so here is what i have, but now i cant get it to display the average. import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.swing.JFileChooser; import javax.swing.JOptionPane; public class Week07 { static JFileChooser chooser = new JFileChooser(); public static void main(String[] args) throws IOException { String theFile; theFile = getTheFileName(); double theAverage; //theAverage = getTheAverage(theFile); //displayTheResult(theAverage,"The average is: "); } public static String getTheFileName() { String status; chooser.showOpenDialog(null); status = chooser.getSelectedFile().getAbsolutePath(); { …
answer count: 2
has answer: http://stackoverflow.com/a/23840397
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/36684833
has comment: http://stackoverflow.com/comment/36684792
has comment: http://stackoverflow.com/comment/36684787
favorite count: 0
tagged with: file-handling
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36684829
has title: How do I get a file to read into an Arraylist, when the file is opened through a filechooser

http://stackoverflow.com/a/23855529
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36730834
has body: Is this what you want to do here It can be achieved by basic JQuery, CSS, js. Explorer some. if you have to validate it from data base and than show use &lt;f:ajax /&gt; this is whole work do some effort
has comment: http://stackoverflow.com/comment/36729735
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23855362
has comment: http://stackoverflow.com/comment/36729221
type: Answer
has comment: http://stackoverflow.com/comment/36740229
accepted answer of: http://stackoverflow.com/q/23855362

http://stackoverflow.com/comment/36660318
comment on: http://stackoverflow.com/q/23827474
score: 2
has text: Please, Try to follow the Java conventions: variable and attribute names should start by lowcase, I needed a while to realize that FilecheckBox wasn't a class.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23866773
has title: System.out to Unix line endings on Windows
tagged with: newline
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/23866924
favorite count: 0
has comment: http://stackoverflow.com/comment/36736386
has answer: http://stackoverflow.com/a/23866924
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36749383
type: Question
has body: In Java, newly created output streams look at the system line separator property to decide between Unix and Windows line endings, but System.out has already been created by the time your program starts, so altering that property has no effect on that stream. If you want System.out to use Unix line endings, despite running on Windows, is there a way to do this other than eschewing println() and always using print("...\n")?
type: AnsweredQuestion

http://stackoverflow.com/q/23895087
favorite count: 0
has body: I am looking for some kind of refactoring feature in Eclipse to generate methods in implementation classes from an interface class. Let's say I have JavaClassImpl1 and JavaClassImpl2, which implement JavaClassInterface. What I'd like to do is when I add a method to JavaClassInterface, the refactoring option is to generate empty methods in all implementation classes, in this case, in JavaClassImpl1 and JavaClassImpl2.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23895600
has title: How to generate interface's methods into all implementation classes?
tagged with: refactoring
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
score: 0
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23780147
has body: I have two maven projects: project (A) and another project (B) that is a dependency of A. B contains a properties file that I wish to access in one of A's controllers. Is there a way to add B's properties file to A's classpath so that I can inject it into A's controller? There is a similar question but I'm not sure if the scope of my question is covered by it. UPDATE: Using the @Value annotation in A's controller, the project returns a 500 error code and a FileNotFoundException.
has title: Add properties file from a project dependency to project classpath
has comment: http://stackoverflow.com/comment/36571044
linked to: http://stackoverflow.com/q/2468756
answer count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/36571114
tagged with: java
has comment: http://stackoverflow.com/comment/36570987
tagged with: eclipse
score: 0

http://stackoverflow.com/q/23865950
has comment: http://stackoverflow.com/comment/36736628
tagged with: java
upvote count: 4
has title: Java: get actual type of generic method with lambda parameter
has comment: http://stackoverflow.com/comment/43182341
has comment: http://stackoverflow.com/comment/43184393
has comment: http://stackoverflow.com/comment/43181292
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23866258
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43181910
has comment: http://stackoverflow.com/comment/36734090
linked to: http://stackoverflow.com/q/23863716
has comment: http://stackoverflow.com/comment/36734566
has body: I asked some question about lambdas here Java: how to resolve generic type of lambda parameter?, but this one is a bit different. I have the method signature: public &lt;P&gt; void handle(Consumer&lt;P&gt; consumer) { ... } I can use it with lambda: .&lt;Integer&gt;handle(p -&gt; System.out.println(p * 2)); Can I somehow resolve that actual generic type? I mean I want to get Integer.class within that handle method. BTW I can resolve the issue like this: public &lt;P&gt; void handle(Class&lt;P&gt; pClass, Consumer&lt;P&gt; consumer) {...} .handle(Integer.class, p -&gt; System.out.println(p * 2)); But it doesn't look kosher, if we change the lambda to inline implementation.
tagged with: lambda
tagged with: generics
duplicate of: http://stackoverflow.com/q/23863716
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23866258
has comment: http://stackoverflow.com/comment/43185501
type: Question

http://stackoverflow.com/comment/36758377
comment on: http://stackoverflow.com/q/23878406
score: 0
has text: @djechlin done: http://stackoverflow.com/a/23878740/2187042
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36663769
has text: cpu is much faster :)
score: 1
comment on: http://stackoverflow.com/q/23828946
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23818327
upvote count: 1
has comment: http://stackoverflow.com/comment/36651797
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23818157
has body: You forgot to access the cursor correctly. Change your getEntityFromCursor() to: private static PostEntity getEntityFromCursor(final Cursor cursor) { PostEntity entity = null; if( cursor != null &amp;&amp; cursor.moveToFirst() ) { entity = new PostEntity( cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4) ); } return entity; }

http://stackoverflow.com/q/23861301
type: Question
has answer: http://stackoverflow.com/a/23861310
has body: I made an app that reads values off of the proximity sensor and performs certain actions based off of that data. My problem is that the actions will continue to perform even when the user presses the home button and leaves the app, thus causing a drainage in the battery. My question is how do I turn off the proximity sensor once the app is existed or simple when the home button is pressed (without the app being exited properly) This is my first Android app. Here is how I assign the proximity sensor in my code: sm = (SensorManager) getSystemService(SENSOR_SERVICE); proxSensor = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY); sm.registerListener(this,proxSensor,SensorManager.SENSOR_DELAY_NORMAL); Thanks EDIT To those that are wondering and don't want to look it up, I solved it by using the following: public void onPause() { super.onPause(); sm.unregisterListener(this); } public void onResume() { super.onResume(); sm.registerListener(this,proxSensor,SensorManager.SENSOR_DELAY_NORMAL); }
score: 0
answer count: 2
tagged with: android-sensors
tagged with: proximitysensor
has title: Turn off proximity sensor after closing app - Android
possible better answer: http://stackoverflow.com/a/23861310
tagged with: android
tagged with: auto-close
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23861387
accepted answer: http://stackoverflow.com/a/23861387

http://stackoverflow.com/comment/99157709
score: 0
comment on: http://stackoverflow.com/a/35553778
type: AnswerComment
has text: use `import android.util.TimingLogger;` if TimingLogger was not found.
type: Comment

http://stackoverflow.com/a/23919108
accepted answer of: http://stackoverflow.com/q/23918901
score: 0
answers question: http://stackoverflow.com/q/23918901
type: AcceptedAnswer
type: Answer
has body: else if(pass[i]+pass[i+1]&lt;=4) line is your killer definitely. the reason is you are using for loop with i &lt; groups for(int i=0; i&lt;groups; i++) so i+1 goes to equals to groups for the last iteration. say for example , it the groups size is 5 then for loop becomes for(int i=0;i&lt;5;i++) we can have group[0] ... groups[4] max and groups[5] causes array index out of bound exception. if we check for loop like above then when i goes to 4 then it satisfies for loop check as 4&lt;5 and enters for loop but there you are doing pass[i] -> ok but pass[i+1] will become like pass[5] which definitely causes array index out of bound exception so check for loop like below for(int i=0; i&lt;groups-1; i++) it will work now even for the last element.

performance
tags question: http://stackoverflow.com/q/23797816
tags question: http://stackoverflow.com/q/23839782
tags question: http://stackoverflow.com/q/23924574
tags question: http://stackoverflow.com/q/23850407
tags question: http://stackoverflow.com/q/23824364
tags question: http://stackoverflow.com/q/23823637
tags question: http://stackoverflow.com/q/23807830
tags question: http://stackoverflow.com/q/23791240
tags question: http://stackoverflow.com/q/23810778
tags question: http://stackoverflow.com/q/23940233
tags question: http://stackoverflow.com/q/23912460
tags question: http://stackoverflow.com/q/23869755
tags question: http://stackoverflow.com/q/23804764
tags question: http://stackoverflow.com/q/23811802
tags question: http://stackoverflow.com/q/23779064
tags question: http://stackoverflow.com/q/23931546
tags question: http://stackoverflow.com/q/23912035
tags question: http://stackoverflow.com/q/23922542
tags question: http://stackoverflow.com/q/23846611
tags question: http://stackoverflow.com/q/23867296
tag name: performance
tags question: http://stackoverflow.com/q/23848274
tags question: http://stackoverflow.com/q/23884914
tags question: http://stackoverflow.com/q/23839544
type: Tag
tags question: http://stackoverflow.com/q/23794213
tags question: http://stackoverflow.com/q/23823386
tags question: http://stackoverflow.com/q/23878647
tags question: http://stackoverflow.com/q/23911306
tags question: http://stackoverflow.com/q/23875462

http://stackoverflow.com/a/23867741
downvote count: 0
has comment: http://stackoverflow.com/comment/36737787
type: Answer
has comment: http://stackoverflow.com/comment/36737755
score: 1
has comment: http://stackoverflow.com/comment/36738105
upvote count: 1
has comment: http://stackoverflow.com/comment/36737717
answers question: http://stackoverflow.com/q/23867256
has comment: http://stackoverflow.com/comment/36737557
has body: The method void connecter() never gets called so the Statement objects are not getting initialized and they remain null. You should probably change the Statement object to a local variable and initialize it right before using it, then close the statement right after using it. You can do the same with the database connection: cn= DriverManager.getConnection("jdbc:mysql://localhost:3306/codezone4", "root",""); If you need faster performance, then the database connection could be opened when your application starts up (not by this class) and then closed when it shuts down. Or you can use a ConnectionPool. Another issue to consider: We are not allowed to pass special characters in a URL parameter without encoding them. For a list of what characters are allowed, see this question. Your test URL should be /AddToDataBase/myrest/user/add/test/test/test%40test.com/test/test

http://stackoverflow.com/q/23858142
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23858233
has comment: http://stackoverflow.com/comment/36719680
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36719595
has answer: http://stackoverflow.com/a/23858285
has comment: http://stackoverflow.com/comment/36719658
tagged with: jsp
has answer: http://stackoverflow.com/a/23858287
score: 0
has body: I've created a class named ServletUtils which has a method in it that replaces all HTML special characters and looks like this: import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class ServletUtils { public static String replaceHTMLSpecialChars(String str) { StringBuffer buffer = new StringBuffer(); char temp; for(int i = 0; i &lt; str.length(); i++) { temp = str.charAt(i); if(temp == '&lt;') { buffer.append("&amp;lt;"); } else if(temp == '&gt;') { buffer.append("&amp;gt;"); } else if(temp == '"') { buffer.append("&amp;quot;"); } else if(temp == '&amp;') { buffer.append("&amp;amp;"); } else { buffer.append(temp); } } return buffer.toString(); } public static String replaceHTMLSpecialCharsFromFile(String filepath) { StringBuffer buffer = new StringBuffer(); try { File file = new File(filepath); if(file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { buffer.append(line + "\n"); } br.close(); } else { System.out.println("File doesn't exist: " + filepath); } } catch(FileNotFoundException fnfe){fnfe.printStackTrace();} catch(IOException io){io.printStackTrace();} return replaceHTMLSpecialChars(buffer.toString()); } public static void main(String[] args) { System.out.println(ServletUtils.replaceHTMLSpecialCharsFromFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps\\jed_1.1\\jsp\\server_processing.jsp")); } } Testing it with the main method certainly works, but from a JSP page, when I call: &lt;textarea rows="25" cols="110" readonly="readonly"&gt; &lt;% String contextPath = request.getServletContext().getRealPath("/"); ServletUtils.replaceHTMLSpecialCharsFromFile(contextPath + "jsp\\server_processing.jsp"); %&gt; &lt;/textarea&gt; I get a blank textarea. I know the ServletUtils methods work. So why am I not able to load the textarea in the JSP page with the results? Please …
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has title: replacing HTML special characters in JSP

http://stackoverflow.com/comment/36613206
has text: SO is not a suitable resource for learning programming basics. You would be better talking to your teacher or reading a book.
comment on: http://stackoverflow.com/q/23783052
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23889989
has comment: http://stackoverflow.com/comment/36780542
has body: You need to have the CoordinateConversions class on your classpath. Either by obtaining the source and dropping it into your project (possibly adjusting package names, and only if the license allows), or by finding a JAR containing that class and adding it to your build path in your IDE. You probably need to download the Java files from here.
has comment: http://stackoverflow.com/comment/36782907
accepted answer of: http://stackoverflow.com/q/23889867
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23889867
score: 0
type: Answer

http://stackoverflow.com/a/33414419
downvote count: 0
answers question: http://stackoverflow.com/q/23824364
has body: For Java 8, you can simply use this: public static boolean isEmpty(final byte[] data){ return IntStream.range(0, data.length).parallel().allMatch(i -&gt; data[i] == 0); }
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/36768154
score: 0
type: AnswerComment
has text: maybe, but it wasn't specified in your answer. also when you do this approach, if the activity is already in the background, it will launch it (which may not be what you want) and instead of going through onNewIntent as I think you'd like to happen, it would go through the normal activity lifecycle.
type: Comment
comment on: http://stackoverflow.com/a/23879423

http://stackoverflow.com/a/23877475
upvote count: 1
has comment: http://stackoverflow.com/comment/126722194
type: Answer
downvote count: 0
score: 1
has body: A session and a transaction lifecycles are identical only for session-per-request, albeit the most used session management pattern. But Hibernate is flexible and it also supports long conversations, when a Session is reused across multiple web requests. This is similar to Java EE extended persistence context with statefull EJB. In a long conversation, the db connections are released when the client thread gets out if the service layer, and the session is not automatically flushed anymore. It's the last request that could run in a writable Transaction which would sync all state changes to the db.
answers question: http://stackoverflow.com/q/23874895
has comment: http://stackoverflow.com/comment/87226586
has comment: http://stackoverflow.com/comment/87230268

http://stackoverflow.com/comment/118878975
comment on: http://stackoverflow.com/a/23796119
type: AnswerComment
has text: @MadProgrammer yes you can, it is done all the time, it is called anti-aliasing.
score: 0
type: Comment

http://stackoverflow.com/comment/36673559
score: 0
comment on: http://stackoverflow.com/q/23834347
type: Comment
type: QuestionComment
has text: start with some statements for debugging (or step through with a proper debugger). Print out the command string first. If you copy paste the string does it work manually in cmd line? You are also calling `executeCommand` but not capturing the return string. What does that string consist of? How are you certain the program does not run? What is the expected behavior?

http://stackoverflow.com/q/23834385
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23834568
tagged with: buildpath
has title: Eclipse projects vs build path
possible better answer: http://stackoverflow.com/a/23834600
has answer: http://stackoverflow.com/a/23834600
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5467038
accepted answer: http://stackoverflow.com/a/23834568
tagged with: java
tagged with: eclipse
type: Question
has body: I am building a library which wraps some code around spymemcached client. This is called CacheClient. This is s simple Java project. I put the spymemcached.jar into its lib folder. Here is how it looks like, also you can see the build path settings: Library: CacheClient Project: cacheclient.jar lib spymemcached.jar Java Build Path / Libraries Tab: spymemcached.jar - CacheClient/lib/spymemcached.jar What I am doing is I am building a simple java web project which is using this library. WebApp: ServiceWebApp Project: servicewebapp.war WebContent WEB-INF lib EMPTY Java Build Path / Projects Tab: CacheClient So, my Webapp's build path is set to using the CacheClient project. I copied the cacheclient.jar into tomcat's lib directory and deployed the ServiceWebApp. When I run the web app, it fails as it says my CacheClient code is looking for the spymemcached classes (ClassNotFoundException). I could solve this by putting spymemcached.jar into tomcat's lib directory but it would be great if there will be an other solution. Any suggestion appreciated. Thanks,
tagged with: jar

http://stackoverflow.com/q/23798828
tagged with: robolectric
has title: How to mock/stub objects in robolectric tests?
type: Question
answer count: 1
tagged with: android-testing
downvote count: 0
has answer: http://stackoverflow.com/a/23832898
favorite count: 0
tagged with: android
has body: What's the preferred way to mock/stub objects in robolectric tests? My goal is to write Android code in TDD manner. Right now I am using interfaces and create mock classes that implement those interfaces in tests. This process is time consuming. Is there an easier way to stub a method of existing class in robolectric?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23832898

http://stackoverflow.com/a/23793769
answers question: http://stackoverflow.com/q/23792840
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23792840
score: 1
has body: change your code from to Style.xml style.xml file states what are the styles you want to use in your app, basically it inherits android default style as you can see in every style tag which ever property you want to set you give it a name and say what property of parent style you want to override, Parent style is the theme which you selected as default theme when you created app.

http://stackoverflow.com/a/23942298
accepted answer of: http://stackoverflow.com/q/23908021
has body: I don't have any idea about Android application but you can achieve it using Gson library easily. The JSON that is used in your post is not valid. It might be a typo. Please validate it here on JSONLint - The JSON Validator Simply use Gson#fromJson(String, Class) method to convert a JSON string into the object of passed class type. Remember the name of instance member must be exactly same (case-sensitive) as defined in JSON string as well. Read more about JSON Field Naming Use GsonBuilder#setPrettyPrinting() that configures Gson to output Json that fits in a page for pretty printing. Sample code: String json = "{\"id\": 5,\"data\": {}}"; MyEntity myEntity = new Gson().fromJson(json, MyEntity.class); String prettyJsonString = new GsonBuilder().setPrettyPrinting().create().toJson(myEntity); System.out.println(prettyJsonString); output: { "id": 5, "data": {} }
answers question: http://stackoverflow.com/q/23908021
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/36796093
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23898122
type: QuestionComment
has text: Are you not able to use a `Set`?

http://stackoverflow.com/a/23894192
type: Answer
has comment: http://stackoverflow.com/comment/36788410
answers question: http://stackoverflow.com/q/23891380
has body: So, I cleaned up the code. Noticed how I set each Students's attribute inside the constructor? This is very good practice for setting attributes of the objects. We needed import java.lang.Comparable; for public int compareTo(Students student){ return this.getLastName().compareTo(student.lastName); } and we needed import java.util.Comparator; for @Override public int compare(Students student1, Students student2){ return student1.getLastName().compareTo(student2.getLastName()); } import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.lang.Comparable; public class Students implements Comparable&lt;Students&gt;{ public List&lt;Students&gt; list = new ArrayList&lt;Students&gt;(); public String firstName; public String lastName; public Students(String firstName, String lastName){ this.firstName = firstName; this.lastName = lastName; } public void addStudent(String firstName, String lastName){ list.add(new Students(firstName,lastName)); Collections.sort(list); // this is fine though Collections.sort(list, new StudentComparator()); // this gives me an error } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } @Override /* Compare a given student lastName to the current Object * if greater than the current object, return -1 * if equals to the current object, return 0 * if less than the current object, return 1 * Here is Comparable below: */ public int compareTo(Students student){ return this.getLastName().compareTo(student.lastName); } } and we need import java.util.Comparator; for public class StudentComparator implements Comparator&lt;Students&gt;{ @Override public int compare(Students student1, Students student2){ return student1.getLastName().compareTo(student2.getLastName()); } } Hope that explains it.
score: 0

http://stackoverflow.com/comment/105014907
type: Comment
has text: Alternatively, annotate your class with [`@Keep`](https://developer.android.com/reference/kotlin/androidx/annotation/Keep) and proguard won't modify it.
comment on: http://stackoverflow.com/a/23826357
score: 1
type: AnswerComment

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/23840331
tags question: http://stackoverflow.com/q/23926065
tags question: http://stackoverflow.com/q/23886922
tag name: ksoap2

jdeveloper
tags question: http://stackoverflow.com/q/23896057
tags question: http://stackoverflow.com/q/23829623
tags question: http://stackoverflow.com/q/23907202
type: Tag
tag name: jdeveloper
tags question: http://stackoverflow.com/q/23807819

http://stackoverflow.com/comment/36801255
type: Comment
comment on: http://stackoverflow.com/q/23900494
has text: Does it somehow indicate when a request has been throttled? Or do you just have to guess?
score: 0
type: QuestionComment

http://stackoverflow.com/q/23883475
type: Question
duplicate of: http://stackoverflow.com/q/10467605
has body: In Java Swing, the JTextPane has word wrap when the text exceeds width, but it does NOT line break for when there's a very long non-space string. How can I make a JTextPane line break for a long non-space string? Any ideas would be much appreciated, thanks.
upvote count: 2
has title: How to make JTextPane line break
has comment: http://stackoverflow.com/comment/36767931
answer count: 1
has comment: http://stackoverflow.com/comment/36768028
favorite count: 0
has comment: http://stackoverflow.com/comment/36803604
has comment: http://stackoverflow.com/comment/36768062
has answer: http://stackoverflow.com/a/23903362
accepted answer: http://stackoverflow.com/a/23903362
tagged with: jtextpane
tagged with: swing
type: AnsweredQuestion
score: 2
tagged with: line-breaks
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36767553
has comment: http://stackoverflow.com/comment/36767575

http://stackoverflow.com/comment/36822113
type: Comment
comment on: http://stackoverflow.com/a/23911855
has text: <?xml version="1.0" encoding="utf-8"?> This class contains theme details. <generator class="native"/> <property name="theme" column="text" type="string"/> <property name="orderInfo" column="order_info" type="int"/>
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36872992
type: QuestionComment
comment on: http://stackoverflow.com/q/23939330
has text: how do you know it doesn't work without the System.out.println? as far as I can say, hasWon() always returns false. it's a weird construction anyway. it would be a bit clearer if you just: while(!hasWon()){} print // you won
score: 0
type: Comment

http://stackoverflow.com/comment/36618947
score: 2
comment on: http://stackoverflow.com/a/23805988
has text: You might also want to include the quote: _"If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns."_ from http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html#add(E)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36667265
comment on: http://stackoverflow.com/q/23831157
has text: No, that's what [trimToSize](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#trimToSize%28%29) is for.
type: Comment
type: QuestionComment
score: 7

http://stackoverflow.com/q/23802295
score: 0
has answer: http://stackoverflow.com/a/23809346
type: UnansweredQuestion
has title: Get error on sending JSON from JavaScript to Java
answer count: 4
has body: I want to send some data from JavaScript to Java servlet with help of JSON. But I have problem with it. This is my JavaSript code: var myData = {"someNumber":34,"someDate":"May 22, 2014 12:00:00 AM","expiryDate":"May 29, 2014 12:00:00 AM","anotherNumber":3,"customerNumber":56,"name":"John Dow","type":"notype","someSize":"XXL","noMonth":11,"notes":"some notes here","colour":"Black"}; $.ajax({ url : "customerAdd", type: "get", data: {"myData" : JSON.stringify(myData)}, contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { alert(msg); }, error: function(jqXHR, textStatus, errorThrown) { console.log("jqXHR: " + textStatus); console.log("textStatus: " + textStatus); console.log("errorThrown: " + errorThrown); } }); This is my Java code: public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{ Gson gson = new GsonBuilder().create(); Customer customer = gson.fromJson(request.getParameter("myData"), Customer.class); System.out.println(customer.toString()); } In result I get an error in JavaScript: "textStatus: parsererror" "errorThrown: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" What's wrong with my code? P.S. I create myData in JavaScript by this way: var myData = { someNumber: + $("#someNumber").val(), someDate: $("#someDate").val(), expiryDate: $("#expiryDate").val(), anotherNumber: + $("#anotherNumber").val(), customerNumber: + $("#customerNumber").val(), name: $("#name").val(), type: $("#type").val(), someSize: $("#someSize").val(), noMonth: + $("#noMonth").val(), notes: $("#notes").val(), colour: $("#colour").val() };
has answer: http://stackoverflow.com/a/23802436
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23802406
type: Question
has answer: http://stackoverflow.com/a/24474880
tagged with: javascript
tagged with: jquery
tagged with: servlets

http://stackoverflow.com/comment/36597365
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23794003
type: Comment
has text: I am working on a Netbeans Platform Application, which should be modular

http://stackoverflow.com/comment/36581134
comment on: http://stackoverflow.com/a/23785613
type: AnswerComment
has text: Sorry, I forgot two lines after this line. I have made an update to the question. I call stop and start after the first start call.
score: 0
type: Comment

http://stackoverflow.com/q/23861286
tagged with: android-intent
has answer: http://stackoverflow.com/a/23861357
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/23861357
has title: How can I know the intents needed to open system activities
possible better answer: http://stackoverflow.com/a/23861567
has answer: http://stackoverflow.com/a/23861567
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I have the need to open android's default screen settings, and previously I wanted to open android's default alarm configuration activity, in the future I'm thinking I would want to open GPS settings. How can I get the information needed to start this activities? Where can I found the documentation about this? What's the process for getting this information without googling for the specific activity?
type: Question
upvote count: 2
tagged with: android

http://stackoverflow.com/comment/36727494
has text: PFB exception obtained <error message="org/openqa/selenium/WebDriver" type="java.lang.NoClassDefFoundError">java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:186) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
score: 0
comment on: http://stackoverflow.com/q/23849692
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36642882
type: QuestionComment
has text: You should post the code here rather than in an image.
comment on: http://stackoverflow.com/q/23818199
score: 0
type: Comment

http://stackoverflow.com/q/23787793
type: UnansweredQuestion
has title: how to filter a list to remove the element with duplicated attribute in java?
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/122105
type: Question
duplicate of: http://stackoverflow.com/q/122105
has answer: http://stackoverflow.com/a/23787904
has comment: http://stackoverflow.com/comment/36585457
has body: I want to filter a list to remove the element with duplicated attribute, see code snippet below: public class People{ string name; string priority; //...getter setter } list&lt;People&gt; peopleList = //...get a list of people Here I want to show a list of people with unique name attribute , how to operate the peopleList ? and also if there are several People object with same name, i want to check the priority to decide which one should be in the final unique list. hope i am clear.
answer count: 1

http://stackoverflow.com/comment/36719151
type: QuestionComment
comment on: http://stackoverflow.com/q/23857938
has text: Please post an [MCVE](http://stackoverflow.com/help/mcve).
score: 0
type: Comment

http://stackoverflow.com/comment/36619652
type: Comment
type: QuestionComment
has text: Tim, I updated the post
comment on: http://stackoverflow.com/q/23805576
score: 0

http://stackoverflow.com/comment/36588586
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23789411
has text: yes it is exactly that
score: 0

http://stackoverflow.com/comment/36585981
score: 1
comment on: http://stackoverflow.com/q/23788278
has text: What? Your question is really unclear.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23834884
has answer: http://stackoverflow.com/a/23835137
has comment: http://stackoverflow.com/comment/36674560
tagged with: wait
has comment: http://stackoverflow.com/comment/36674878
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36676468
has comment: http://stackoverflow.com/comment/36675265
has comment: http://stackoverflow.com/comment/36675228
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36678307
tagged with: android
has title: How can I lock the wait and notify and sync them from different projects?
has comment: http://stackoverflow.com/comment/36674836
has comment: http://stackoverflow.com/comment/36676566
tagged with: java
has comment: http://stackoverflow.com/comment/36674681
has body: I'm writing an android app with java, using a server side written also in java. In my server side project I have a Client and a Group classes. Lets say there are 2 clients, so each device is a client, and they are in the same group. After some activity finished, I call a function through the Client (server side) which receive an integer. I want to check which of the clients has a bigger integer, so I check it in the group. The thing I want to do is to return to each device the result "winner" or "loser" according to their integer. I call a function from the group instance to calculate the winner. I want the clients to wait until the calculation is complete, and then send the result to the device (client side). How can I set the client to wait and get notified from the group singleton? Remember that there are 2 different clients, each client for a different device, so they run on different threads. This is what I written, and what happens is after the activity is finished and I call the function to calculate the winner, the loser gets notified (in the device) but the winner is in a wait state. Client: score = Integer.parseInt(json.getString("score") .toString()); mGroup.calcResult(); while (result == null) { lock.lock(); try { System.out.println("waiting"); groupReady.await(); } catch (InterruptedException e) { e.printStackTrace(); } finally { lock.unlock(); } } Group: public void calcResult() { finishedClients++; if (finishedClients == clients.size()) pCalcResult(); } private void pCalcResult() { finishedClients = 0; int minScore = clients.get(0).getScore(); int clientIndex = 0; for (int i = 0; i &lt; clients.size(); i++) { if (clients.get(i).getScore() &lt; minScore) { minScore = clients.get(i).getScore(); clientIndex = i; clients.get(i).setResult("winner"); } } clients.get(clientIndex).setResult("looser"); lock.lock(); try { groupReady.signalAll(); } finally { lock.unlock(); } } I think what is happening is that the winner result is null, so he enters the loop (cl…
type: Question
has comment: http://stackoverflow.com/comment/36675399

http://stackoverflow.com/comment/36735792
comment on: http://stackoverflow.com/q/23866888
type: QuestionComment
has text: `1/2^n` is unlikely to be an integer for `n > 0`.. Use `BigDecimal` instead.
score: 2
type: Comment

http://stackoverflow.com/comment/36857123
has text: Of course you can. And in the JSP, you'll use `${rules}` to access the rules list, and `${file}` to access the file path.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23929542

http://stackoverflow.com/comment/36748767
comment on: http://stackoverflow.com/q/23873878
has text: @KennethClark Good point, but no entry.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36624113
type: QuestionComment
comment on: http://stackoverflow.com/q/23808441
score: 0
has text: @MarkRotteveel Does that work with jTDS?
type: Comment

http://stackoverflow.com/comment/36818814
score: 2
has text: It depends on your JDBC provider if it is cached (and thus reused) or if a new one is created. Also I doubt that you want to cache the `PreparedStatement` because how are you going to execute it for the next connection? (Basically each transaction runs on its own connection).
comment on: http://stackoverflow.com/q/23910354
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23908610
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23907526
answers question: http://stackoverflow.com/q/23907526
type: AcceptedAnswer
downvote count: 0
has body: You do need to add sb to the pageContext, request, session or context scope to be able to access it through an EL expression - it will not pick up variables declared only in scriptlets. Modify as follows so that that sb is always put into the pageContext: if (request.getAttribute("Flavour") != null) { String[] flavours = (String[]) request.getAttribute("Flavour"); for (String flavour : flavours) { sb.append(flavour); sb.append("&amp;"); } sb.trimToSize(); } pageContext.setAttribute("sb", sb); I have also suggested a change to improve the clarity of your code when assigning the array of 'flavour' String values.
type: Answer

http://stackoverflow.com/comment/36632233
comment on: http://stackoverflow.com/q/23812764
type: Comment
has text: `double` has a limited size, 64-bit, this means you can only pack so much information into it. If you use BigDecimal, it can be almost any size which is why it doesn't lose precision.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/119231570
type: AnswerComment
type: Comment
has text: `*ManualTest.java` will still trigger Surefire's "look for tests in this file" mechanism, so one should use a different naming convention.
comment on: http://stackoverflow.com/a/23915022
score: 0

http://stackoverflow.com/comment/36760224
type: AnswerComment
type: Comment
has text: @user3615120 Also if this answer is helping you you should consider accepting it.
comment on: http://stackoverflow.com/a/23879457
score: 0

http://stackoverflow.com/a/25865933
score: 0
type: Answer
has body: If all you want to do is visualise the graph, you may wish to look at the Neo4j section of No SQL Unit
answers question: http://stackoverflow.com/q/23828600

http://stackoverflow.com/comment/36679003
type: Comment
has text: if you know the size of the added arraylist, it would be nice the define the size of the arraylist : `new ArrayList(size)`
score: 0
comment on: http://stackoverflow.com/a/23837232
type: AnswerComment

gradle
tags question: http://stackoverflow.com/q/23828085
tags question: http://stackoverflow.com/q/23845161
tags question: http://stackoverflow.com/q/23827607
tags question: http://stackoverflow.com/q/23892020
tags question: http://stackoverflow.com/q/23875038
tags question: http://stackoverflow.com/q/23880461
tags question: http://stackoverflow.com/q/23783593
tags question: http://stackoverflow.com/q/23862504
type: Tag
tags question: http://stackoverflow.com/q/23862174
tags question: http://stackoverflow.com/q/23787622
tags question: http://stackoverflow.com/q/23936420
tags question: http://stackoverflow.com/q/23901369
tags question: http://stackoverflow.com/q/23883028
tags question: http://stackoverflow.com/q/23886148
tag name: gradle
tags question: http://stackoverflow.com/q/23905439
tags question: http://stackoverflow.com/q/23847482
tags question: http://stackoverflow.com/q/23838362
tags question: http://stackoverflow.com/q/23817034
tags question: http://stackoverflow.com/q/23891537
tags question: http://stackoverflow.com/q/23796404
tags question: http://stackoverflow.com/q/23938043
tags question: http://stackoverflow.com/q/23905366
tags question: http://stackoverflow.com/q/23855038
tags question: http://stackoverflow.com/q/23824844
tags question: http://stackoverflow.com/q/23841307
tags question: http://stackoverflow.com/q/23901666
tags question: http://stackoverflow.com/q/23902245
tags question: http://stackoverflow.com/q/23808711
tags question: http://stackoverflow.com/q/23869378
tags question: http://stackoverflow.com/q/23823163
tags question: http://stackoverflow.com/q/23814439

http://stackoverflow.com/comment/36841931
type: AnswerComment
has text: No, I don't understand couple of things. Firstly, what is freqTable? Second, where do you set the button passed by the parameter? You have a StackPane but you don't attach it to anything. And you never assign a new value to addButton.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23887095

http://stackoverflow.com/comment/36811245
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23906099
type: Comment
has text: Hi, and how is the reviewing done later? The users of this application hava no knowledge in computer science. They want to be able to review the data of their application (which we are developing) in a simple way. We on the other hand want to implement functionality for using this data if for example a new client subscribes to the server

http://stackoverflow.com/comment/36627750
comment on: http://stackoverflow.com/q/23794900
type: QuestionComment
has text: @Gunnar you are indeed correct. I did a simple test case and it worked as you said. It is now working in the more complex use case as well. Go ahead and write an answer so I can mark this mystery as solved.
type: Comment
score: 0

http://stackoverflow.com/comment/36627177
has text: Think so. I have the two tables above in the code thats everything I have to do with the ScrollPane
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23809849

http://stackoverflow.com/a/23891388
has comment: http://stackoverflow.com/comment/36783672
has comment: http://stackoverflow.com/comment/36783198
has body: Yes, you can make an applet out of it. You need to develop a custom GUI with Swing/AWT, but extend an Applet class. Next, write you HTML page with embedded tags (browse info here): http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/applet/applet_deployment.html deploy. In order to create an applet, you can use your existing code with minimum changes. As for the controlling files from your applet, it is definitely possible, but beware security issues. You will need to read some tutorial on those.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23891252
has comment: http://stackoverflow.com/comment/36783156
answers question: http://stackoverflow.com/q/23891252
has comment: http://stackoverflow.com/comment/36782855
type: Answer
has comment: http://stackoverflow.com/comment/36783173

http://stackoverflow.com/q/23865020
downvote count: 0
score: 1
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/36733513
has title: Unable to identify the element
tagged with: webdriver
has answer: http://stackoverflow.com/a/23865584
type: Question
upvote count: 1
answer count: 1
has body: I can able to identify the element upto - span id="trayCover_page0ivu0" After that i 'm not able to identify pls help. I have to click the below line. Please let me know any thing is executed to hide the element in - pageSupport._setHtmlbIds("page0ivu0","Tray4b6ce4ad… script I tried with below code which is not working: //driver.findElement(By.xpath("//a[@style='word-wrap: normal; white-space: nowrap;']")); // driver.findElement(By.cssSelector("a[class='SItreeText']")).click(); //driver.findElement(By.cssSelector(".SItreeText")).click(); //driver.findElement(By.linkText("Ford CRM Centre")).click(); //driver.findElement(By.xpath("//html/body/table/tbody/tr[1]/td/div[1]/table/tbody/tr/td[1]/div/div/table/tbody/tr/td/span/table/tbody[2]/tr[2]/td[3]/div/div/div[2]/div/a")).click(); //driver.findElement(By.cssSelector("#DetailedNavigationTree")).click(); //driver.findElement(By.xpath("//a[contains(@href, '#')]")).click(); //driver.findElement(By.xpath("//a[@class='SItreeText']")).click(); //driver.findElement(By.cssSelector("#DetailedNavigationTree/navurl.SItreeText")).click(); //driver.findElement(By.xpath("//a[contains(@href, '#')]")).click(); //driver.switchTo().frame(driver.findElement(By.xpath("//html/body/table/tbody/tr[1]/td/div[1]/table/tbody/tr/td[1]/div/div/table/tbody/tr/td/span/table/tbody[2]/tr[2]/td[3]/div/div/div[2]/div/a"))); //driver.findElement(By.xpath("//a[contains(text(),'Ford CRM Centre')]")).click(); //WebElement WE = driver.findElement(By.xpath("//div[@id='DetailedNavigationTree']")); //driver.findElement(By.cssSelector("#DetailedNavigationTree:state")); Html Code:
favorite count: 0
accepted answer: http://stackoverflow.com/a/23865584
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36733296

http://stackoverflow.com/q/23898332
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36806406
has body: I've set up my Java based service to "Restart the Service" for the 1st, 2nd and subsequent failures. I've set the reset fail count to 1 day and the restart time to 1 minute. I can see the termination of my service in the event viewer but I never see any attempt at a restart. I'm not sure why this is happening. I trigger the shutdown by calling System.exit(-1) when we determine a third party app we use isn't responding. To test this I call System.exit(-1) in a place I can easily trigger. However, our service never restarts during testing and when our users hit the real error. I have no idea why it wouldn't trigger. Is the Java Sytsem.exit(-1) determined to be a "graceful" exit condition? If so, how can I trigger a restart from Java? Thanks, -Mike
tagged with: java
tagged with: windows-services
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36863125
has title: windows services recovery not working
has answer: http://stackoverflow.com/a/23943247

http://stackoverflow.com/q/23828865
answer count: 4
has comment: http://stackoverflow.com/comment/36663088
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36662772
has title: Java JUnit - Is it possible to determine if & which exception is thrown?
has comment: http://stackoverflow.com/comment/36708016
upvote count: 1
tagged with: unit-testing
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23829548
has answer: http://stackoverflow.com/a/23831596
has answer: http://stackoverflow.com/a/23829642
duplicate of: http://stackoverflow.com/q/3305453
tagged with: try-catch
has comment: http://stackoverflow.com/comment/36708059
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/23852116
favorite count: 0
tagged with: exception
has body: I've got a method in a normal class that has a try with multiple catches: Object returnObject = null; try { // do some stuff to set returnObject } catch (NoSuchMethodException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } catch (InvocationTargetException ex) { ex.printStackTrace(); } return returnObject; In my UnitTest I would like to test if the method successfully went through the stuff in the try, without going into one of the caught Exceptions. I know that if I didn't had a try-catch in my normal class' method, I could just use a try-catch with Assert.fail(...);, or an ExpectedException-tag in front of the test-method. BUT, my method does have a try-catch, and I want to UnitTest if I successfully go through the try, without going to one of the catches. (As you can see in the code above, all my catches only have a ex.printStackTrace();) PS: I also can't use the stuff in the try to test. So I can't check if returnObject is null after the method, because in this case I want it to be null (but without going to a catch). Otherwise I wouldn't asking this question. Thanks in advance for the responses.
linked to: http://stackoverflow.com/q/3305453

http://stackoverflow.com/comment/36804738
type: Comment
has text: That is probably one reason why we avoid public fields at all.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23902699

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23795909
tags question: http://stackoverflow.com/q/23796122
tags question: http://stackoverflow.com/q/23876859
tags question: http://stackoverflow.com/q/23788083
tags question: http://stackoverflow.com/q/23788369
type: Tag
tags question: http://stackoverflow.com/q/23934392

http://stackoverflow.com/comment/36702975
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23824016
has text: not sure if exclude feature is available. maybe you should have your own recursive code to find all files and index, excluding the unwanted files

http://stackoverflow.com/q/23795757
has answer: http://stackoverflow.com/a/23795883
has comment: http://stackoverflow.com/comment/36600397
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36600352
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/36600361
has body: I want to look for a String within another String in JAVA. Then gets its location. I wanted to crop things before and after the string im searching for. String Str1 = "Cats"; String Str2 = "Bear"; String Str3 = "MonkeysDogsCatsPandasPolarBear"; So it would print "PandasPolar"
answer count: 2
upvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/36600391
has comment: http://stackoverflow.com/comment/36600502
favorite count: 0
has comment: http://stackoverflow.com/comment/36600451
has answer: http://stackoverflow.com/a/23795865
has title: Find and get a string from two other strings?

http://stackoverflow.com/comment/36798234
type: QuestionComment
comment on: http://stackoverflow.com/q/23899151
score: 0
has text: executeUpdate was the right solution =) or should I disable autocommit but I think then I have to change my code? please post your comment as answer if possible linking to the documentation (why is there the difference between execute and executeUpdate and what is it?) so I know some details.
type: Comment

http://stackoverflow.com/comment/36624472
has text: IDEA doesn't seem to be able to evaluate `environmentName` here. Maybe a bug with IDEA's gradle integration?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23808711

http://stackoverflow.com/q/23921020
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/36842467
answer count: 3
has title: Value of variable randomly changing. In simple android game
linked to: http://stackoverflow.com/q/575336
accepted answer: http://stackoverflow.com/a/24027072
has comment: http://stackoverflow.com/comment/36840370
favorite count: 0
has answer: http://stackoverflow.com/a/23925541
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36840038
has body: I have this app game which, at the beginning, creates two 3x3 grids of squares. One of my functions setGridDimensions() goes in and assigns the min and max X/Y values for each square in the gird(based on the screen size). This is then used to draw the grid. The strange thing is that sometimes the x or y value of a square will get randomly switched with another square, resulting in holes in my grid. I can't seem to figure out why this is happening. Any help is appreciated. Note I do know the draw function works which is why it is not displayed. Something happens to the x/y values before it is called. Instances gameGrid = new Grid(Settings.gridWidth, Settings.gridHeight); target = new Grid(Settings.gridWidth, Settings.gridHeight); This is my code for the function private void setGridDimensions() { for (int x=0; x&lt;gameGrid.grid.length; x++) { for (int y= 0; y&lt; gameGrid.grid.length; y++) { gameGrid.grid[x][y].minX = (int)((Settings.WIDTH * .2) + Settings.padding + (Settings.squareWidth * x)); gameGrid.grid[x][y].maxX = gameGrid.grid[x][y].minX + Settings.squareWidth; gameGrid.grid[x][y].minY = Settings.padding + (Settings.squareHeight * y); gameGrid.grid[x][y].maxY = gameGrid.grid[x][y].minY + Settings.squareHeight; target.grid[x][y].minX = (int)((Settings.WIDTH * .8) + Settings.padding + (Settings.squareWidth/4 * x)); target.grid[x][y].maxX = target.grid[x][y].minX + Settings.squareWidth/4; target.grid[x][y].minY = Settings.padding + (Settings.squareHeight/4 * y); target.grid[x][y].maxY = target.grid[x][y].minY + Settings.squareHeight/4; System.out.println("minX " + target.grid[x][y].minX); } } System.out.println("0-0 " + target.grid[0][0].minX); } The output below shows the prints when at least one of the missing squares is in position 0,0 of my array. The 0-0 output should be the same as the first minX output I believe. As you can see the minX value has changed from 600 to 626 (I don't have the rep to post a picture) OUTPUT minX 600 minX 600 minX 600 minX 626 m…
tagged with: java
tagged with: screen
has answer: http://stackoverflow.com/a/23922186
has comment: http://stackoverflow.com/comment/36844386
has answer: http://stackoverflow.com/a/24027072
has comment: http://stackoverflow.com/comment/36839957
has comment: http://stackoverflow.com/comment/36840735
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/23922186

http://stackoverflow.com/comment/36691582
comment on: http://stackoverflow.com/a/23818115
type: AnswerComment
score: 0
has text: The solution with JDK classes Date and DateFormat is somehow more simple, based on my requirements. But I understand that for more complex date/time operations and JDK 7 or less, Joda-Time would have significant advantages, thanks. To answer your comments: this is an example, in real life I'd externalize strings in a resource bundle to have consistent i18n. Regarding ignored time zone, I don't get your point, bullet #2 of the reqs seems to address that.
type: Comment

yourkit
tags question: http://stackoverflow.com/q/23867246
type: Tag
tag name: yourkit
tags question: http://stackoverflow.com/q/23882973
tags question: http://stackoverflow.com/q/23792625

http://stackoverflow.com/comment/36834899
score: 0
type: Comment
type: QuestionComment
has text: @BitBank: Thanks for you interest in this post. I know you are an image expert. I put the links to the good tiff (2001x3000) and the bad tiff (2000x3000). You might be able to figure out the problem.
comment on: http://stackoverflow.com/q/23918514

http://stackoverflow.com/q/23884914
has comment: http://stackoverflow.com/comment/36770167
upvote count: 30
type: Question
has comment: http://stackoverflow.com/comment/36808671
has answer: http://stackoverflow.com/a/23885428
has answer: http://stackoverflow.com/a/23885270
has answer: http://stackoverflow.com/a/23885184
tagged with: ignore-case
linked to: http://stackoverflow.com/q/385506
has body: I encountered a question in interview to write a method to check for similar words irrespective of character cases. I answered it by using the difference of ASCII value for each pair of characters. But at home, when I went through the actual implementation of it in String.class, I get disturbed - Why is it implemented that way! I tried to draw a comparison between inbuilt and my custom method, this way- public class EqualsIgnoreCase { public static void main(String[] args) { String str1 = "Srimant @$ Sahu 959s"; String str2 = "sriMaNt @$ sAhu 959s"; System.out.println("Avg millisecs with inbuilt () - " + averageOfTenForInbuilt(str1, str2)); System.out.println("\nAvg millisecs with custom () - " + averageOfTenForCustom(str1, str2)); } public static int averageOfTenForInbuilt(String str1, String str2) { int avg = 0; for (int itr = 0; itr &lt; 10; itr++) { long start1 = System.currentTimeMillis(); for (int i = 0; i &lt; 100000; i++) { str1.equalsIgnoreCase(str2); } avg += System.currentTimeMillis() - start1; } return avg / 10; } public static int averageOfTenForCustom(String str1, String str2) { int avg = 0; for (int itr = 0; itr &lt; 10; itr++) { long start2 = System.currentTimeMillis(); for (int i = 0; i &lt; 100000; i++) { isEqualsIgnoreCase(str1, str2); } avg += System.currentTimeMillis() - start2; } return avg / 10; } public static boolean isEqualsIgnoreCase(String str1, String str2) { int length = str1.length(); if (str2.length() != length) { return false; } for (int i = 0; i &lt; length; i++) { char ch1 = str1.charAt(i); char ch2 = str2.charAt(i); int val = Math.abs(ch1 - ch2); if (val != 0) { if (isInAlphabetsRange(ch1, ch2)) { if (val != 32) { return false; } } else { return false; } } } return true; } public static boolean isInAlphabetsRange(char ch1, char ch2) { return (((ch1 &lt;= 122 &amp;&amp; ch1 &gt;= 97) || (ch1 &lt;= 90 &amp;&amp; ch1 &gt;= 65)) &amp;&amp; ((ch2 &lt;= 122 &amp;&amp; ch2 &gt;= 97) || (ch2 &lt;= 90 &amp;&amp; ch2 &gt;= 65))); } } Output…
has comment: http://stackoverflow.com/comment/36771212
linked to: http://stackoverflow.com/q/504103
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/23885073
accepted answer: http://stackoverflow.com/a/23885073
downvote count: 9
has comment: http://stackoverflow.com/comment/36770400
has title: Why is String.equalsIgnoreCase is so slow
has comment: http://stackoverflow.com/comment/36770559
answer count: 5
has comment: http://stackoverflow.com/comment/36795652
possible better answer: http://stackoverflow.com/a/23885270
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/36770100
has answer: http://stackoverflow.com/a/24355047
score: 21
tagged with: java

http://stackoverflow.com/comment/36832821
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23917743
type: QuestionComment
has text: As expected, it is [not available](http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.5_r1/android/view/ViewConfiguration.java/) in 2.3.5. The first occurrence I see is in 4.0.1_r1.

http://stackoverflow.com/q/23939770
tagged with: equals
has answer: http://stackoverflow.com/a/23939872
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23939872
has body: import java.util.*; public class Algorithm { public static class Matrix{ private Double[][] x; } public static Scanner scan = new Scanner(System.in); private static String str; public static void read_data(Double[] radians, Double[] l) { l[0] = 0.0; int i; for (i = 0; i &lt; 9; i++) { str = scan.next(); //passem la primera columna str = scan.next(); //agafem el valor del desplaÃ§ament str = str.substring(0, str.length()-1); //traiem la coma l[i+1] = Double.parseDouble(str); str = scan.next(); //passem la primera columna str = scan.next(); //agafem el valor del desplaÃ§ament if (i &lt; 9) str = str.substring(0, str.length()-1); //traiem la coma radians[i] = Math.toRadians(Double.parseDouble(str)); } radians[i] = 0.0; } public static void print_Matrix(Double[][] M) { for (int k = 0; k &lt; 4; k++) { System.out.print("\n"); for (int j = 0; j &lt; 4; j++) { System.out.print(String.valueOf(M[k][j]) + " , "); } } } public static void print_Jacobian(Double[][] M) { System.out.print("Jacobian Matrix ="); for (int k = 0; k &lt; 3; k++) { System.out.print("\n"); for (int j = 0; j &lt; 9; j++) { System.out.print(String.valueOf(M[k][j]) + " , "); } } } public static void init_Matrix(Double[][] M, int i, Double[] radians, Double[] l) { M[0][3] = l[i]; M[0][0] = Math.cos(radians[i]); M[0][1] = -Math.sin(radians[i]); M[1][0] = Math.sin(radians[i]); M[1][1] = Math.cos(radians[i]); for (int k = 0; k &lt; 4; k++) { for (int j = 0; j &lt; 4; j++) { if (k == j &amp;&amp; (M[k][j] == null)) M[k][j] = 1.0; else if(M[k][j] == null) M[k][j] = 0.0; //System.out.print(String.valueOf(M[k][j]) + "\n"); } } } public static void init_Ultima_Matrix(Double[][] M, int i, Double[] l) { M[0][3] = l[i]; for (int k = 0; k &lt; 4; k++) { for (int j = 0; j &lt; 4; j++) { if (k == j) M[k][j] = 1.0; else if(M[k][j] == null) M[k][j] = 0.0; } } } public static void init_Derivada(Double[][] M, int i, Double[] radians) { M[0][0] = -Math.sin(radians[i]); M[0][1] = -Math.cos(radians[i]); M[1][0] = Math.cos(radia…
type: Question
tagged with: null
has comment: http://stackoverflow.com/comment/36873954
score: 0
has title: the value of the object is null once I get out of the function (Java)
tagged with: matrix
answer count: 1

http://stackoverflow.com/a/23843233
has body: I solved the issue by declaring a Target instance as class member. then initialised it. Like this: target = new Target() { @Override public void onPrepareLoad(Drawable drawable) { } @Override public void onBitmapLoaded(Bitmap photo, Picasso.LoadedFrom from) { cropEventImage(photo); } @Override public void onBitmapFailed(Drawable arg0) { } }; Picasso.with(this) .load(AppServer.getImageUrl() + "/" + eventInfo.getImageName()) .placeholder(R.drawable.calendar) .error(R.drawable.calendar) .into(target);
answers question: http://stackoverflow.com/q/23843055
upvote count: 11
type: AcceptedAnswer
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/36698829
accepted answer of: http://stackoverflow.com/q/23843055

http://stackoverflow.com/comment/36858512
has text: I've looked through everything. And there aren't any of those error symbols that eclipse displays next to a file, except for on files that mention `R.java` of course.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23931732

http://stackoverflow.com/comment/36770705
comment on: http://stackoverflow.com/q/23872275
has text: magazineID is in quotes because it has capital letters, and I've found that only in this way it compiles properly. It was the connection, I never closed it. Thank you all!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23817359
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23817599
tagged with: methods
downvote count: 1
has answer: http://stackoverflow.com/a/23818103
type: Question
accepted answer: http://stackoverflow.com/a/23817599
has comment: http://stackoverflow.com/comment/36641393
tagged with: interaction
possible better answer: http://stackoverflow.com/a/23817426
answer count: 3
has answer: http://stackoverflow.com/a/23817426
has comment: http://stackoverflow.com/comment/36641383
favorite count: 0
has title: how objects interacts with each other in java using methods?
tagged with: object
score: 4
type: AnsweredQuestion
has body: I am learning java and can do pretty much coding myself without any issues. But I have been always reading in the books - In java, objects interact with each other by invoking methods of other objects? I am unsure if I got that clearly. Example is like, a Robot class which has methods like moveForward(), comeToBase(),increaseSpeed() etc. Now if there are two robot objects, then how will they interact with each other to avoid clash? I can understand very well that each robot object can invoke its own methods independently and run independently but how does the interaction between the object happens? Can someone explain based on the above example?

http://stackoverflow.com/comment/36849499
has text: Just change R.layout.frgment00 to another one. is it what you need?
comment on: http://stackoverflow.com/q/23926409
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23861650
tagged with: swing
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/23861686
tagged with: java
tagged with: jtextarea
answer count: 1
accepted answer: http://stackoverflow.com/a/23861686
score: 0
has body: I have a fully functional console-based database which I need to add GUIs to. I have created a tab page (currently only one tab) with a button "Display All Student" which when triggered will display a list of students inside a JTextArea which of course is in its own class and not inside the button's action listener class. Problem is, the JTextArea is not recognised inside button's action listener. If I add parameter into the action listener, more errors arise. Help? I have searched Stack Overflow for similar problems but when I tried it in my code, doesn't really do the trick? Or maybe I just need a nudge in the head. Anyways. Here is my code so far: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class StudDatabase extends JFrame { private JTabbedPane tabbedPane; private JPanel studentPanel; private static Scanner input = new Scanner(System.in); static int studentCount = 0; static Student studentArray[] = new Student[500]; public StudDatabase() { setTitle("Student Database"); setSize(650, 500); setBackground(Color.gray); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); // Create the tab pages createStudentPage(); // more tabs later... // Create a tab pane tabbedPane = new JTabbedPane(); tabbedPane.addTab( "Student Admin", studentPanel ); topPanel.add( tabbedPane, BorderLayout.CENTER ); } public void createStudentPage() { studentPanel = new JPanel(); studentPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton listButton = new JButton("List All Student(s)"); listButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if(studentCount &gt; 0) { for(int i=0; i&lt;studentCount; i++) { // print out the details into JTextArea // ERROR! textDisplay not recognised!!! textDisplay.append("Student " + i); } System.out.printf("\n"); } else // no record? display warning to user { System.out.printf("No data to display!\n\n"); } } }); studentPanel.add(…
type: AnsweredQuestion
has title: Change JTextArea texts from JButton's actionPerformed which is in another class

http://stackoverflow.com/a/23909296
type: Answer
has comment: http://stackoverflow.com/comment/36832003
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36820796
answers question: http://stackoverflow.com/q/23906737
has body: java -jar myjar.jar Will only work if the jar's manifest contains the "Main-Class: classname" entry. Check for that. If it is not present then you can still run you application via this command: java -cp ./my.jar package/class_name

http://stackoverflow.com/q/23780564
has comment: http://stackoverflow.com/comment/36571701
has title: Java Swing graphics glitch?
has answer: http://stackoverflow.com/a/27029126
linked to: http://stackoverflow.com/q/22737535
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/36601349
has answer: http://stackoverflow.com/a/27885664
type: UnansweredQuestion
has body: Image of the glitch I am learning Java by reproducing examples from a textbook and as soon as I got to using the GUI classes I experienced some weird glitches, if that is the correct term. As you can see on the image, parts of the text are missing. The code generating this dialog isn't complicated either: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; public class InnerClassTest { public static void main(String[] args) { TalkingClock clock = new TalkingClock(1000, true); clock.start(); // keep program running until user selects "OK" JOptionPane.showMessageDialog(null, "Quit program?"); System.exit(0); } } class TalkingClock { /* * COnstructs a talking clock * @param interval the interval between messages (in milliseconds) * @param beep true if the clock should beep */ public TalkingClock(int interval, boolean beep) { this.interval = interval; this.beep = beep; } /* * Start the clock. */ public void start() { ActionListener listener = new TimePrinter(); Timer t = new Timer(interval, listener); t.start(); } private int interval; private boolean beep; class TimePrinter implements ActionListener { @Override public void actionPerformed(ActionEvent event) { Date now = new Date(); System.out.println("At the tone, the time is " + now); if (beep) Toolkit.getDefaultToolkit().beep(); } } } I get similair glitches when I open the Java "control panel". Look at the Java icon on this image. (A piece of text is missing here as well. The current tab title should be "Uppdatera") I am not experiencing this issue in any other application and I am running an up-to-date version of the Java platform the latest available drivers for my Nvidia GeForce GT 630M. Do you have any suggestion on things I can try to solve this?
tagged with: visual-glitch
tagged with: swing
tagged with: graphics
has comment: http://stackoverflow.com/comment/36571678
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/66926582
has comment: http://stackoverflow.com/comment/36573531
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/26075573
has comment: http://stackoverflow.com/comment/36574566
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/q/23783746
has answer: http://stackoverflow.com/a/23805274
has comment: http://stackoverflow.com/comment/36579034
tagged with: playframework
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36578745
has title: mismatch; found : net.sf.uadetector.ReadableUserAgent required: Nothing
tagged with: scala
accepted answer: http://stackoverflow.com/a/23805274
type: AnsweredQuestion
tagged with: java
tagged with: caching
downvote count: 1
type: Question
upvote count: 0
has body: i am trying convert this code http://uadetector.sourceforge.net/usage.html#improve_performance in scala , but getting dificulties object CachedUserAgentStringParser extends UserAgentStringParser { private val parser = UADetectorServiceFactory.getCachingAndUpdatingParser private val cache = CacheBuilder.newBuilder().maximumSize(100).expireAfterWrite(2, TimeUnit.HOURS) .build() override def getDataVersion(): String = parser.getDataVersion override def parse(userAgentString: String): ReadableUserAgent = { var result = cache.getIfPresent(userAgentString) if (result == null) { result = parser.parse(userAgentString) cache.put(userAgentString, result) } result } override def shutdown() { parser.shutdown() } } getting error type mismatch; found : net.sf.uadetector.ReadableUserAgent required: Nothing result = parser.parse(userAgentString) ^ cache.put(userAgentString, result) ^
score: -1

http://stackoverflow.com/a/23797186
answers question: http://stackoverflow.com/q/23796468
has comment: http://stackoverflow.com/comment/36603225
type: Answer
has comment: http://stackoverflow.com/comment/82861665
has comment: http://stackoverflow.com/comment/36603978
has comment: http://stackoverflow.com/comment/36604002
score: 3
downvote count: 0
type: AcceptedAnswer
has body: Manipulate the blips in s before adding them to f. In other words, swap the order of your for loops. Then in your blip manipulation, what you need to do is: get the part of interest Rel rel = f.getMainDocumentPart().addTargetPart update the relId in the blip from rel.getId Now add the content of s to f. You could just use addAll to do the job without the nested loop. Also there's only one body object, so you don't need the outer loop. Obviously this answer is limited to handling only CTBlip, and then only embedded ones. There's a lot more to a complete solution to merging docx files... Note: I wrote the code for merging documents in docx4j Enterprise
accepted answer of: http://stackoverflow.com/q/23796468
upvote count: 3

http://stackoverflow.com/comment/36719230
comment on: http://stackoverflow.com/a/23855889
score: 0
type: AnswerComment
has text: 1. I don't wanna discard so no skipping. 2. `File.length` doesn't help, since I may not know how much I have already read. 3. I'd need to path the remaining length, how do I get that? On the other hand I'd like to stick with the standard API but if that's the only way, I have no choice.
type: Comment

http://stackoverflow.com/q/23828796
has comment: http://stackoverflow.com/comment/36662677
possible better answer: http://stackoverflow.com/a/23828986
has answer: http://stackoverflow.com/a/23828986
has answer: http://stackoverflow.com/a/23828965
score: 0
has comment: http://stackoverflow.com/comment/36662852
answer count: 3
tagged with: android
has title: Login Validation in android.
has comment: http://stackoverflow.com/comment/36662651
accepted answer: http://stackoverflow.com/a/23828965
has body: I am developing an android application. I want to validate Mobile no and password so that user can login. I've wrote some code for this. The problem is, if I enter wrong Mobile no and Password, it is validating as correct. Please let me know what is wrong I am doing in the code. I am new in android. This is the code below: insert2.php &lt;?php $host='localhost'; $uname='root'; $pwd='welcome'; $db='CoovaChilli'; $con=mysql_connect($host,$uname,$pwd) or die("Connection Failed"); mysql_select_db($db,$con) or die("database selection failed"); $mobile=$_POST['Mobile']; $password=$_POST['Password']; $flag['code']=0; $select="select * from Insert1 where Mobile = '$mobile' AND Password = '$password'"; if($r=mysql_query($select,$con)) { $flag['code']=1; } print(json_encode($flag)); mysql_close($con); ?&gt; LoginActivity.java import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONObject; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class LoginActivity extends Activity implements OnClickListener { EditText et1,et2; Button login; String Mobile=null; String Password=null; InputStream is=null; HttpPost httpPost; HttpClient client; String result=null; Strin…
tagged with: php
has answer: http://stackoverflow.com/a/23829321
type: AnsweredQuestion
tagged with: java
tagged with: database
tagged with: mysql
type: Question

http://stackoverflow.com/comment/36599420
has text: What is the error? did you import the correct `R`?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23791227
score: 0

http://stackoverflow.com/comment/36665954
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23830434
has text: Now you got the reason. `fileIn` object is null.
type: Comment

http://stackoverflow.com/a/23904238
has body: What you implemented here is called "instance controlled" class (See Effective Java - Joshua Bloch Chapter 2 - Item I). Usually developers implement instance-controlled class using a static factory, you can keep reference to the objects that were created (like you're doing with that List) as well as do other stuff such as restrict the number of instances. A famous private case of an "instance controlled" class is called Singleton (though in that case there's no point in keeping a list...). From performance perspective I don't see any meaningful gain/loss between keeping the list inside the class or outside of it.
answers question: http://stackoverflow.com/q/23904082
accepted answer of: http://stackoverflow.com/q/23904082
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/a/23833900
answers question: http://stackoverflow.com/q/23833765
score: 2
has body: drawArc(int x, int y, int width, int length, int startAngle, int arcAngle) Used to draw an arc inside an imaginary rectangle whose upper left corner is at (x,y). The arc is drawn from the startAngle to startAngle + arcAngle and is measured in degrees. A startAngle of 0º points horizontally to the right (like the unit circle in math). Positive is a counterclockwise rotation starting at 0º
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/36592966
comment on: http://stackoverflow.com/a/23789009
has text: Hi Nick, so when I updated it with your code, it crashes when I select an item. The array appears normally, but when I select it, it freezes.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36638378
type: Comment
comment on: http://stackoverflow.com/a/23813903
score: 0
type: AnswerComment
has text: Yeah I already thought about time of last modification... The files might be altered arbitrarily, hence solution 1) does not fit.

http://stackoverflow.com/comment/36596445
has text: @Aceghn - I think I understand your question. You can make the property (or generate as I've shown above) an Integer, then it will be null when it is not present in the document and have a value otherwise. In Java you can treat an `Integer` the same as an `int`. Just be sure to do a null check on it first.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23792870

http://stackoverflow.com/q/23826029
upvote count: 1
has body: This is the code that is supposed to read a text from a specified website but the variable "result" simply gives me no output. I can't get the function main(null) running. it simply crashes the app whenever or wherever it is called. (am calling in onCreate() of MainActivity) public class ConvertUrlToString { public void main(String[] args) { try { webPage = "http://www.albab.pk/albab_edu/mashal/dsms.aspx"; URL url = new URL(webPage); URLConnection urlConnection = url.openConnection(); InputStream is = urlConnection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); int numCharsRead; char[] charArray = new char[1024]; StringBuffer sb = new StringBuffer(); while ((numCharsRead = isr.read(charArray)) &gt; 0) { sb.append(charArray, 0, numCharsRead); } result = sb.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } public void onClick(View arg0) { // TODO Auto-generated method stub SmsManager sms = SmsManager.getDefault(); PendingIntent piSent = PendingIntent.getBroadcast(this, 0, new Intent("SMS_SENT"), 0); PendingIntent piDelivered = PendingIntent.getBroadcast(this, 0, new Intent("SMS_DELIVERED"), 0); sms.sendTextMessage("+923018744545", null, "Hi There!", piSent, piDelivered); } public void onReceive(Context arg0, Intent arg1) { // TODO Auto-generated method stub switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), result, Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic Failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No Service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), "Radio Off", Toast.LENGTH_SHORT).show(); break; defaul…
downvote count: 1
type: Question
tagged with: java
tagged with: eclipse
has title: Reading a webpage in Eclipse android
accepted answer: http://stackoverflow.com/a/23827004
score: 0
has comment: http://stackoverflow.com/comment/36670826
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23827004

http://stackoverflow.com/comment/36686481
type: AnswerComment
has text: Oooooooh great thanks!! Do you have a recommendation then about how I go about making it so that it still only writes 10 integers to a line, but if there are less then it will still write them without going out of bounds? Is there an exception I could throw/catch?
type: Comment
comment on: http://stackoverflow.com/a/23840893
score: 0

http://stackoverflow.com/a/23845663
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23845608
score: 5
answers question: http://stackoverflow.com/q/23845608
type: AcceptedAnswer
has body: What you are looking for is a Service. They are meant for this exact purpose; to run on the background (this does not mean a background Thread ) even if there are no Activities running.

http://stackoverflow.com/comment/37450111
has text: Interesting...Quite interesting. It might even be a track to enhance RS performances for all cache work. Would you feel an issue for this in our github issue board, I would mark it as 1.5.0 desired feature. This might take some time to be included as this involves quite a lot of refactoring. Let's see if that could be elegantly implemented. And please refer to our thread here. Tough I would like to emphasize that on a Nexus 4, my dev phone, processing a request with wifi generally lies around 150 ms for a good server !
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24124608

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/23890078
type: Tag
tags question: http://stackoverflow.com/q/23823353

http://stackoverflow.com/comment/57858124
has text: Here's my [Java Swing File Browser](http://java-articles.info/articles/?p=637) article.
comment on: http://stackoverflow.com/a/23808238
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/23839132
linked to: http://stackoverflow.com/q/6432970
has comment: http://stackoverflow.com/comment/119472498
has title: Jsoup login to scrape game data
has answer: http://stackoverflow.com/a/23839435
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36694707
linked to: http://stackoverflow.com/q/6644168
has answer: http://stackoverflow.com/a/23839365
tagged with: java
has comment: http://stackoverflow.com/comment/36706629
type: Question
tagged with: jsoup
answer count: 3
has answer: http://stackoverflow.com/a/23854628
has body: The question is can I use Jsoup to post login data that is controlled by javascript? Here's the info so far Login URL for the site: http://www.cybernations.net/login.asp (they do have a no-bots policy, but I emailed the admin and have permission to auto-login for downloading game datafiles) URL where files are stored http://www.cybernations.net/stats_downloads.asp The line of code where I use Jsoup to parse the html of the login page to show me the scripts... Elements scriptTags = doc.getElementsByTag("script"); The output of looping through the list of Elements... &lt;!-- function FrontPage_Form1_Validator(theForm) { if (theForm.Username.value == "") { alert("Please enter a value for the \"Username\" field."); theForm.Username.focus(); return (false); } if (theForm.Username.value.length &gt; 40) { alert("Please enter at most 40 characters in the \"Username\" field."); theForm.Username.focus(); return (false); } if (theForm.Validate_Password.value == "") { alert("Please enter a value for the \"Password\" field."); theForm.Validate_Password.focus(); return (false); } if (theForm.Validate_Password.value.length &lt; 1) { alert("Please enter at least 1 characters in the \"Password\" field."); theForm.Validate_Password.focus(); return (false); } if (theForm.Validate_Password.value.length &gt; 50) { alert("Please enter at most 50 characters in the \"Password\" field."); theForm.Validate_Password.focus(); return (false); } return (true); } //--&gt; EDIT 1: edited the connection code Current code for login looks like so, returning the login page. Connection.Response loginForm = Jsoup.connect( loginURL ) .method(Connection.Method.GET) .execute(); Document document = Jsoup.connect( loginURL ) .data("Login", "Login") .data("Username", user ) .data("Validate_Password", pass ) .cookies(loginForm.cookies() ) .post(); I feel like I'm missing something really simple here, should I direct the connect() method to follow redirects? EDIT 2: Thanks for all your help, I think I'm going t…
score: 0

http://stackoverflow.com/q/23838097
has body: I am studying in prevision of my exam of Software Programming. Here I am trying to append 2 arrays but what I get printed is: [I@17dfafd1 here is the code: package examPreparation2014; public class FirstExercise { public static void main(String[] args){ int[] first = {1,2,3}; int[] second = {4,5,6}; System.out.print(FirstExercise.concatenator(first, second)); } public static int[] concatenator(int[] first, int[] second){ int[] concatenatedArray = new int[first.length + second.length]; for (int i = 0; i&lt;first.length ; i++){ concatenatedArray[i] = first[i]; } for (int i=0; i&lt;second.length; i++){ concatenatedArray[i+first.length] = second[i]; } return concatenatedArray; } } PS: this is an exam on paper, therefore I cannot import libraries :-)
tagged with: java
has comment: http://stackoverflow.com/comment/36681018
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23838112
tagged with: arrays
has comment: http://stackoverflow.com/comment/36680763
type: Question
has comment: http://stackoverflow.com/comment/36681027
possible better answer: http://stackoverflow.com/a/23838122
has answer: http://stackoverflow.com/a/23838122
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23838112
has title: Java - Error trying to print an array made of 2 appended arrays

http://stackoverflow.com/a/23833065
has comment: http://stackoverflow.com/comment/36673376
has comment: http://stackoverflow.com/comment/36674518
has comment: http://stackoverflow.com/comment/36681997
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36683177
has comment: http://stackoverflow.com/comment/36679514
answers question: http://stackoverflow.com/q/23823794
has body: Don't use an ActionListener on the combo box. The "popup" will be displayed by the editor when you click on the cell. My first problem is that i don't understand why the code in the tutorial works when we implement abstract table model and not working DefaultTableModel. Editing is controlled by the isCellEditable(...) method of the TableModel. When you click on a cell that is editable the JTable will use the appropriate editor. If the editor is a combo box, then the popup will be displayed when the cell is clicked. Just find the problem : When commenting the statement jcb.setEditable(true); , if i do a single click on the comboxcell it opens the cell. But i don't know why it works better When you click on a cell I believe the MouseEvent is forwarded to the editor (ie the combo box). Since the combo box is editable the MouseEvent goes to the text field, so focus remains of the text field and the popup is not displayed. Try this with a normal combo box, not displayed in a JTable so see the same behaviour.
has comment: http://stackoverflow.com/comment/36679307
has comment: http://stackoverflow.com/comment/36672589

http://stackoverflow.com/q/23788715
score: 0
answer count: 1
tagged with: jsp
tagged with: tomcat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36587386
has body: My directory structure is I am using Spring MVC with Apache Ivy. My web.xml is Spring Web MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / and my dispacher servlet spring configuration is /WebContent/pages/ .jsp testController loginController I am testing localhost:8080/TestWebProject/login.htm. It is correctly hitting the Login controller. Yet I am getting following error As you can see that path matches my directory structure. Not sure what am I missing. Any suggestions?
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36595829
type: Question
has answer: http://stackoverflow.com/a/23793438
has comment: http://stackoverflow.com/comment/36588499
tagged with: java
has title: Tomcat not able to find requested resource though it exists
tagged with: eclipse

http://stackoverflow.com/a/23800991
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23800926
downvote count: 0
has body: If there is a class called A, which calls a synchronized method, resides in the class B, is acquiring the lock from an object of class A (which the method is called). No, in this case object of class B will be used as lock, since the method belongs to Class B
accepted answer of: http://stackoverflow.com/q/23800926

http://stackoverflow.com/q/23935349
type: Question
has comment: http://stackoverflow.com/comment/36865657
tagged with: android
has comment: http://stackoverflow.com/comment/36865491
has comment: http://stackoverflow.com/comment/36866364
score: 0
has comment: http://stackoverflow.com/comment/36866238
has comment: http://stackoverflow.com/comment/36865514
has comment: http://stackoverflow.com/comment/36865736
answer count: 1
has body: I am new to java. I have a directory with a txt file (R.raw). I want to get access with a command InputStream in_s = res.openRawResource(R.raw.itemname); where itemname is a dynamic string with a filename from a previous activity. How do I can get open file in R.raw by a string "n0.txt"? In javascript I can implement it like R.raw["n0.txt"] or R.raw.itemname. Thanks in advance.
has comment: http://stackoverflow.com/comment/36866149
has title: How to get access to object
tagged with: java
has answer: http://stackoverflow.com/a/23935952
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3476430

http://stackoverflow.com/comment/36840320
has text: I updated my source in regard to the other answer: see anything that might be wrong with it? http://pastebin.com/aBYpNa6b (whomever can get me up and running first I will gladly provide answer credit to) :) I truly appreciate the input.
comment on: http://stackoverflow.com/a/23899400
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37032818
score: 0
comment on: http://stackoverflow.com/a/23879528
has text: Thanks for pointing this out though. Both ways seem to work for us. We weren't sure which was correct.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36734865
has text: Works for me (in Eclipse). Are you sure you run the most recent version? There were lambda serialization bugs in the past, I filed some of them to the Eclipse team by myself, but they were fixed quickly.
score: 1
comment on: http://stackoverflow.com/q/23837215
type: Comment
type: QuestionComment

runtime
tags question: http://stackoverflow.com/q/23873341
type: Tag
tag name: runtime
tags question: http://stackoverflow.com/q/23859803
tags question: http://stackoverflow.com/q/23900113
tags question: http://stackoverflow.com/q/23853225

http://stackoverflow.com/a/23936291
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23930117
answers question: http://stackoverflow.com/q/23930117
has comment: http://stackoverflow.com/comment/36892132
type: AcceptedAnswer
has body: I've checked there and the thing is i'm trying to access a global value You need to save all your data in onSavedInstanceState and restore it on onRestoreInstanceState.
upvote count: 1
type: Answer

http://stackoverflow.com/q/23851203
has comment: http://stackoverflow.com/comment/59242618
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23854161
has body: It's my first time trying to use action listeners and event-handling. I'm trying to create a simple GUI that has 3 buttons: home, about and tag. For each JButton I've added a listener object and created a nested class for the listener object. public class interfacetest { public static void main(String[] args) { JFrame window = new JFrame("GUI Test"); window.setSize(250, 100); window.setLocation(100, 100); final JButton home = new JButton("Home"); final JButton about = new JButton("About"); final JButton tag = new JButton("Tag"); JMenuBar menu = new JMenuBar(); menu.add(home); menu.add(about); menu.add(tag); menu.setVisible(true); window.setJMenuBar(menu); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); thehandler handler = new thehandler(); home.addActionListener(handler); about.addActionListener(handler); tag.addActionListener(handler); window.setVisible(true); } // Here is my nested class. private class thehandler implements ActionListener { public void actionPerformed(ActionEvent event) { String string = ""; if (event.getSource()==home) string = string.format("home: %s, event.getActionCommand()"); else if (event.getSource()==about) string = string.format("about: %s, event.getActionCommand()"); else if (event.getSource()==tag) string = string.format("tag: %s, event.getActionCommand()"); JOptionPane.showMessageDialog(null, string); } } } I'm getting the error when I'm creating a new thehandler object saying: "No enclosing instance of type interfacetest is accessible. Must qualify the allocation with an enclosing instance of type interfacetest (e.g. x.new A() where x is an instance of interfacetest)."
downvote count: 0
score: 1
tagged with: event-handling
has comment: http://stackoverflow.com/comment/36706249
linked to: http://stackoverflow.com/q/9560600
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36707125
has title: Getting error using nested ActionListener class for a JButton Object?
has comment: http://stackoverflow.com/comment/36707543
upvote count: 1
has answer: http://stackoverflow.com/a/23854161
answer count: 1
linked to: http://stackoverflow.com/q/18219366
tagged with: actionlistener
tagged with: nested-class

http://stackoverflow.com/q/23810166
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/23810620
type: Question
has answer: http://stackoverflow.com/a/23810620
has title: Dynamically select catalog for Tomcat mysql connection pool in a Spring application
tagged with: catalog
tagged with: tomcat
score: 0
answer count: 2
has body: I need to create a connection pool from a spring application running in a tomcat server. This application has many catalogs, the main catalog (its is static) called 'db' has just one table with all existing catalog names and a boolean flag for the "active" one. When the application starts I need to choose from the main catalogs the active one, then I have to select it as default catalog. How can I accomplish this? Until now I used a custom class DataSourceSelector extends DriverManagerDataSource but now I need to improve the db connection using a pool, then I thought about a tomcat dbcp pool.
has answer: http://stackoverflow.com/a/23811255
accepted answer: http://stackoverflow.com/a/23811255
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/36693261
has text: @RahulY Are you using `ModelDriven`? Do you have getters and setters for properties?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23829108
type: Comment

http://stackoverflow.com/a/23899400
has comment: http://stackoverflow.com/comment/36928721
score: 0
has comment: http://stackoverflow.com/comment/36798726
type: Answer
has comment: http://stackoverflow.com/comment/36798691
has body: I do not know the exact line of the NPE raised, but the problem is probably related to this line: new AlertDialog.Builder(null); You cant pass null here. You should put an instance of android.content.Context here (your Activity for example which started this task).
has comment: http://stackoverflow.com/comment/36798446
answers question: http://stackoverflow.com/q/23899281
has comment: http://stackoverflow.com/comment/36840320
has comment: http://stackoverflow.com/comment/36798636

http://stackoverflow.com/a/23852116
answers question: http://stackoverflow.com/q/23828865
type: Answer
has body: If you have a specific part of a method that you'd like to test in isolation, refactor your class accordingly: Object doSomeStuffAndPossiblyFail() { Object returnObject = null; // do some stuff to set returnObject return returnObject; } Object doSomeStuffAndReportFailureAsNull() { Object returnObject = null; try { returnObject = doSomeStuffAndPossiblyFail(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } .... return returnObject; } You're now free to test that doSomeStuffAndPossiblyFail completes without throwing any exceptions.
score: 0

http://stackoverflow.com/a/23924269
downvote count: 0
has comment: http://stackoverflow.com/comment/36846719
score: 4
has body: This information is not directly available in java. It is going to be OS dependent and to some degree disk volume manager specific. If you are using linux, nmon is a nice tool to use for watching io.
answers question: http://stackoverflow.com/q/23924245
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36846126
accepted answer of: http://stackoverflow.com/q/23924245
type: Answer
upvote count: 4

http://stackoverflow.com/q/23931386
accepted answer: http://stackoverflow.com/a/23935819
downvote count: 0
score: 1
tagged with: java
type: Question
type: AnsweredQuestion
has body: I want to get unique values from mongo db. I have tried a lot but could not found the correct solution. this is how i am fetching values from mongo db. Mongo mongo = new Mongo("localhost", 27017); DB db = mongo.getDB("test"); DBCollection collection = db.getCollection("testCollection"); String hopKey = UUID.randomUUID().toString(); System.out.println("BasicDBObject example..."); BasicDBObject document = new BasicDBObject(); document.put("host", "http://localhost:5050"); document.put("key", hopKey); document.put("appName", "BANK2"); document.put("userId", "xym@gmail.com"); //collection.insert(document); List cursorDoc = collection.distinct("appName"); System.out.println(cursorDoc.get(0).toString()); This is giving me the list size as 2 which is correct. but how can i get all the row values for these 2 unique values. Because i need to use all values of these two unique in jsp file. Please help me.
tagged with: mongodb
upvote count: 1
answer count: 1
favorite count: 0
has title: Distinct values from mongo db?
tagged with: aggregation-framework
has comment: http://stackoverflow.com/comment/36861698
has answer: http://stackoverflow.com/a/23935819

http://stackoverflow.com/comment/36747428
type: AnswerComment
has text: Indeed, i was going to ask if i could do this: ArrayList<Elephant> elephant = new ArrayList<Elephant>(); thank you
type: Comment
comment on: http://stackoverflow.com/a/23873248
score: 0

http://stackoverflow.com/comment/36633156
type: Comment
has text: I'm still getting 404. Am I missing anything in web.xml?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23797831

http://stackoverflow.com/q/23870953
has body: The documentation for java.time.temporal.Temporal contains the following note: Implementation Requirements: [...] All implementations must be Comparable. Why does Temporal not just extend Comparable? Background: I want to work with comparable temporals (not with subtypes like LocalDateTime etc.) and have to resort to a somewhat illegible type &lt;T extends Temporal &amp; Comparable&lt;T&gt;&gt; which also messes up NetBeans' auto-complete feature. Edit: I want to implement a temporal interval. The obvious implementations for contains(Interval i), contains(Temporal t), overlaps(...), adjoins(...) etc. use Comparable::compareTo(Comparable c) to compare the start and end points, but for interoperability (toDuration(), parse(CharSequence cs)) I need e.g. Duration::between(Temporal s, Temporal e) or SubtypeOfTemporal::parse(CharSequence cs) (yielding Temporal).
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23872203
tagged with: java
tagged with: java-time
type: Question
upvote count: 14
has answer: http://stackoverflow.com/a/55504152
possible better answer: http://stackoverflow.com/a/23872203
has comment: http://stackoverflow.com/comment/36743759
has answer: http://stackoverflow.com/a/23910088
accepted answer: http://stackoverflow.com/a/23910088
favorite count: 0
has answer: http://stackoverflow.com/a/23876074
has comment: http://stackoverflow.com/comment/36745546
has title: Why does Temporal not extend Comparable in Java 8 jsr310
has comment: http://stackoverflow.com/comment/36750019
tagged with: java-8
has comment: http://stackoverflow.com/comment/36744756
answer count: 4
score: 14

http://stackoverflow.com/comment/36843583
type: Comment
has text: Thanks! I am trying it but seems that it does not work properly, perhaps the '?' in the 'to'? ` /i/([a-zA-Z]+) /?id=$1#i `
comment on: http://stackoverflow.com/a/23921640
score: 0
type: AnswerComment

http://stackoverflow.com/q/23937578
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/27609909
has body: I have a ScrollView with an embedded RelativeLayout with an embedded LinearLayout. <?xml version="1.0" encoding="utf-8"?> I want to add a context menu for CheckBox objects, which are added dynamically as shown below. private void addItem() { CheckBox ch = new CheckBox(this); ch.setText("Test"); registerForContextMenu(ch); linearLayoutToday.addView(ch); } The issue occurs in the onContextItemSelected method, as the value returned from item.getMenuInfo() is always null. @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); System.out.println(info.targetView); return true; } Does anyone know how to resolve this issue?
favorite count: 0
linked to: http://stackoverflow.com/q/6847430
has comment: http://stackoverflow.com/comment/37459249
type: Question
has title: menuitem.getmenuinfo() returns null for dynamically created views
tagged with: android
has answer: http://stackoverflow.com/a/27609909
tagged with: java
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37419927
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37392390

linux
tags question: http://stackoverflow.com/q/23795010
tags question: http://stackoverflow.com/q/23874055
tags question: http://stackoverflow.com/q/23937682
tags question: http://stackoverflow.com/q/23917705
tags question: http://stackoverflow.com/q/23902603
tags question: http://stackoverflow.com/q/23792625
tags question: http://stackoverflow.com/q/23905265
tags question: http://stackoverflow.com/q/23846205
tags question: http://stackoverflow.com/q/23889529
tags question: http://stackoverflow.com/q/23804497
tags question: http://stackoverflow.com/q/23934094
tags question: http://stackoverflow.com/q/23871516
tags question: http://stackoverflow.com/q/23807012
tags question: http://stackoverflow.com/q/23864472
type: Tag
tags question: http://stackoverflow.com/q/23914411
tags question: http://stackoverflow.com/q/23837493
tags question: http://stackoverflow.com/q/23810555
tags question: http://stackoverflow.com/q/23868933
tags question: http://stackoverflow.com/q/23825247
tags question: http://stackoverflow.com/q/23899910
tag name: linux
tags question: http://stackoverflow.com/q/23851048
tags question: http://stackoverflow.com/q/23913285
tags question: http://stackoverflow.com/q/23792220
tags question: http://stackoverflow.com/q/23802631
tags question: http://stackoverflow.com/q/23873956
tags question: http://stackoverflow.com/q/23930566
tags question: http://stackoverflow.com/q/23827960
tags question: http://stackoverflow.com/q/23846433
tags question: http://stackoverflow.com/q/23812478

http://stackoverflow.com/comment/36720468
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54391/discussion-between-julian-cleary-and-saphire).
type: Comment
comment on: http://stackoverflow.com/a/23858302
score: 0
type: AnswerComment

apache
tag name: apache
tags question: http://stackoverflow.com/q/23930857
tags question: http://stackoverflow.com/q/23783617
tags question: http://stackoverflow.com/q/23818520
tags question: http://stackoverflow.com/q/23853027
tags question: http://stackoverflow.com/q/23887641
tags question: http://stackoverflow.com/q/23783324
tags question: http://stackoverflow.com/q/23881595
tags question: http://stackoverflow.com/q/23865005
tags question: http://stackoverflow.com/q/23869254
tags question: http://stackoverflow.com/q/23797289
tags question: http://stackoverflow.com/q/23912772
tags question: http://stackoverflow.com/q/23826089
tags question: http://stackoverflow.com/q/23835483
tags question: http://stackoverflow.com/q/23875084
type: Tag
tags question: http://stackoverflow.com/q/23878251
tags question: http://stackoverflow.com/q/23828063
tags question: http://stackoverflow.com/q/23865896
tags question: http://stackoverflow.com/q/23824847
tags question: http://stackoverflow.com/q/23864472

http://stackoverflow.com/comment/36854406
type: QuestionComment
has text: @AndreaLigios, i omitted some code just to show the part where I am calling the javascript, which is isn't working :D
comment on: http://stackoverflow.com/q/23929229
score: 0
type: Comment

http://stackoverflow.com/comment/36755302
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23876964
has text: Glad to help, you should accept it to inform future viewers that it works.
score: 0

http://stackoverflow.com/q/23858238
tagged with: java
has comment: http://stackoverflow.com/comment/36719770
type: Question
score: 5
has body: I have a SortedMap&lt;String, SortedMap&lt;String, Integer&gt;&gt;. where each string is a question with possible answers and points attached. How can I use this Map to print questions (first one, second one, ...) by their positions like sampleArray[0]?
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23858302
accepted answer: http://stackoverflow.com/a/23858302
upvote count: 5
has title: How to browse through a SortedMap?
possible better answer: http://stackoverflow.com/a/23858365
has comment: http://stackoverflow.com/comment/36719754
has answer: http://stackoverflow.com/a/23858365
has comment: http://stackoverflow.com/comment/36719735
tagged with: dictionary
has answer: http://stackoverflow.com/a/23858284
has comment: http://stackoverflow.com/comment/36719756
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36719777
downvote count: 0

http://stackoverflow.com/comment/36826382
comment on: http://stackoverflow.com/q/23911857
score: 0
has text: Your value is returned as an array because, as I explained previously, `.values()` returns an array of all values in the map. You have to select one of those values from the array to get just a single value. Check out the `Map` api for more information http://docs.oracle.com/javase/7/docs/api/java/util/Map.html
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36829666
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23915864
has text: @LuiggiMendoza Yes, IMO asymptotically, the operations shall be O(1) if the heap size constant and is not increasing with N. Am I wrong?

http://stackoverflow.com/comment/36845818
has text: If it happens every time maybe you need to reinstall/redownload Eclipse? Could also be an issue with your installed plugins/dev environments.
score: 0
comment on: http://stackoverflow.com/q/23924310
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23782662
favorite count: 0
linked to: http://stackoverflow.com/q/21397331
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23871285
score: 3
accepted answer: http://stackoverflow.com/a/23871285
downvote count: 0
tagged with: java
tagged with: itext
has title: HTML to PDF Conversion of Arabic Text from Itext 5.5 and XMLWorker
has comment: http://stackoverflow.com/comment/36575966
has comment: http://stackoverflow.com/comment/36605495
tagged with: xmlworker
type: Question
upvote count: 3
has body: I am trying to convert an HTML String with arabic Text from Itext 5.5 &amp; XMLWorker. After conversion, Arabic Characters are displayed blank. The Code Snippet used is as follows: public class CreateArabic { public static void main(String args[]) { try { Rectangle pagesize = new Rectangle(8.5f * 72, 11 * 72); Document document = new Document(pagesize, 72, 72, 72, 72); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("c:\\report.pdf")); writer.getAcroForm().setNeedAppearances(true); document.open(); FontFactory.registerDirectories(); Font font = FontFactory.getFont("C:\\damase.ttf", BaseFont.IDENTITY_H, true, 22, Font.BOLD); document.open(); XMLWorkerHelper helper = XMLWorkerHelper.getInstance(); // CSS CSSResolver cssResolver = new StyleAttrCSSResolver(); CssFile cssFile = helper.getCSS(new FileInputStream( "D:\\Itext_Test\\Test\\src\\test.css")); cssResolver.addCss(cssFile); // HTML XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(); fontProvider.getFont("C:\\damase.ttf", BaseFont.IDENTITY_H,BaseFont.EMBEDDED); fontProvider.register("C:\\damase.ttf"); CssAppliers cssAppliers = new CssAppliersImpl(fontProvider); HtmlPipelineContext htmlContext = new HtmlPipelineContext( cssAppliers); htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory()); PdfWriterPipeline pdf = new PdfWriterPipeline(document, writer); HtmlPipeline html = new HtmlPipeline(htmlContext, pdf); CssResolverPipeline css = new CssResolverPipeline(cssResolver, html); XMLWorker worker = new XMLWorker(css, true); XMLParser p = new XMLParser(worker); String htmlString = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;"+"اب"+"&lt;/body&gt;&lt;/html&gt;"; ByteArrayInputStream is = new ByteArrayInputStream(htmlString.getBytes("UTF-8")); p.parse(is, Charset.forName("UTF-8")); document.close(); } catch (Exception ex) { ex.printStackTrace(); } } }
tagged with: http://stackoverflow.com/tag/pdf
tagged with: http://stackoverflow.com/tag/html
answer count: 1

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/23924649
tag name: restful-architecture

http://stackoverflow.com/q/23821483
downvote count: 1
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23821589
has title: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0,,ERROR (SearchSMFController.java:120) Index: 0, Size: 0
type: Question
has body: can anyone solve this, I'M GETTING at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) 2014-05-23 10:33:18,635 [http-8080-1] ERROR (SearchSMFController.java:120) Index: 0, Size: 0 java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(Unknown Source)`` at java.util.ArrayList.get(Unknown Source) at java.util.Collections.swap(Unknown Source) at com.hbc.vp.services.SMFService.getUpdatedBannersList(SMFService.java:609) at com.hbc.vp.services.SMFService.getBannerList(SMFService.java:582) at com.hbc.vp.controllers.SearchSMFController.setUpForm(SearchSMFController.java:113) at line java:120 ==LOGGER.error(exception.getMessage(), exception); at line==Collections.swap(saksBannersList, 0, 1); at line==return getUpdatedBannersList(bannersListModified); at line==smfForm.setBannersLst(smfService.getBannerList());
upvote count: 0
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36649323
type: UnansweredQuestion

http://stackoverflow.com/q/23898406
score: 2
tagged with: device-policy-manager
tagged with: java
has answer: http://stackoverflow.com/a/31035884
tagged with: device-admin
type: Question
upvote count: 4
answer count: 2
has body: I wants to wipe data remotely using my app but currently I am trying to do it manually from app. But When I try to use wipe data method, It shows security Exception. I have tried to force lock and it shows positive results but give exception during wipe data. Please help me. Thanks. This is the stack trace java.lang.SecurityException: No active admin owned by uid 10047 for policy #4 at android.os.Parcel.readException(Parcel.java:1425) at android.os.Parcel.readException(Parcel.java:1379) at android.app.admin.IDevicePolicyManager$Stub$Proxy.wipeData(IDevicePolicyManager.java:1553) at android.app.admin.DevicePolicyManager.wipeData(DevicePolicyManager.java:1082) at com.test.WipeActivity$1.run(WipeActivity.java:54) at java.lang.Thread.run(Thread.java:856)
has answer: http://stackoverflow.com/a/23898474
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: android
has title: java.lang.SecurityException: No active admin owned by uid 10047 for policy #4 on wipe data

http://stackoverflow.com/q/23788838
score: 1
possible better answer: http://stackoverflow.com/a/23788895
has body: Can anyone explain to me why the first thread doesn't work and the second works perfectly: public class Test { public static void main(String args[]) throws InterruptedException { TestThread1 t1 = new TestThread1(); TestThread2 t2 = new TestThread2(); t1.startThread(); t2.start(); Thread.sleep(4000); t1.stopThread(); t2.stopThread(); } } class TestThread1 extends Thread { private volatile TestThread1 thread; public void startThread() { thread = new TestThread1(); thread.start(); } public void run() { while (thread != null) { System.out.println("RUNNING 1 ..."); } } public void stopThread() { thread = null; } } class TestThread2 extends Thread { private volatile boolean finished = false; public void run() { while (!finished) { System.out.println("RUNNING 2 ..."); } } public void stopThread() { finished = true; } } When I debug inside TestThread1 class: Inside startThread, the thread member is filled (so it is not null), inside run, thread member is null!!! And finally, inside stopThread, the thread member is not null!!! Can anyone explain to me what is happening here?
favorite count: 0
has answer: http://stackoverflow.com/a/23789110
has answer: http://stackoverflow.com/a/23788895
has answer: http://stackoverflow.com/a/23789046
has comment: http://stackoverflow.com/comment/36587235
answer count: 5
tagged with: multithreading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36587515
has answer: http://stackoverflow.com/a/23789034
tagged with: java
has title: Safe way to stop Java thread
upvote count: 1
has comment: http://stackoverflow.com/comment/36587337
accepted answer: http://stackoverflow.com/a/23789110
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23789172
linked to: http://stackoverflow.com/q/5946562
has comment: http://stackoverflow.com/comment/36587293

http://stackoverflow.com/comment/36781656
has text: There is still room for improvement. I guess that with generics properly placed you benefit of type inference and avoid the casting on the client. Probably you need to declare your method like `callPrivateTyped[T](...):T` and before returning you can do `method.invoke(obj, parameterValues:_*).asInstanceOf(T)`. Doing so you can change your caller to just invoke `var result:SomeType = callPrivateTyped(....)` (or maybe `var result = callPrivateTyped[SomeType](....)`) - I am not adding this to my answer because generics are a tricky thing to write without testing.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23837052

http://stackoverflow.com/comment/36649800
has text: Also, what's with the unnecessary `* 1` and `/1` in `generateCompNumber()`? And `getUserInputToInteger()` is a pretty misleading name...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23821833

http://stackoverflow.com/q/23874473
tagged with: jvm
tagged with: batch-file
has body: I need help or guidance when running two java programs and trying to read an exit error. This'll be a little hard to explain so please forgive me if I'm not really clear. Let's say that the chain of executing is something like this: bat1.bat is the start, it execute myPGM.jar myPGM.jar calls a 2nd bat: bat2.bat bat2.bat calls an external bat, let's call it: runProcess.bat runProcess.bat calls an external .jar and when it finish, it does echo errorlevel=%errorlevel%. The problem is that the second .jar is failing and: If I run all the chain: bat1.bat -> myPGM.jar -> bat2.bat -> runProcess.bat -> external.jar -> echo... Although the external jar is failing, it always prints 0! If I pause the execution before the runProcess.bat call, open a new cmd window and call it from there.. it prints the error correctly! I'm really stuck with this, and probably don't have the knowledge to see where the problem is :( My guess is that the problem can be related to the two java programs running at the same time?.. maybe the second one is like in another instance of a jvm, and that's why the bat always print errorlevel=0? Or maybe is how I'm calling the .bat? I'm missing a parameter or something like this? Well, reallyy really thanks!
has title: Executing the .jar and printing errorlevel
has comment: http://stackoverflow.com/comment/36779032
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23890068
tagged with: java
has comment: http://stackoverflow.com/comment/36754090
score: 0
answer count: 1

http://stackoverflow.com/a/23930104
answers question: http://stackoverflow.com/q/23929904
type: Answer
has body: select manufacture_data.* from manufacture_data join (select Manufacture_Name, max(Test_id) as maxId from manufacture_data group by Manufacture_Name) as tmp on manufacture_data.Test_id = tmp.maxId
has comment: http://stackoverflow.com/comment/36860556
score: 0

http://stackoverflow.com/q/23805638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36618562
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23805796
score: 0
tagged with: java
has body: I have created BinarySearch Tree and I have a problem inserting key and values. It says NullPointerException. package BST; public class Tree { public Node root = null; public void insert(int key, Object obj) { Entry entry = new Entry(key,obj); if(this.root==null) { this.root = new Node(entry, null); } else { insert(entry,this.root); //error } } public void insert(Entry entry, Node temp) { if(((Entry) temp.getObj()).getKey() &gt; entry.getKey()) //error { if(temp.isLeft()) insert(entry, temp.childLeft()); else temp.addLeft(entry); } else { if(temp.isRight()) insert(entry, temp.childRight()); else temp.addRight(entry); } }//insert public void inorderT() { inorderT(this.root); } private void inorderT(Node t) { if(t.isLeft()) this.inorderT(t.childLeft()); ((Entry)t.getObj()).printEntry(); if(t.isRight()) this.inorderT(t.childRight()); } public void find(int key) { System.out.println("키 값이" + key + " 인 엔트리 출력하기"); find(key,root); } private void find(int key, Node temp) { Entry entry = ((Entry)temp.getObj()); if(entry.getKey()==key) { entry.printEntry(); return; } if(temp.isLeaf()) { System.out.println("찾기 실패"); return; } if(entry.getKey()==key) { find(key, temp.childLeft()); } else { find(key, temp.childRight()); } } } The sentences that say //error is the problem I have. I totally don't know why it's not working BTW, I am so newbie at Java language. So don't blame me if it is a stupid question :)
has comment: http://stackoverflow.com/comment/36618397
has title: BinarySearch Tree
possible better answer: http://stackoverflow.com/a/23805872
has answer: http://stackoverflow.com/a/23805872
linked to: http://stackoverflow.com/q/218384
tagged with: data-structures
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/23805796
has comment: http://stackoverflow.com/comment/36618388

http://stackoverflow.com/comment/36910801
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23826459
has text: without a good handle on your system and some testing I can't tell you exactly what model of this or that to use, but I can tell you what I would do in your situation. I would get 4 new digital frame grabber cards that can hand the camera resolution at 1kHz (or your fastest desired speed) and that have an external hardware signal trigger. and I would hook one up to each camera. I would then trigger the cards through a distribution box so that they all fire at the same time.as long as you can offload data before the buffer fills you'll be ok. also make friends with an EE PhD candidate to help.
type: AnswerComment

http://stackoverflow.com/comment/36672773
has text: you shouldn't have such arrays. you should have one array with instances of student, which have: a number, a name, a course they follow....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23834049
score: 3

http://stackoverflow.com/q/23791921
has answer: http://stackoverflow.com/a/23801669
accepted answer: http://stackoverflow.com/a/23801669
has answer: http://stackoverflow.com/a/39973571
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I have a Jenkins Job that runs SonarRunner on a Maven project composed of several modules. The build fails when I configure SonarRunner to import Cobertura coverage reports. SonarQube Runner 2.4 Java 1.7.0_55 Oracle Corporation (64-bit) Windows 7 6.1 amd64 INFO: Error stacktraces are turned on. INFO: Runner configuration file: C:\Jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\Sonar_Runner\conf\sonar-runner.properties INFO: Project configuration file: NONE INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent) INFO: Work directory: C:\Jenkins\workspace\Sprint3\Application\.sonar INFO: SonarQube Server 4.3 11:07:44.407 INFO - Load batch settings 11:07:44.609 INFO - User cache: C:\.sonar\cache 11:07:44.625 INFO - Install plugins 11:07:44.765 INFO - Install JDBC driver 11:07:44.781 WARN - H2 database should be used for evaluation purpose only 11:07:44.781 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar 11:07:45.951 INFO - Initializing Hibernate 11:07:47.885 INFO - Load project settings 11:07:47.963 INFO - Apply project exclusions 11:07:48.229 INFO - ------------- Scan JmsUtils 11:07:48.229 INFO - Load module settings 11:07:49.508 INFO - Loading technical debt model... 11:07:49.523 INFO - Loading technical debt model done: 15 ms 11:07:49.523 INFO - Loading rules... 11:07:49.789 INFO - Loading rules done: 266 ms 11:07:49.804 INFO - Configure Maven plugins 11:07:49.976 INFO - Compare to previous analysis (2014-05-21) 11:07:50.007 INFO - Compare over 30 days (2014-04-21, analysis of 2014-05-08 15:55:35.699) 11:07:50.007 INFO - No quality gate is configured. 11:07:50.147 INFO - Base dir: C:\Jenkins\workspace\Sprint3\Application\JmsUtils 11:07:50.147 INFO - Working dir: C:\Jenkins\workspace\Sprint3\Application\.sonar\WSM_Application_JmsUtils 11:07:50.147 INFO - Source dirs: C:\Jenkins\workspace\Sprint3\Application\JmsUtils\src\main\java 11:07:50.147 INFO - Test dirs: C:\Jenkins\workspace\Sprint3\Applica…
tagged with: sonarqube
type: Question
score: 5
has title: org.sonar.api.utils.SonarException: Can not add twice the same measure on org.sonar.api.resources.File
has answer: http://stackoverflow.com/a/41105653
tagged with: jacoco
possible better answer: http://stackoverflow.com/a/39973571
favorite count: 0
answer count: 3
tagged with: cobertura
upvote count: 5
tagged with: jenkins

http://stackoverflow.com/q/23857686
tagged with: android
has comment: http://stackoverflow.com/comment/36718530
tagged with: constructor
has comment: http://stackoverflow.com/comment/36719668
has comment: http://stackoverflow.com/comment/36719497
has body: I read in a java book that in order to access a method ect in one class, an object needs to be created using a constructor. Below is an example... Class1 Class2 MyObject = new Class2(); MyObject.methodCall(); Class2 methodCall(){ } Now I'm currently making an android app, and I used the above method, and I got errors, i then read a blog which gave an alternative way to access methods ect from other classes. Class1 Class2 myObject; myObject.myMethod(); Class2 myMethod(){ } How does the above way work without the new *InsertClassName*(); Edit public class ButtonClickListener implements OnClickListener{ VerificationMethods VM; VM.authenticateForFunctionsandNumbers(); } public class VerificationMethods { ButtonClickListener BCL; public boolean authenticateForFunctionsandNumbers(){ return trueOrFalse; } } Logcat: 05-25 17:19:02.195: E/AndroidRuntime(718): FATAL EXCEPTION: main 05-25 17:19:02.195: E/AndroidRuntime(718): java.lang.StackOverflowError 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.ButtonClickListener.&lt;init&gt;(ButtonClickListener.java:41) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.VerificationMethods.&lt;init&gt;(VerificationMethods.java:5) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.ButtonClickListener.&lt;init&gt;(ButtonClickListener.java:41) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.VerificationMethods.&lt;init&gt;(VerificationMethods.java:5) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.ButtonClickListener.&lt;init&gt;(ButtonClickListener.java:41) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.VerificationMethods.&lt;init&gt;(VerificationMethods.java:5) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.ButtonClickListener.&lt;init&gt;(ButtonClickListener.java:41) 05-25 17:19:02.195: E/AndroidRuntime(718): at com.example.myfirstcalculator.Veri…
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/36719697
possible better answer: http://stackoverflow.com/a/23857735
tagged with: java
has comment: http://stackoverflow.com/comment/36718501
has answer: http://stackoverflow.com/a/23857735
has comment: http://stackoverflow.com/comment/36718620
tagged with: class
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36718840
has answer: http://stackoverflow.com/a/23857812
has comment: http://stackoverflow.com/comment/36718548
has answer: http://stackoverflow.com/a/23857746
has comment: http://stackoverflow.com/comment/36718609
accepted answer: http://stackoverflow.com/a/23857812
has title: Accessing objects in other classes
has comment: http://stackoverflow.com/comment/36719972
answer count: 3

http://stackoverflow.com/a/76365028
has body: I had the same problem under java 8 and I simply changed the version of jacoco from 0.7.9 to 0.8.2
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23923443

torrent
tags question: http://stackoverflow.com/q/23901428
tag name: torrent
type: Tag

http://stackoverflow.com/comment/36682371
comment on: http://stackoverflow.com/q/23838886
score: 0
type: QuestionComment
type: Comment
has text: No. My bad i didn't mean to put that

http://stackoverflow.com/q/23853585
upvote count: 2
has answer: http://stackoverflow.com/a/23853673
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
has title: How can I change the fragment's content on slide in ViewPager?
accepted answer: http://stackoverflow.com/a/23853673
tagged with: android-viewpager
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-activity
score: 2
has body: I have implemented THIS in my activity and it works perfectly fine, but I would like to change the content of my fragment every time when the user slides a finger on the screen. Now it shows the same text not considering the slide(left to right or right to left). How can I handle it? I know that I'm missing an extremely small part here, but I'm not able to understand what is going on. Where should I add the listener and handle the actions? Here is what I have so far: public class ViewrerAct extends FragmentActivity { private static final int NUM_PAGES = 5; private ViewPager mPager; private PagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_screen_slide); // Instantiate a ViewPager and a PagerAdapter. mPager = (ViewPager) findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.bulgarian_sayings, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.fragment_viewer, container, false); return rootView; } } private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePa…

http://stackoverflow.com/comment/36817061
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23894439
type: AnswerComment
has text: Fixed the alignment issues by binding the `prefWidth` property of the textfields to the `width` property of the corresponding column headers + reflowing the layout whenever the columns order change. Found a new issue: If you click on the column header (sort) while in edit mode, you'll get a NPE when you commit later...

http://stackoverflow.com/q/23829083
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36663597
upvote count: 0
has comment: http://stackoverflow.com/comment/36663262
favorite count: 0
type: Question
has title: how to draw a specific image which van move on screen?
score: -2
has body: Actually i am making a game. but i am stuck in drawing image e.g i want to draw a spider which should continuously move up and down on screen. i am using graphics class with square and oval class. but when it comes to draw spider on square or oval instead of fillRect or fillOval i don't pass. here is what iam doing again and again public void draw(Graphics surface) { // Draw the object surface.setColor(color); try{ File f = new File( "C:\\Users\\kk\\Desktop\\7.gif"); BufferedImage img = ImageIO.read(f); // surface.drawImage(img,0,0,1360,740,null); surface.drawImage(img, 7, 1,null ); } catch( Exception e ) {} //surface.fillRect(x - size/2, y - size/2, size, size);
downvote count: 2
has answer: http://stackoverflow.com/a/23829281
answer count: 1
tagged with: java

http://stackoverflow.com/a/23876015
has body: Integer i = multiply(2, 2).add(5); System.out.print(i); here when you do multiply(2, 2) it returns an integer and using that return type Integer, you are trying to call `add() method. but add() method is not available inside Integer class with whatever the signature and intended you are trying to do. so it complains like add() is not available inside Integer class. so to achieve it make multiple(2,2) to return your own class and have a result in it. and then call that add() method using that object easily in the way you want. The way how you could achive the same is like below package com.kb; public class MultipleMethodCalls { int result; static MultipleMethodCalls m = new MultipleMethodCalls(); public static void main(String[] args) { System.out.println(m.multiply(2, 2).add(3)); } public MultipleMethodCalls multiply(Integer n1, Integer n2){ m.result= n1 * n2; return m; } //I know this is wrong but I don't know what params to put public Integer add(Integer n1){ return this.result + n1; } }
score: 0
answers question: http://stackoverflow.com/q/23875575
type: Answer

http://stackoverflow.com/q/23812642
type: Question
tagged with: jakarta-ee
score: 3
tagged with: jndi
tagged with: java
has comment: http://stackoverflow.com/comment/36677085
has answer: http://stackoverflow.com/a/23829649
has answer: http://stackoverflow.com/a/23867940
tagged with: websphere-7
tagged with: websphere
accepted answer: http://stackoverflow.com/a/23851683
has body: My code is unable to do lookup a JDBC resource using JNDI. I am getting the following exception: [Root exception is javax.naming.NameNotFoundException: Context: ppp-14415Node01Cell/nodes/ppp-14415Node01/servers/server1, name: jdbc/admincob: First component in name admincob not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]] I have followed these 2 solution on SO, but still its not working Websphere 6.1 to 7 how to update ibm-web-bnd.xmi to ibm-web-bnd.xml How do I connect to a Websphere Datasource with a given JNDI name? Here is my ibm-web-bnd.xml <virtual-host name="default_host" /> and portion of web.xml Datasource connection to db jdbc/dbcob javax.sql.DataSource Container Shareable Here is the screenshot of the binding: Lookup code: Context initialContext = new InitialContext(); DataSource datasource = (DataSource) initialContext .lookup("java:comp/env/jdbc/dbcob"); if (datasource != null) { result = datasource.getConnection(); System.out.println("Data connection retrieved"); result.close(); } else { System.err.println("Failed to lookup datasource."); } I am not sure what am I missing. Please help.
downvote count: 0
has comment: http://stackoverflow.com/comment/36663132
favorite count: 0
linked to: http://stackoverflow.com/q/4628915
has comment: http://stackoverflow.com/comment/36648124
answer count: 4
type: AnsweredQuestion
has title: JNDI - JDBC resource lookup failes in WAS 7
linked to: http://stackoverflow.com/q/7167212
upvote count: 3
has answer: http://stackoverflow.com/a/23851683
has comment: http://stackoverflow.com/comment/36670675
possible better answer: http://stackoverflow.com/a/23835771
has answer: http://stackoverflow.com/a/23835771

http://stackoverflow.com/comment/36608987
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23799450
score: 0
has text: use loader balancer for manage http request, and handle them by java or nodejs. Or a litle simple solution use different ports. For sharing session please see article https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

http://stackoverflow.com/comment/36638953
type: AnswerComment
comment on: http://stackoverflow.com/a/23815599
type: Comment
has text: That could at least print out the formula if you had it in String format. If you want to actually print the value of the volume then I think you've oversimplified the issue. At that point you'll want to look at an interface for geometrical shapes and multiple implementations of that interface to calculate the volume.
score: 0

http://stackoverflow.com/q/23834934
tagged with: nio
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23838355
tagged with: exception
tagged with: sockets
has comment: http://stackoverflow.com/comment/36681868
type: AnsweredQuestion
has title: Broken pipe on TCP socket read
tagged with: tcp
tagged with: java
accepted answer: http://stackoverflow.com/a/23838355
type: Question
has body: I have an application in Java that opens a TCP server socket and then reads and writes from this socket. I'm running into a problem where the server is getting a IOException with the message "Broken pipe" on a read. I have a good understanding of why this would happen on a write, but I can't figure out why it would happen on a read. For reference, this is the top part of the stack trace Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198) at sun.nio.ch.IOUtil.read(IOUtil.java:166) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:243) I'm assuming what must be happening is that the OS giving an EPIPE error, but I can't find the code where that would happen. I've looked through the JDK source code (Java and C source) for the text 'Broken pipe' and I can't find the piece of code that is actually generating this exception. Ultimately the question I'm trying to answer is why this is happening, but I would also accept an answer that simply explains where this error is even generated.

http://stackoverflow.com/a/23821298
score: 0
answers question: http://stackoverflow.com/q/23812711
has body: try this one...it's work fine.. @Override public String execute() { HttpServletRequest request=(HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST); logger.info("username" + request.getParameter("uname")); logger.info("uname" + getUname());// getting null value if (uname != null) { return SUCCESS; } else { return ERROR; } } before initialize logger file private static Logger logger = Logger.getLogger(UserRegistrationDAO.class);//Getter and Setter Method.
type: Answer

http://stackoverflow.com/comment/36651291
has text: Which line is line 51 in BaseActivity?
score: 1
comment on: http://stackoverflow.com/q/23822507
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36867755
score: 0
type: Comment
has text: forgot it. It just seperator. I was trying to write only s.
type: AnswerComment
comment on: http://stackoverflow.com/a/23934583

http://stackoverflow.com/a/23792355
upvote count: 3
has body: Add Assert.fail() below your log.error(e): catch (Exception e) { log.error(e); Assert.fail(); } By the way, you're calling Logger#error(Object), which uses e.toString(). In this case, it is better to use a descriptive message and then pass the exception to get the respective stacktrace: catch (Exception e) { log.error("Some descriptive message should go here.", e); Assert.fail("Some descriptive message should go here as well."); }
has comment: http://stackoverflow.com/comment/36682214
score: 3
has comment: http://stackoverflow.com/comment/36690790
has comment: http://stackoverflow.com/comment/36692064
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36682522
accepted answer of: http://stackoverflow.com/q/23792336
type: Answer
answers question: http://stackoverflow.com/q/23792336

http://stackoverflow.com/comment/36802928
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23899867
type: Comment
has text: Then just use Theme.Holo.Dark instead

http://stackoverflow.com/a/23910842
has comment: http://stackoverflow.com/comment/36819480
has body: I ran into exactly the the same problem upgrading from 1.4.3 with hibernate 4.3.5. My repository interfaces extend PagingAndSortingRepository. I found the below line in Spring data change log for 1.6.0: Can't use pagination (Pageable) with @IdClass entities (spring-data-jpa 1.4.3 &amp; Hibernate 4.1.9). (DATAJPA-472) (source: http://docs.spring.io/spring-data/jpa/docs/1.6.0.RELEASE/changelog.txt) Replaced PagingAndSortingRepository with JpaRespository and seems to work fine.
answers question: http://stackoverflow.com/q/23827144
has comment: http://stackoverflow.com/comment/36828733
score: 0
type: Answer

http://stackoverflow.com/comment/36811356
has text: Agreed. As I understood it (from a post that I cannot find anymore) a new socketfactory (of the custom class) is created that performs the comparison. Seems somewhat dubious.
comment on: http://stackoverflow.com/q/23898970
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36781805
has text: why does B has to be abstract? When you want to avoid instantiating it make it `protected`
comment on: http://stackoverflow.com/q/23891087
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23826171
accepted answer: http://stackoverflow.com/a/23826357
downvote count: 0
has title: ProGuard for Android and GSON
possible better answer: http://stackoverflow.com/a/61481954
tagged with: java
has answer: http://stackoverflow.com/a/43324708
tagged with: gson
has answer: http://stackoverflow.com/a/61481954
has answer: http://stackoverflow.com/a/57159734
type: Question
upvote count: 57
tagged with: configuration
has body: I'm setting up ProGuard for my Android project. My project also uses GSON. I've researched ProGuard configurations for compatibility with GSON and Android and came across this example offered by google-gson https://code.google.com/p/google-gson/source/browse/trunk/examples/android-proguard-example/proguard.cfg. ProGuard config copied below: ##---------------Begin: proguard configuration common for all Android apps ---------- -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -allowaccessmodification -keepattributes *Annotation* -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable -repackageclasses '' -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -dontnote com.android.vending.licensing.ILicensingService # Explicitly preserve all serialization members. The Serializable interface # is only a marker interface, so it wouldn't save them. -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); } # Preserve all native method names and the names of their classes. -keepclasseswithmembernames class * {…
has answer: http://stackoverflow.com/a/62133361
tagged with: proguard
favorite count: 0
score: 57
answer count: 5
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23826357

http://stackoverflow.com/q/23783365
type: Question
downvote count: 4
upvote count: 0
answer count: 1
favorite count: 0
tagged with: arraylist
has body: i got 4 threads running and ech run increases the size of a global arraylist.But i cant access the resulting arraylist after the threads are finished. Is there a way to get access to the resulting arraylist..or how does it work with threads and resutling datastructures?? List&lt;MyObject&gt; head = a.subList(0, 2000); List&lt;MyObject&gt; body = a.subList(2001, 5000); List&lt;MyObject&gt; body2 = a.subList(5001, 8000); List&lt;MyObject&gt; tail = a.subList(8001, a.size()); //System.out.println(tail.size()); createAndRunFirst(head); createAndRunFirst(body); these are the calls and this is the method which is called 4 times..and i need the currCDO arrylist public void algo(List&lt;MyObject&gt;list){ MyObject a = null; MyObject b = null; int e=0; String curr1=""; String curr2=""; for (int i = 0; i &lt; list.size(); i++) { a =list.get(i); curr1= a.getStreetName(); if(curr1.contains("-")){ curr1=curr1.replace("-", " "); } if(curr1.contains("STRASSE")){ curr1=curr1.replace("STRASSE", "STR."); } else{ curr1=a.getStreetName(); } for (int j = 0; j &lt; lotse.size(); j++) { b = lotse.get(j); curr2=b.getStreetName(); if(curr2.contains("-")){ curr2=curr2.replace("-", " "); } if(curr2.contains("STRASSE")){ curr2=curr2.replace("STRASSE", "STR."); } else{ curr2=b.getStreetName(); } int d = dL.execute(curr1,curr2); if(curr1.length()==curr2.length()){ e=0; } if(curr1.length()&lt; curr2.length()){ e=(curr2.length()*30)/100; //System.out.println(d); } if(curr1.length()&gt; curr2.length()){ e=(curr1.length()*30)/100; //System.out.println(d); } if(d&lt;e &amp;&amp; a.getPcode().contains(b.getPcode())){ int x=a.getInstituteName().length(); int y=b.getInstituteName().length(); if(x&lt;y){ currCDO.add(a); } if(y&lt;x){ currCDO.add(a); if(x==y){ currCDO.add(a); } break;}else{ //System.out.println(a.getInstituteName()+"******"); restCDO.add(a); } }//System.out.println(currCDO.size() +"*****"); } } } public void createAndRunFirst(final List&lt;CrawlerDataObject&gt; list) { Thread thread = new…
has title: How to access an arraylist after 4 threads are finished
has comment: http://stackoverflow.com/comment/36580375
has comment: http://stackoverflow.com/comment/36577021
has comment: http://stackoverflow.com/comment/36580560
type: UnansweredQuestion
tagged with: multithreading
score: -4
has answer: http://stackoverflow.com/a/23796839
tagged with: java

http://stackoverflow.com/comment/36825371
comment on: http://stackoverflow.com/q/23835814
score: 0
type: Comment
type: QuestionComment
has text: It's probably not the same issue, but at one point I had a similar problem - a connection would work with one JDK but not another. The issue was somehow caused by the default HTTP handler. Maybe try creating the URL and specifying a handler? Something like this `URL url = new URL(null,m_url, new sun.net.www.protocol.http.Handler()); `

http://stackoverflow.com/comment/43404763
score: 0
type: Comment
has text: I'm using Eclipse SDK Version: Luna SR2 (4.4.2) Build id: M20141210-0900 and this has been fixed.
comment on: http://stackoverflow.com/a/23837957
type: AnswerComment

http://stackoverflow.com/a/23852407
accepted answer of: http://stackoverflow.com/q/23829219
has comment: http://stackoverflow.com/comment/36709626
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23829219
has body: In anonymous block you've to set the size of text field. JButton btnChangeWidth = new JButton("Change width"); btnChangeWidth.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { textField.setSize(x, y); } }); don't forget to add the button on container.. for more reference you can visit here http://cshotopics.blogspot.in/2014/05/how-to-change-width-of-textfield.html
type: Answer

http://stackoverflow.com/a/23933393
has comment: http://stackoverflow.com/comment/36863845
accepted answer of: http://stackoverflow.com/q/23933083
score: 0
has comment: http://stackoverflow.com/comment/38248757
answers question: http://stackoverflow.com/q/23933083
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36864581
has comment: http://stackoverflow.com/comment/36863199
has comment: http://stackoverflow.com/comment/36861949
has comment: http://stackoverflow.com/comment/36864339
has body: There is no "read-state" or "write-state" of the Buffer. If the buffer supports it, it can be read and write at the same time. The flip() method simply: "The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded." There is no internal flip state to be changed here. If you have a prepared buffer holding a thousand bytes, you can read a byte, then write a byte which will overwrite the 2nd...
upvote count: 2
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36866829

http://stackoverflow.com/comment/36943916
has text: I come from C/C++ background. Enums are normally just integers. I presumed int values are not custom behavior, that's why I'm asking the question here. If java compiler inserted methods to get declared enum values, I don't see how far off my presumption is. It's even better than C/C++, because C/C++ does not even provide any implicit methods for enums.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23926329

http://stackoverflow.com/comment/36869757
type: QuestionComment
has text: Ya got it. I had put the println() outside the for loop.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23937473

http://stackoverflow.com/q/23923345
tagged with: jtable
possible better answer: http://stackoverflow.com/a/23923397
favorite count: 0
accepted answer: http://stackoverflow.com/a/23945732
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mask
has body: I have a JTable which the user will be able to add, edit, and remove cells (all of this without extra components besides the JTable). I want to set a custom mask (similar to JFormattedTextField) for all the cells in a specific column. Example: The JTable has 2 columns: Time and Description. All the cells from the Time column have HH:MM mask, and the cells from the Description column don't have mask. How can I achieve this? Thanks.
type: Question
tagged with: cell
answer count: 2
linked to: http://stackoverflow.com/q/15953422
has answer: http://stackoverflow.com/a/23945732
has answer: http://stackoverflow.com/a/23923397
downvote count: 0
has title: JTable - How to set text mask for cells in a specific column?
linked to: http://stackoverflow.com/q/22015273

http://stackoverflow.com/q/23831870
type: Question
has comment: http://stackoverflow.com/comment/36676174
tagged with: spring
has title: Injecting a bean in a Security Filter (Spring)
upvote count: 2
tagged with: java
tagged with: dependency-injection
answer count: 0
type: UnansweredQuestion
score: 2
tagged with: spring-bean
has body: Before the login, I added a filter that checks if a the computer name is registered in the database. For this, I inject a repository in the filter. The problem is that it marks the bean as null, and I read the filter and the bean are in different contexts. How can I inject the bean in the filter? This is the bean injection @Qualifier("simpleRepo") @Autowired private SimpleRepo simpleRepo; And this is the method where I wanna use the methods of the repository @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; response.setContentType("text/html"); String computerName = null; String remoteAddress = request.getRemoteAddr(); try { InetAddress inetAddress = InetAddress.getByName(remoteAddress); computerName = inetAddress.getHostName(); if (computerName.equalsIgnoreCase("localhost")) { computerName = java.net.InetAddress.getLocalHost().getCanonicalHostName(); } } catch (UnknownHostException e) { } Response response_query = new Response(); System.out.println("computerName: " + computerName); response_query = simpleRepo.isARegisteredMachine(computerName); System.out.println(response_query.getStatus()); //httpServletResponse.sendRedirect("/signin"); chain.doFilter(request, response); }
downvote count: 0
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/a/23877689
has comment: http://stackoverflow.com/comment/36936106
type: Answer
answers question: http://stackoverflow.com/q/23859039
has body: You are creating timeSinceCollision every time with value of 0 thats why it never increase. Take a look at my function. the If condition will be true every 4 seconds. final float TIME_SINCE_COLLISION = 4; float timeSinceCollision = 0; public void update(float delta) { timeSinceCollision += delta; if (timeSinceCollision &gt;= TIME_SINCE_COLLISION) { timeSinceCollision -= TIME_SINCE_COLLISION; // Do something after 4 seconds. Gdx.app.log("Do something", ""); } }
score: 0

http://stackoverflow.com/comment/36778319
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23877236
score: 0
has text: Thanks all. The problem was solved when I changed the name of the table "Order" to "Custom". I think this word "Order" is reserved or what?

http://stackoverflow.com/a/23877976
answers question: http://stackoverflow.com/q/23877907
downvote count: 0
score: 1
has body: I ran your code, and it is actually working. You just have to change all of the length calls to just length (i.e remove length() and length[]) Other than that the code is functional. When run you get this output: 1 1 2 4 4 5 6 7 8
upvote count: 1
type: Answer

http://stackoverflow.com/comment/36714012
type: QuestionComment
comment on: http://stackoverflow.com/q/23855156
score: 0
has text: Oh sorry, i dont know why i though you are looking for android cdi
type: Comment

http://stackoverflow.com/q/23914411
score: 0
tagged with: linux
tagged with: windows
has answer: http://stackoverflow.com/a/23914547
type: UnansweredQuestion
tagged with: java
type: Question
has title: connect to linux machine from windows via java Runtime.getRuntime().exec
answer count: 1
has body: Hi I want to connect to linux machine from windows via java. I was searching via internet and fide code like: public void testExec() throws IOException, InterruptedException{ Process p = Runtime.getRuntime().exec("ssh myhost"); PrintStream out = new PrintStream(p.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); out.println("ls -l /home/me"); while (in.ready()) { String s = in.readLine(); System.out.println(s); } out.println("exit"); p.waitFor(); } But i can't understand how set my login and passsword. Does anybody trying such way to connect to linux, is it correct?

http://stackoverflow.com/q/23858490
tagged with: linkedin-api
has comment: http://stackoverflow.com/comment/36720294
type: Question
accepted answer: http://stackoverflow.com/a/25444453
has title: linkedin-j exception Access to people search denied
has body: Could you help me, plese? I have some trouble. I want to search people in LinkedIn. But i get exception: com.google.code.linkedinapi.client.LinkedInApiClientException: Access to people search denied. at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.createLinkedInApiC‌​lientException(BaseLinkedInApiClient.java:3906) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(Base‌​LinkedInApiClient.java:3781) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(Base‌​LinkedInApiClient.java:3725) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.searchPeople(BaseL‌​inkedInApiClient.java:1184) at test2.TestLink.main(TestLink.java:141) What was my mistake? This is piece of my code. final LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(linkedinKey,linkedinSecret); final LinkedInApiClient client = factory.createLinkedInApiClient(accessToken); People people = client.searchPeople();
score: 0
has comment: http://stackoverflow.com/comment/36720522
has comment: http://stackoverflow.com/comment/36720334
has comment: http://stackoverflow.com/comment/36720437
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25444453
tagged with: linkedin-j
type: AnsweredQuestion

http://stackoverflow.com/comment/56723475
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23867628
score: 0
has text: I am also facing this issue with unsupported keytype (18). How did you use unlimited strength JCE policy by Java. Can you please elaborate in detail.

http://stackoverflow.com/comment/36654328
type: Comment
comment on: http://stackoverflow.com/a/23823988
has text: Okay what should i try: `db.runCommand({shardcollection:"flights.flight",key:{departureAirport:1,arrivalAirport:1,departureDate:1,availability:1,flightClass:1,fareType:1}})` or `db.runCommand({shardcollection:"flights.flight",key:{departureAirport:1,arrivalAirport:1,departureDate:1,availability:1}})`
type: AnswerComment
score: 0

http://stackoverflow.com/q/23921678
answer count: 2
has answer: http://stackoverflow.com/a/23921735
tagged with: variables
has comment: http://stackoverflow.com/comment/36840702
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/23921701
has title: How is my final array being modified?
type: AnsweredQuestion
downvote count: 0
tagged with: final
has comment: http://stackoverflow.com/comment/36840416
linked to: http://stackoverflow.com/q/22949718
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36840629
accepted answer: http://stackoverflow.com/a/23921735
possible better answer: http://stackoverflow.com/a/23921701
tagged with: java
has body: I have something similar to this: (SomeClass) public static final float[][][] values = {...}; public float[][][] variable = values; So, I create a new instance of this class and pass the values to a public member of this class, like I did up there. Thing is, when I work with variable now and change it and stuff, it gets changed for all instances of SomeClass. final cant be modified after declaration I thought? So why isn't variable more like a copy of values but gets modified like a static but not final variable?
tagged with: class
upvote count: 3

http://stackoverflow.com/a/23814952
has comment: http://stackoverflow.com/comment/36649580
has comment: http://stackoverflow.com/comment/36657627
has comment: http://stackoverflow.com/comment/36649881
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36650614
has comment: http://stackoverflow.com/comment/36651044
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23808368
has comment: http://stackoverflow.com/comment/36657691
has comment: http://stackoverflow.com/comment/36660326
has comment: http://stackoverflow.com/comment/36649845
has body: First of all I don't understand why you don't want servlets since it's much clearer and more beautiful code. They are also perfect for this situation. This has nothing to do with the question but for making your life easier. If you are using scriptlets which are mostly just disturbing to read I advice you to put the scriptlet tag instead for the readability of the code, e.g. &lt;jsp:scriptlet&gt; String param1 = request.getParameter("p1"); String param2 = request.getParameter("p2"); HttpSession session1 = request.getSession(true); session1.setAttribute("p1", param1); session1.setAttribute("p2", param2); response.sendRedirect("intermediateTarget.jsp"); &lt;/jsp:scriptlet&gt; Now to what I believe is your problem since it wasn't very clear what you wanted. You are actually storing your variables in the session (which you want to do), but you are accessing them from the request? For session scoped variables you should call: String param2 = (String)request.getSession(false).getParameter("p2"); // or session1.getParameter("p2"); // if you add false where you create the variable. You want to use the false paramenter in getSession because the user must have a session if he/she is logged in and you want to redirect them with a filter instead of creating a new session I assume. I would prefer to write it like this though &lt;c:choose&gt; &lt;c:when test="${not empty param}"&gt; &lt;c:redirect url="empLogin.jsp"/&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;c:redirect url="target.jsp"/&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; Hope it answered your question, feel free to comment if I misunderstood your question :)
has comment: http://stackoverflow.com/comment/36657436
accepted answer of: http://stackoverflow.com/q/23808368
has comment: http://stackoverflow.com/comment/36657313

http://stackoverflow.com/q/23833924
favorite count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: coldfusion-10
has answer: http://stackoverflow.com/a/23835057
has answer: http://stackoverflow.com/a/23872704
tagged with: coldfusion
tagged with: java
has comment: http://stackoverflow.com/comment/36731216
type: Question
answer count: 2
has body: We are using coldfusion 10 server for web applications. it has many sites which were working fine but suddenly one site goes down just after the coldfusion server reboots and displays the message The service is unavailable. Service Temporary Unavailable! The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Jakarta/ISAPI/isapi_redirector/1.2.32 () I have checked the system error log and i found the following messages there 2014 8:23:10 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@7870cbee]) and a value of type [coldfusion.runtime.RequestInfo] (value [coldfusion.runtime.RequestInfo@41542d45]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. May 23, 2014 8:23:10 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/] created a ThreadLocal with key of type [coldfusion.util.DateUtils$1] (value [coldfusion.util.DateUtils$1@4bc7650c]) and a value of type [java.util.GregorianCalendar] (value [java.util.GregorianCalendar[time=450000000,areFieldsSet=true,areAllFieldsSet=false,lenient=false,zone=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=?,MONTH=?,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=?,DAY_OF_YEAR=?,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=?,AM_PM=?,HOUR=?,HOUR_OF_DAY=?,MINUTE=?,SECOND=?,MILLISECO…
downvote count: 0
has title: Coldfusion server is working fine but one site goes down just around two minutes
score: 3
has comment: http://stackoverflow.com/comment/36676423

http://stackoverflow.com/comment/36643886
has text: @Ordous Yes, StringBuilder would be better, but I was giving you the simplest thing I could think if as a starting point.
type: Comment
comment on: http://stackoverflow.com/a/23818403
type: AnswerComment
score: 0

jsf-2
tags question: http://stackoverflow.com/q/23859158
type: Tag
tags question: http://stackoverflow.com/q/23907061
tags question: http://stackoverflow.com/q/23907369
tags question: http://stackoverflow.com/q/23798358
tags question: http://stackoverflow.com/q/23924344
tags question: http://stackoverflow.com/q/23787319
tags question: http://stackoverflow.com/q/23791680
tags question: http://stackoverflow.com/q/23797850
tag name: jsf-2
tags question: http://stackoverflow.com/q/23779109
tags question: http://stackoverflow.com/q/23912741
tags question: http://stackoverflow.com/q/23936733
tags question: http://stackoverflow.com/q/23792831
tags question: http://stackoverflow.com/q/23935248
tags question: http://stackoverflow.com/q/23800647
tags question: http://stackoverflow.com/q/23934605
tags question: http://stackoverflow.com/q/23851416
tags question: http://stackoverflow.com/q/23930978
tags question: http://stackoverflow.com/q/23833059
tags question: http://stackoverflow.com/q/23878113
tags question: http://stackoverflow.com/q/23780474
tags question: http://stackoverflow.com/q/23866979

http://stackoverflow.com/comment/36712340
has text: So the main question is how to listen for a keypress? Btw your class GestioneCampane doesnt need to extend Thread
score: 0
comment on: http://stackoverflow.com/q/23854348
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36625967
score: 0
comment on: http://stackoverflow.com/a/23807627
type: Comment
has text: I don't have logging at all. I just want to stop Spring writing to the console.
type: AnswerComment

http://stackoverflow.com/comment/36864924
score: 1
has text: Then your might want to change or remove annotation through reflection http://stackoverflow.com/questions/14268981/modify-a-class-definitions-annotation-string-parameter-at-runtime/14276270#14276270
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23925797

http://stackoverflow.com/q/23817071
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36640845
accepted answer: http://stackoverflow.com/a/23817165
type: Question
linked to: http://stackoverflow.com/q/810839
has comment: http://stackoverflow.com/comment/36640914
possible better answer: http://stackoverflow.com/a/23817160
upvote count: 5
has body: While working on a course (as in, school courses) database system for a school project, I stumbled upon an issue of debate. I have a class called Course. Here is a constructor (the other one is a blank constructor that assigns default values) for the class: public Course(String name, String code, char level, int academicYear) { serialNumber = nextSerialNumber++; if (name == null) { throw new NullPointerException("Name can not be null."); } else { this.name = name; } if (code == null) { throw new NullPointerException("Code can not be null."); } else { this.code = code; } if (indexOf(level, VALID_LEVEL) == -1) { throw new InvalidLevelException("Level must be one of " + "characters defined in the public array in Course."); } else { this.level = level; } if (String.valueOf(academicYear).length() != NUMBER_OF_DIGITS_IN_YEAR) { throw new InvalidYearException("Year must be a four digit number!"); } else { this.academicYear = academicYear; } } Where InvalidLevelException and InvalidYearException are custom exceptions that are subclasses of RuntimeException I throw exceptions from that constructor to indicate if anything has gone wrong. For example, if, while reading from the data file, I encounter bad data, I can reject it and write it to a log (as the project mandates), simply by putting that constructor in a try-catch block and then catching those exceptions, and inside that catch block, log the bad data. After showing this code to my teacher, he said it is inappropriate to throw exceptions from the constructor. However, I have read numerous Stackoverflow posts in which this practice is encouraged. My question is: Is it okay to throw exceptions from the above constructor? Reputable sources (for example, official documents or authoritative books) attached with an answer would be greatly appreciated. Thanks very much in advance.
has answer: http://stackoverflow.com/a/23817160
has comment: http://stackoverflow.com/comment/36641035
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/36641021
has title: Is it okay to throw exceptions from the constructor in this case?
has comment: http://stackoverflow.com/comment/36640827
has answer: http://stackoverflow.com/a/23817165
favorite count: 0
has comment: http://stackoverflow.com/comment/36640983
tagged with: constructor
tagged with: exception

http://stackoverflow.com/a/23824272
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36654543
has comment: http://stackoverflow.com/comment/36655293
upvote count: 2
has comment: http://stackoverflow.com/comment/36655754
has comment: http://stackoverflow.com/comment/36655076
has body: First you get coordinates of ACTION_DOWN event then later distance. I think that you should do a check for event action. @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { Log.d("scroll", "scroll x: " + distanceX + " scroll y: " + distanceY); // ! CHECK FOR EVENT ACTION ! if (e2.getAction() == MotionEvent.ACTION_MOVE) { Game game = gameService.getGame(); game.setxPixelOffset((int) (game.getxPixelOffset() - distanceX)); game.setyPixelOffset((int) (game.getyPixelOffset() - distanceY)); uiService.getGameboardActivity().getGameboard().invalidate(); } return true; }
type: Answer
answers question: http://stackoverflow.com/q/23824123
has comment: http://stackoverflow.com/comment/36654831

fatwire
tags question: http://stackoverflow.com/q/23811448
tag name: fatwire
type: Tag

http://stackoverflow.com/comment/36618413
has text: Well these two parameters are being passed as method parameters public void getAllowedCustomer(String name, List<String> ids);
score: 0
comment on: http://stackoverflow.com/q/23804678
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23807143
has body: In order to solve the issue of too many connections to DB and idle connections, we made the following changes to the Configuration file- c3p0.min_size=1 c3p0.max_size=20 c3p0.timeout=1800 c3p0.max_statements=50 connection.release_mode=on_close After that, while trying to run the application, we are getting the following exception. Please advice why this is happening &amp; how this can be corrected - HTTP Status 500 - org.hibernate.exception.GenericJDBCException: Cannot open connection type Exception report message org.hibernate.exception.GenericJDBCException: Cannot open connection description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: org.hibernate.exception.GenericJDBCException: Cannot open connection org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.alci.filters.ParamFilter.doFilter(ParamFilter.java:27) root cause org.hibernate.exception.GenericJDBCException: Cannot open connection org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577) org.hibernate.loader.Loader.doQuery(Loader.java:696)…
tagged with: connection
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/36621782
has answer: http://stackoverflow.com/a/52283749
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/36623709
answer count: 2
score: 5
downvote count: 0
tagged with: c3p0
favorite count: 0
has title: Hibernate - org.hibernate.exception.GenericJDBCException: Cannot open connection
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23807851
linked to: http://stackoverflow.com/q/23795632

http://stackoverflow.com/q/23914521
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23953546
tagged with: java
type: UnansweredQuestion
has title: Esper Callback on Error
has answer: http://stackoverflow.com/a/23914691
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: esper
has body: I am currently using Esper within a Storm topology and I am aware that there is a method callback called update() that is called when Esper produces a result. I have been wondering what would happen if there is an error within the Esper engine itself. Is there an error callback that I can override and catch the Exception? Or is my best bet to simply wrap the sendEvent() call in a try-catch and then deal with the Exception accordingly?

http://stackoverflow.com/a/23915101
has comment: http://stackoverflow.com/comment/36828646
has comment: http://stackoverflow.com/comment/36828574
accepted answer of: http://stackoverflow.com/q/23914998
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36827991
has comment: http://stackoverflow.com/comment/36828268
type: Answer
has comment: http://stackoverflow.com/comment/36829908
answers question: http://stackoverflow.com/q/23914998
upvote count: 1
has body: If you're using Eclipse with the Android ADT tools installed, you can switch to the DDMS perspective and under the emulator control options, there are geolocation settings. You can send a single location or use a GPX or KML file to "play back" a series of locations (to simulate driving a route, for example) You can create KML routes in apps like Google Earth, or code it by hand in XML. Sounds like exactly what you're looking for. http://www.linuxtopia.org/online_books/android/devguide/guide/developing/tools/ddms.html There's also an emulator called Genymotion that runs on VirtualBox that has APIS for things like location simulation. I've been using it for a few weeks now and I'm very impressed: http://www.genymotion.com/
score: 1

http://stackoverflow.com/a/23901342
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: If you want to check that there is at least one key--any key--that matches the value, use hasValue: assertThat(map, hasValue(hasProperty("propertyName", is("value")))); The difference is in the mismatch output. There are also matchers for hasKey and hasEntry.
answers question: http://stackoverflow.com/q/23868294

http://stackoverflow.com/q/23930380
type: Question
has comment: http://stackoverflow.com/comment/36856045
answer count: 2
has comment: http://stackoverflow.com/comment/36856004
linked to: http://stackoverflow.com/q/926266
score: 0
has comment: http://stackoverflow.com/comment/36856304
has comment: http://stackoverflow.com/comment/36856167
has title: Does the definition of a local variable will low down the performance of the app?
has body: Take the following code snap for example: public int demoMethod(){ SomeClass object= getItFromSomewhere(); return object.getResult(); } also we can directly return getItFromSomewhere().getResult(). My question is whether the definition of "object" will low down the performance? And in some case, maybe the temporary local variable is very complicated, such as SomeClass object = otherClassObject.getMethod1().getMethod2().getMethod3().getMethod4(); return object.getMethod5(); If I don't use the temporary "object", the statement will be very difficult to read, how about you guys deal with this case?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23930582
has answer: http://stackoverflow.com/a/23930416
has comment: http://stackoverflow.com/comment/36856122
tagged with: java

http://stackoverflow.com/q/23781700
answer count: 1
favorite count: 0
tagged with: vuforia
type: UnansweredQuestion
has body: I'm experimenting with Vuforia augmented reality SDK and it's samples. I successfully compiled videopayback sample and ran it on my tablet. Then I tried to load the video from a url instead of from the device. Following the comments in the sample code, in VideoPlayerHelper.java I commented out this part: // This example shows how to load the movie from the // assets folder of the app // However, if you would like to load the movie from the // sdcard or from a network location // simply comment the three lines below AssetFileDescriptor afd = mParentActivity.getAssets() .openFd(filename); mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); afd.close(); and commented this part and added a url to a video file online: mMediaPlayer.setDataSource("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4"); Still I can compile it without an error but when I point the camera towards the trigger image I either see a cross on it or an hourglass which seems to mean it is loading the video. But nothing happens. Any idea what else I should do to fix this? I looked around in vuforia forums. Most solutions said to choose the video properly(the one I'm using was suggested there) and changes that are basically what I'm already doing like doing this: Uri videolink = Uri.parse("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4"); mMediaPlayer.setDataSource(mParentActivity,videolink);
tagged with: augmented-reality
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/36905310
score: 5
upvote count: 5
downvote count: 0
has title: vuforia AR SDK - can't play video by url
tagged with: sdk
tagged with: android

http://stackoverflow.com/a/23855404
has body: At the end of your mousePressed method, you can go though all AnimatedShape objects, check whether they are an AnimatedBall. When the object is a ball, you can test whether the mouse click hits the ball. The mouse click hits the ball when the distance between the center of the ball and the mouse position is smaller than the ball radius. When the ball is hit, you can set its horizontal speed to 0, and the vertical speed to 5 or so. for (AnimatedShape as : ballPanel.list) { if (as instanceof AnimatedBall) { AnimatedBall ball = (AnimatedBall)as; Rectangle b = ball.getBounds(); int ballCenterX = b.x + b.width / 2; int ballCenterY = b.y + b.height / 2; Point p = new Point(ballCenterX, ballCenterY); double d = p.distance(clickEvent.getPoint()); if (d &lt; radius) { ball.setDx(0); ball.setDy(5); } } } Note In order to make this work properly, you have to attach this listener to the ballPanel. Originally, you had the line this.addMouseListener(new MouseListener() { in your code. You have to change this to ballPanel.addMouseListener(new MouseListener() { Otherwise, the mouse coordinates will refer to the wrong component! Concerning the question from the comment how can I stop and disapper clickedball's when they crash the bound You may probably insert method to check this, and call this method in the actionPerformed method of your timer. Further explainations are probably beyond the scope of an anser on a Q&amp;A site. Stackoverflow is not a homework-solution-generator.
score: 0
answers question: http://stackoverflow.com/q/23847988
type: Answer
has comment: http://stackoverflow.com/comment/36714407
has comment: http://stackoverflow.com/comment/36715002

http://stackoverflow.com/comment/36683933
comment on: http://stackoverflow.com/a/23833790
score: 1
has text: Scaling the image to 100x100 brought the biggest performance boost. That's 10k iterations vs 4 million for my test images. The nested for loop with getPixel(x, y) was slower than looping all pixels like in my code snippet.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36817431
comment on: http://stackoverflow.com/a/23907099
score: 0
type: AnswerComment
has text: i did not use the keep for the groovy part because i donot want to keep the groovy part of the lib. However i am using the keep in my current workaround. I upvoted this answer from -1 to 0 because it helped me a lot although it was not the solution
type: Comment

http://stackoverflow.com/a/23785373
has comment: http://stackoverflow.com/comment/36581185
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36580767
has comment: http://stackoverflow.com/comment/36581037
has comment: http://stackoverflow.com/comment/36580672
has comment: http://stackoverflow.com/comment/36605853
has body: Add a column in B, that allows you to match rows in B with a specific status in A: Time t0: Table A => (rowA1) Table B => (rowB11, rowA1), (rowB12, rowA1) Time t1: Table A => (rowA2) Table B => (rowB11, null), (rowB12, null), (rowB21, rowA2), (rowB22, rowA2) At t1, the rows in B you want are something like SELECT * FROM B WHERE ref_to_A = [current_value_in_A]. It appears that your question was related to transactions isolation, after all. So here we go: Anything that happens during a transaction (unless isolation level is READ_UNCOMMITTED), i.e. between BEGIN and COMMIT (or ROLLBACK), is invisible to concurrent transactions.
has comment: http://stackoverflow.com/comment/36581115
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36580742
has comment: http://stackoverflow.com/comment/36580897
has comment: http://stackoverflow.com/comment/36581102
accepted answer of: http://stackoverflow.com/q/23784256
upvote count: 1
has comment: http://stackoverflow.com/comment/36581044
answers question: http://stackoverflow.com/q/23784256
has comment: http://stackoverflow.com/comment/36580953
has comment: http://stackoverflow.com/comment/36580792
type: Answer
has comment: http://stackoverflow.com/comment/36580993
has comment: http://stackoverflow.com/comment/36580884

http://stackoverflow.com/a/27265238
answers question: http://stackoverflow.com/q/23887178
score: 0
has body: try topic = (Topic) iniCtx.lookup("jms/topic/MyTopic"); Instead of topic = (Topic) iniCtx.lookup("topic/MyTopic");
type: Answer

http://stackoverflow.com/comment/36604022
type: QuestionComment
comment on: http://stackoverflow.com/q/23796325
score: 1
has text: Did u try this? http://stackoverflow.com/questions/5013917/can-i-serve-jsps-from-inside-a-jar-in-lib-or-is-there-a-workaround
type: Comment

http://stackoverflow.com/comment/36815443
type: Comment
comment on: http://stackoverflow.com/q/23908551
has text: Can you paste your OnPageChangeListener implementation?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36675176
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23835259
has text: Thanks AVK, the problem here is that this value i am getting it dynamically from the Session, and i can not do it like your example, at least i don't know how in this case.
type: AnswerComment

http://stackoverflow.com/a/23934102
accepted answer of: http://stackoverflow.com/q/23932859
upvote count: 1
has comment: http://stackoverflow.com/comment/36864231
score: 1
has body: Unfortunately, no. It isn't fine. Bytecode generated under 1.8 isn't compatible with 1.7. So the code you are generating doesn't work when uploaded to GAE. See Does JSP in Google AppEngine support JDK1.8 for some more information. You will probably, at a minimum, need to specify -target 1.7 for the compiler. See http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html#BHCIJIEG for further details or other options you may need.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36865624
type: Answer
answers question: http://stackoverflow.com/q/23932859

http://stackoverflow.com/q/23878509
has body: I am quite new to Android and Java. I need help with an app I'm making. The app reads a QR code via Intent and sends the information read to a server. I am getting that the port is opened with nmap -p 3557 192.168.15.18. When using my app I can't see any information send by it. PORT STATE SERVICE 3557/tcp open unknown public void onActivityResult(int requestCode, int resultCode, Intent intent) { //retrieve scan result IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanningResult != null) { //we have a result String scanContent = scanningResult.getContents(); String scanFormat = scanningResult.getFormatName(); formatTxt.setText("FORMAT: " + scanFormat); message = scanContent + " " + String.valueOf(spinner1.getSelectedItem())+ " "+ bebidas.getEditableText(); contentTxt.setText("CONTENT: " + scanContent + " " + String.valueOf(spinner1.getSelectedItem())+ " "+ bebidas.getEditableText()); DataOutputStream os = null; try { Socket socket = new Socket("192.168.15.18", 3557); os = new DataOutputStream(socket.getOutputStream()); os.writeBytes(message); os.close(); socket.close(); } catch (UnknownHostException e) { System.out.println("Unkonw exception " + e.getMessage()); } catch (IOException e) { System.out.println("IOException caught " + e.getMessage()); } } else{ Toast toast = Toast.makeText(getApplicationContext(), "No scan data received!", Toast.LENGTH_SHORT); toast.show(); } } The codes I am using are from here and it worked for him. Thanks in advance for your help.
has comment: http://stackoverflow.com/comment/36758434
score: 0
has comment: http://stackoverflow.com/comment/36757971
tagged with: client
has comment: http://stackoverflow.com/comment/36769997
answer count: 0
type: UnansweredQuestion
tagged with: android
tagged with: c++
has comment: http://stackoverflow.com/comment/36842622
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/4710093
has comment: http://stackoverflow.com/comment/36769685
has title: Problems string from android client to C++ Server

http://stackoverflow.com/a/23795296
upvote count: 1
answers question: http://stackoverflow.com/q/23791080
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The adapter from Customizing spinner's item background color is precisely what you need. Of course, you need to implement a method returning the desired color for each item of the array. If your input is the color name (i.e., this spinner acts a color picker, you could use Color.parseColor(). It supports some named colors, plus numeric values. Parse the color string, and return the corresponding color-int. If the string cannot be parsed, throws an IllegalArgumentException exception. Supported formats are: #RRGGBB #AARRGGBB 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuschia', 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'
score: 1
accepted answer of: http://stackoverflow.com/q/23791080

http://stackoverflow.com/a/23898045
type: Answer
score: 8
answers question: http://stackoverflow.com/q/23898030
accepted answer of: http://stackoverflow.com/q/23898030
has body: When a method don't have a visibility it's package by default. Read here too. So you should make your static void main(String[] args) public. public static void main(String[] args) The reason that the compiler don't complain about the public is because it doesn't care about the main method. It doesn't take difference for it if a main exists or not. It's the JVM which need a start point public and static to launch your application. Try to make other methods named main and you will see you don't have problems. main is a name like others.
type: AcceptedAnswer
downvote count: 0
upvote count: 8

ebean
tags question: http://stackoverflow.com/q/23925538
tags question: http://stackoverflow.com/q/23801050
type: Tag
tag name: ebean

http://stackoverflow.com/a/23798874
has comment: http://stackoverflow.com/comment/36606326
answers question: http://stackoverflow.com/q/23798824
has body: This is defined in the JLS. Section 15.18.1 (string concatenation operator) has: If only one operand expression is of type String, then string conversion (§5.1.11) is performed on the other operand to produce a string at run time. Section 5.1.11 has: Any type may be converted to type String by string conversion. A value x of primitive type T is first converted to a reference value as if by giving it as an argument to an appropriate class instance creation expression (§15.9): If T is boolean, then use new Boolean(x). If T is char, then use new Character(x). If T is byte, short, or int, then use new Integer(x). If T is long, then use new Long(x). If T is float, then use new Float(x). If T is double, then use new Double(x). This reference value is then converted to type String by string conversion. Now only reference values need to be considered: If the reference is null, it is converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the conversion is performed as if by an invocation of the toString method of the referenced object with no arguments; but if the result of invoking the toString method is null, then the string "null" is used instead. Now that's the general process. In the code in your title (String s = "A" + 5), this is a constant expression (section 15.28), so the compiler performs the concatenation at compile time, ensuring the result is the same as it would have been by following the above steps at execution time. That doesn't happen for the code in the body of your question, where you're using a variable for the int. In fact, the description above only explains what the result of string concatenation should be - the compiler can (and does, in the case of the Oracle JDK) use the overloads of StringBuilder.append to perform the relevant conversions - it trusts that the result will be the same as performing the conversion using the above step and then appending. To demonstrate that, compile a class containing this method: public void …
has comment: http://stackoverflow.com/comment/36606138
type: Answer
has comment: http://stackoverflow.com/comment/36606286
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36606260
has comment: http://stackoverflow.com/comment/36606357
has comment: http://stackoverflow.com/comment/36606384
upvote count: 2

http://stackoverflow.com/comment/36656336
type: Comment
comment on: http://stackoverflow.com/a/23825347
score: 0
type: AnswerComment
has text: The revalidate() + repaint() is not needed; probably from your try/error tests :-)

http://stackoverflow.com/a/23900123
has comment: http://stackoverflow.com/comment/36917005
has comment: http://stackoverflow.com/comment/36835266
answers question: http://stackoverflow.com/q/23860364
has comment: http://stackoverflow.com/comment/36922023
has comment: http://stackoverflow.com/comment/36957233
has comment: http://stackoverflow.com/comment/36809937
has body: Try adding -d64 parameter in the cmdline java -d64 path/to/myApp -Xms280g -Xmx280g &gt; output.txt
type: Answer
has comment: http://stackoverflow.com/comment/36921851
score: 0

http://stackoverflow.com/comment/63553398
has text: @HenrikKjusAlstad - good catch, I forgot the "else"s. Fixed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23864920
type: AnswerComment

http://stackoverflow.com/q/23812169
has title: Camera intent crashing my application after few pictures
favorite count: 0
has comment: http://stackoverflow.com/comment/36654606
tagged with: android
type: UnansweredQuestion
has body: I am having a problem with some phones during coming back from android.provider.MediaStore.ACTION_IMAGE_CAPTURE. On HTC and Alcatel it works great, but on LG it crashes my application. I can save some pictures and after that my application crashes with Sorry! MyApplication has stoped. I have tried many ways how to avoid this but i still get the same error. First i was using this 1: attempt Taking picture with image path (not getting any exception): public static void saveImage(String saveImgDir, String image, int TAKE_PHOTO_CODE, Activity activity) { try { GlobalVariables.incorrectButtonPressed = false; // CREATE DIR IF NOT EXISTS File directory = new File(saveImgDir); directory.mkdirs(); // CREATE AND SAVE IMG File imageFile = new File(saveImgDir + File.separator + image); try { imageFile.createNewFile(); } catch (IOException e) { Log.d("IMG", "FILE CREATE: " + e.toString(), e.getCause()); } Uri outputFileUri = Uri.fromFile(imageFile); // CALL CAMERA ACTIVITY Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); activity.startActivityForResult(cameraIntent, TAKE_PHOTO_CODE); } catch (Exception ex) { Log.d("CAMPROBLEM", "bblockScenario", ex); } } On activity result (not getting any exception): @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { try { if (requestCode == B_TAKE_PHOTO_CODE_AFTER &amp;&amp; resultCode == RESULT_OK) { Log.d("CAMPROBLEM", "ACTIVITY RESULT B_TAKE_PHOTO_CODE_AFTER RESULT OK"); imageTakenAfter++; Toast.makeText(context, "PCITURE SAVED", Toast.LENGTH_LONG). return; } if (requestCode == B_TAKE_PHOTO_CODE_AFTER &amp;&amp; resultCode != RESULT_OK) { Log.d("CAMPROBLEM", "ACTIVITY RESULT B_TAKE_PHOTO_CODE_AFTER RESULT NOT OK"); Toast.makeText(context, "PCITURE NOT SAVED", Toast.LENGTH_LONG).show(); return; } } catch (Exception ex) { Log.d("CAMPROBLEM", "bblockScenario", ex); } } 2: attempt Then i tried using async tasks (just to make s…
tagged with: android-intent
score: 2
downvote count: 0
tagged with: camera
tagged with: java
has answer: http://stackoverflow.com/a/23812685
type: Question
upvote count: 2
tagged with: crash
answer count: 1
has comment: http://stackoverflow.com/comment/36636444

size
type: Tag
tags question: http://stackoverflow.com/q/23854920
tag name: size

http://stackoverflow.com/q/23890831
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23891245
answer count: 1
tagged with: persistence
score: 0
has answer: http://stackoverflow.com/a/23891245
type: Question
type: AnsweredQuestion
has title: How to find the inverse side @OneToOne mappings?
has body: Let's assume a User can only have on Account. Which side would you make the inverse side? class User { @OneToOne(cascade = Cascade.ALL, mappedBy = "user") private Account = new Account(); } class Account { @OneToOne private User user; } Would you rather make the Account side mappedBy so that Account table contains the User id, and so that an account is automatically persisted if a new User is created and saved? dao.save(new User());

http://stackoverflow.com/comment/36661561
score: 0
type: Comment
type: QuestionComment
has text: I'm not familiar with that instrumentation. What reasons does the documentation give for an object being listed as "unreachable"? (Note that the "loaded by system class loader" message is a red herring -- it just says these are system classes, which is true of all arrays.)
comment on: http://stackoverflow.com/q/23809553

http://stackoverflow.com/comment/36622968
has text: try with file:///<drive>|/<path> instead of classpath:
score: 0
comment on: http://stackoverflow.com/q/23807835
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36648963
has text: oh, it stucks again( at the first time everything was 'ok' but then `keyadapter` doesnt work again. and if i use `pack()` the size is small)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23820626

http://stackoverflow.com/comment/36823430
type: Comment
has text: `Matcher.find` and `String.match` perform 2 very different operations.
comment on: http://stackoverflow.com/a/23912670
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37145868
score: 1
has text: Sorry, from past experience with other tools I thought it might be related. However, your last error seems more tractable :) Did you take a look at http://stackoverflow.com/questions/3052743/android-create-call-fails-in-windows-7-missing-jdk ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23853363

http://stackoverflow.com/q/23801509
answer count: 1
has comment: http://stackoverflow.com/comment/36611054
has comment: http://stackoverflow.com/comment/36610897
has comment: http://stackoverflow.com/comment/36611126
tagged with: eclipse
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36621091
has answer: http://stackoverflow.com/a/23806966
type: Question
has comment: http://stackoverflow.com/comment/36611159
has body: I am working on a Java project in Eclipse in Unix, and ran the project from the IDE. The process seems to run forever and doesn't respond to my clicks on the red "stop" button. I really want to avoid restarting my IDE. Can anyone advise how to kill the embedded process?
accepted answer: http://stackoverflow.com/a/23806966
has title: Eclipse: Can't kill process on Java perspective
tagged with: unix
has comment: http://stackoverflow.com/comment/36611079
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36610932

http://stackoverflow.com/comment/36754096
score: 0
has text: Too bad. I wonder if there is any possibility to trigger an error directly. It does not need to be done in a DataProvider. I mean generally, is there a way?
comment on: http://stackoverflow.com/q/23872603
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23895168
accepted answer: http://stackoverflow.com/a/23896976
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23899766
has body: I'm writing a simple standalone Java class that uses Lotus Domino's NCSO JAR for remote-connecting to a Domino server. I'm establishing a session, getting access to a database and then to a view: Session session = NotesFactory.createSession("host", "user", "password"); Database db = session.getDatabase(null, "MyDB.nsf"); View view = db.getView("MyView"); Now, I'm printing the number of entries in the view: int count = view.getEntryCount(); I get a nonzero number (let's say 1500). However, I can't seem to load any document by key. For example, for any letter in the alphabet, I'm getting an empty document collection with this call: System.err.println(view.getAllDocumentsByKey(letter, false)); When I try to load a document by key, when I know that the key exists in the view, I get null. Document document = view.getDocumentByKey("DocKey"); // Equals null even though // I know that 'DocKey' is // the key of an existing // document within the view. The very same code is said to be working (although I didn't check it) when using local Notes calls (using Notes.jar). What am I missing? EDIT I just noticed that session.getNotesVersion() returns version 8.5.2. The NCSO.jar file that I'm currently using doesn't appear to have a few methods that were added with Notes 8. Therefore, there is a possibility that the NCSO.jar file I use belongs to an earlier version of Notes than the one I'm trying to communicate with. Could that be the reason?
favorite count: 0
has answer: http://stackoverflow.com/a/23899766
has answer: http://stackoverflow.com/a/23896976
tagged with: lotus-notes
type: AnsweredQuestion
score: 1
has title: View.getEntryCount() returns 1500, but can't get any document by key?
tagged with: java
tagged with: lotus-domino
upvote count: 1

http://stackoverflow.com/comment/36675646
type: Comment
comment on: http://stackoverflow.com/a/23835377
has text: You are assuming that the number of seconds represents a specific point in time, not an interval.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23918745
has answer: http://stackoverflow.com/a/23918762
type: Question
has comment: http://stackoverflow.com/comment/36835068
has answer: http://stackoverflow.com/a/23918768
score: 0
tagged with: java
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36835291
downvote count: 1
has title: 10000000000 invalid character constant?
has body: I'm creating a program that involves high powers of 10. How can I include the integer 10,000,000,000? I get an error that states 'Invalid character constant'. int billion = '10000000000';
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36834598
has answer: http://stackoverflow.com/a/23918770
favorite count: 0

http://stackoverflow.com/comment/37669815
comment on: http://stackoverflow.com/a/24333586
has text: I still cannot change the default value !
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36677735
comment on: http://stackoverflow.com/a/23836513
type: Comment
has text: @System.exit Did you mean `paintComponent()`? `paintComponents()` (note the 's') is generally not overridden.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36607041
comment on: http://stackoverflow.com/q/23798879
score: 0
type: Comment
type: QuestionComment
has text: there is no error. i am getting null in the getNextEntry() Mr. Erwin

http://stackoverflow.com/q/23813727
has body: I would like to extract text from a given PDF file with Apache PDFBox. I wrote this code: PDFTextStripper pdfStripper = null; PDDocument pdDoc = null; COSDocument cosDoc = null; File file = new File(filepath); PDFParser parser = new PDFParser(new FileInputStream(file)); parser.parse(); cosDoc = parser.getDocument(); pdfStripper = new PDFTextStripper(); pdDoc = new PDDocument(cosDoc); pdfStripper.setStartPage(1); pdfStripper.setEndPage(5); String parsedText = pdfStripper.getText(pdDoc); System.out.println(parsedText); However, I got the following error: Exception in thread "main" java.lang.NullPointerException at org.apache.fontbox.afm.AFMParser.main(AFMParser.java:304) I added pdfbox-1.8.5.jar and fontbox-1.8.5.jar to the class path. Edit I added System.out.println("program starts"); to the beginning of the program. I ran it, then I got the same error as mentioned above and program starts did not appear in the console. Thus, I think I have a problem with the class path or something. Thank you.
has answer: http://stackoverflow.com/a/46211428
accepted answer: http://stackoverflow.com/a/23814989
has comment: http://stackoverflow.com/comment/36656488
tagged with: pdfbox
score: 43
upvote count: 43
has answer: http://stackoverflow.com/a/40830069
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36650746
has title: How to extract text from a PDF file with Apache PDFBox
answer count: 5
has answer: http://stackoverflow.com/a/23814989
possible better answer: http://stackoverflow.com/a/38806828
has comment: http://stackoverflow.com/comment/36660447
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38806828
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/50678270

http://stackoverflow.com/comment/104409846
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23807851
type: AnswerComment
has text: @VladMihalcea Can I use this tool for hibernate SessionFactory ? and how to use it ?

http://stackoverflow.com/comment/36746551
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23872438
has text: Again, this converts properties to flat json, I'm looking for something that creates hierarchical json
type: Comment

http://stackoverflow.com/comment/36736911
score: 0
type: Comment
type: QuestionComment
has text: @Braj Because I want to make a dynamic table that sum columns and rows. then I got in one tr values0, values1.. etc
comment on: http://stackoverflow.com/q/23867539

http://stackoverflow.com/a/23878810
type: Answer
has body: This is rather interesting, and during my times in have had similar problems. This all really depends on why the Mouse Listener is attached to. Many people attach the listener to the frame, but draw on a panel. This can have the effects you are describing so it is usually better to either draw directly onto the frame, or attach the listener to the panel. In 99.99% of cases, I would always choose the latter. Really, no one should ever choose the latter UNLESS it's something very small. Panels are exactly that; they're boxes which hold things, hence 'panel'. In my experiences it has always been more effective to use a panel. Frames are just the container to hold multiple panels. Hope I could help, report your findings in a comment and/or post update. Jarod.
has comment: http://stackoverflow.com/comment/36758562
score: 0
has comment: http://stackoverflow.com/comment/36758868
answers question: http://stackoverflow.com/q/23878654

http://stackoverflow.com/q/23829248
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23829485
tagged with: timestamp
has comment: http://stackoverflow.com/comment/36663467
has answer: http://stackoverflow.com/a/23829307
tagged with: java
has answer: http://stackoverflow.com/a/76440026
has body: I am having two Timestamps : Timestamp loggedintime=rs.getTimestamp("LOGIN_TIME"); Timestamp loggedouttime=rs.getTimestamp("LOGOUT_TIME"); Now,What i was trying to do is that find the interval between these two timestamps like 15 minutes or 1 hour 10 minutes etc. But I have no ides how this can be done.So please help me
type: UnansweredQuestion
answer count: 4
score: 2
has title: Finding Time interval between two timestamps
downvote count: 0
has answer: http://stackoverflow.com/a/23829314

http://stackoverflow.com/a/23849888
score: 1
has comment: http://stackoverflow.com/comment/36704395
answers question: http://stackoverflow.com/q/23849664
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23849664
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36704520
has body: The smallest change would be to have a boolean field in the Activity, setting it to true in onResume() and to false in onPause(), and check its value in handleMessage() (i.e. ignore the message if the flag is currently false). Another option, instead of using Messenger and handleMessage(), do this with a BroadcastReceiver. Register the receiver in onResume() and unregister it in onPause(). That way the broadcast from the service will be simply ignored. Both solutions are basically the same, anyway, but broadcasts are somewhat "higher level". This assumes that you're not interested in the Service's result if the activity is paused. If you are (for example, if you switch out of the application and back in, and you need to display the update) then you should put the received data in a field and process it on the following onResume().

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/23794940

http://stackoverflow.com/a/23902374
has comment: http://stackoverflow.com/comment/36804086
has body: input.getEditableText() returns an Editable object. Use input.getText().toString() to return a String for the Toast to display. More info: https://developer.android.com/reference/android/widget/EditText.html
answers question: http://stackoverflow.com/q/23902271
has comment: http://stackoverflow.com/comment/36804168
has comment: http://stackoverflow.com/comment/36821405
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36804149
score: 1

http://stackoverflow.com/comment/36798745
type: Comment
has text: @RyanNaddy I think what he means is: How are you reading the encoded text back in and converting it back to an image?
type: QuestionComment
comment on: http://stackoverflow.com/q/23899345
score: 0

http://stackoverflow.com/comment/36716808
has text: @jordan I don't get you, `arr.toString()` has the same behavior as the `toString` method from the `Object` class (`getClass().getName() + '@' + Integer.toHexString(hashCode())`). So both snippet indeed return a different character sequence.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23856703

http://stackoverflow.com/comment/36641824
has text: `Scanner` has a [constructor](http://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#Scanner-java.lang.String-) that takes a `String` as a source. You'll have to extract the `String` from the text field. This might be `inputField.getText()`, but I'm not sure and I don't want to study all your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23816019
score: 0

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/23921995

http://stackoverflow.com/comment/36656041
has text: @MarkRotteveel may be OP is using it in `result()` method.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23817678

http://stackoverflow.com/comment/36602844
comment on: http://stackoverflow.com/q/23796986
score: 0
has text: Thanks for the advice, but I'm still new to Java. So, it is definitely newbie. So, I have edited my codes but I'm still getting one error message each time I get the correct keyword. Is there anyway to change that? Any solutions to that?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36684083
has text: do you mean scanner.nextLine();?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23839618

http://stackoverflow.com/q/23894887
tagged with: nexus
type: UnansweredQuestion
tagged with: maven
has title: Resume release from a particular project when doing a release:perform to a staging repo in Nexus
tagged with: java
has body: I'm trying to do a release to a Nexus staging repo but it keeps dying at random points during the uploading of artifacts (debugging the "random points" is a separate issue). I'd like to be able to resume the release from the project that the died during upload with a command like: mvn clean release:perform -Papache-release -Darguments="-rf :jclouds-jsch -DskipTests" -DconnectionUrl=scm:git:file://`pwd`/.git -Dtag=jclouds-1.7.3-rc1 Unfortunately the -rf in the command above doesn't work. How can you do this? Is this even possible?
type: Question
has answer: http://stackoverflow.com/a/23897005
answer count: 1
score: 0

http://stackoverflow.com/comment/36672808
type: QuestionComment
comment on: http://stackoverflow.com/q/23833547
score: 1
has text: you can try Activity activity = getActivity(); if (activity != null) then you can use it for changing the title and etc
type: Comment

http://stackoverflow.com/q/23860170
has comment: http://stackoverflow.com/comment/36723676
has comment: http://stackoverflow.com/comment/36723591
has answer: http://stackoverflow.com/a/23860451
tagged with: java
accepted answer: http://stackoverflow.com/a/23860451
score: 0
has body: I have the following class : class Students{ int age; int dept; } Lets say i have a List&lt;Students&gt; and I want to manipulate the list by doing simple calculations like : calculate the mean, calculate the middle value (e.g. (age+debt)/2), find the closest value to the mean and so on. How can I do this in a structured way?. I want to be in a position where I can use different combinations on the list. e.g. calculate mean of age // calculate mean of the middle value from age/debt, find the closest value of the age etc. How should i approach this?. Would appreciate it if someone could point me in the right direction.
upvote count: 1
has title: Manipulating data in java List<Object> in a structured way
has answer: http://stackoverflow.com/a/23860308
has comment: http://stackoverflow.com/comment/36727782
favorite count: 0
answer count: 3
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23860308
downvote count: 1
has answer: http://stackoverflow.com/a/23862265
type: Question
tagged with: object

http://stackoverflow.com/comment/36649682
type: Comment
has text: I think you'll need to ask a new StackOverflow question...
type: QuestionComment
comment on: http://stackoverflow.com/q/23816019
score: 0

http://stackoverflow.com/comment/36649866
comment on: http://stackoverflow.com/q/23821813
has text: @user3580294 if u can not do let it be. :D haha
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36874744
type: QuestionComment
has text: http://stackoverflow.com/questions/3856767/android-keeping-a-background-service-alive-preventing-process-death But it isn't guaranteed? Android knows this isn't something that should be done on consumer devices so they don't really support it.
comment on: http://stackoverflow.com/q/23940208
score: 0
type: Comment

http://stackoverflow.com/comment/36758246
type: QuestionComment
has text: @RichardTingle It means the super's method does something different from the child method, and both are needed. Therefore they should have different names. I think that's the only good answer so far. Would you mind posting it?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23878406

http://stackoverflow.com/comment/36743877
has text: not really. I've been using eclipse for all of the project but the other day I updated eclipse and it has made most of my jar files missing. Now when I've added new coding to my project its treating it as if the code isnt there.
comment on: http://stackoverflow.com/a/23870403
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36722731
type: AnswerComment
comment on: http://stackoverflow.com/a/23859718
type: Comment
has text: @PaulDraper TreeMap does sort the keys. OP wants to preserve insertion order. *How do I use this key-value structure without it being sorted?*
score: 0

http://stackoverflow.com/comment/36577337
comment on: http://stackoverflow.com/q/23780963
score: 1
has text: I would use a regular `JTextField` and keep the real string in the background document while manually setting an `*` as the displayed text.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23847224
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23840297
has comment: http://stackoverflow.com/comment/36748503
has comment: http://stackoverflow.com/comment/36757980
answers question: http://stackoverflow.com/q/23840297
has body: Normally, an application is installed in WebSphere Application Server as a zipped .ear. If your application is large or frequently changing there is significant overhead to packaging all classes/resources in all modules, packaging all modules int an .ear, deploying the packaged .ear to the server, and having the server unpackage it all. The looseconfig.xmi file is created by RAD and passed to the server via a deployment property. The file describes the logical structure of an application and indicates that the actual classes/resources are physically located in the RAD workspace. This avoids the packaging/unpackaging overhead during deployment.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23851938
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23851409
downvote count: 0
score: 1
has body: The problem is that your table has a composite primary key as follow: idCanvas int PK idWidgets int PK but you have only mapped one of them. Change your mapping and replace the id section with &lt;composite-id&gt; &lt;key-property name="idCanvas"/&gt; &lt;key-property name="idWidgets"/&gt; &lt;/composite-id&gt;
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23851409

http://stackoverflow.com/a/25143986
has body: Throwing an UnsupportedOperationException is the standard behavior if you try to modify any collection that is unmodifiable. For example, it is thrown by all of the mutative methods of the classes returned by the Collections.unmodifiable wrappers (of which there are currently eight), such as Collections.unmodifiableList, and by the immutable Collections.emptyList, and by all of their iterators. So, AbstractCollection.add(E) throws this exception simply to make it easier to implement unmodifiable collections, by providing a useful default behavior. You will see the same behavior implemented in all of these methods too: Iterator.remove() AbstractList.add(int, E) AbstractList.set(int, E) AbstractList.remove(int) AbstractMap.put(K, V) AbstractMap.SimpleImmutableEntry.setValue(V) (Additionally, the exception is thrown by default by many methods that do not throw it deliberately, but which call methods that do, such as AbstractList.clear()). Had the method been made abstract it would have made it mandatory to override and saved some confusion. Maybe, but there are lots of places where unmodifiable behavior is wanted, so it can be convenient to have a default implementation. It also encourages unmodifiable collections to throw the exception consistently; otherwise someone might implement an add method by having it do nothing rather than throw the exception, and that would be more confusing. When you want a modifiable collection, simply look at the doc for the Abstract* base class that you extended, which will always say which additional methods you need to override. For example, AbstractCollection says: To implement an unmodifiable collection, the programmer needs only to extend this class and provide implementations for the iterator and size methods. (The iterator returned by the iterator method must implement hasNext and next.) To implement a modifiable collection, the programmer must additionally override this class's add method (which otherwise throws an UnsupportedOpe…
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23889410
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23889410

http://stackoverflow.com/comment/36706656
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23829949
has text: Why on earth aren't you allowed to put your web app jars in your own web app? Besides that not every library is implemented well enough to share between webapps, it also means you cannot (trivially) have multiple versions of the same jars deployed at the same time.

http://stackoverflow.com/comment/36589491
score: 0
type: Comment
has text: let's say I want to make every item have a bunch of controls. And I want to interact with the corresponding datamodel directly. Is that possible/simple with this solution?
type: AnswerComment
comment on: http://stackoverflow.com/a/23789709

http://stackoverflow.com/comment/36804907
type: Comment
type: QuestionComment
has text: The execution will be much faster how would you see the code which is being executed ?? You should use the debugger and if you want to see which part of the code is used then you should go with the code coverage tool.
score: 0
comment on: http://stackoverflow.com/q/23902766

http://stackoverflow.com/q/23919468
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36836384
has comment: http://stackoverflow.com/comment/36844661
tagged with: securitymanager
has comment: http://stackoverflow.com/comment/52761241
favorite count: 0
has comment: http://stackoverflow.com/comment/36836899
has comment: http://stackoverflow.com/comment/52783893
answer count: 0
has title: Can't get runtime to allow class in java.util
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36836517
upvote count: 1
has body: I recently wanted to create my own copy of GregorianCalendar to add some System.out.println to help me understand how it works. I copied the source and renamed the class, but it wouldn't compile because the source references package-private names in other classes. So I tried adding package java.util; to the source and putting it in a java\util subdirectory of my working directory. I got the program to compile, but it is throwing java.lang.SecurityException: Prohibited package name: java.util. After reading through the tutorial on Security, I tried running policytool to give myself permission to define a class in java.util. I now have a file policy1 that looks like: grant { permission java.lang.RuntimePermission "defineClassInPackage.java.util"; }; (plus the DO NOT EDIT comment). This is in my work directory, same as my test program. I ran (in a Command Prompt window): java -Djava.security.manager -Djava.security.policy=policy1 Test35 But it's still not working. Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.util at java.lang.ClassLoader.preDefineClass(ClassLoader.java:659) at java.lang.ClassLoader.defineClass(ClassLoader.java:758) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:367) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Test35.main(Test35.java:13) Did I do something wrong, or miss a step?
has comment: http://stackoverflow.com/comment/36836734

http://stackoverflow.com/comment/36729839
score: 0
type: Comment
type: QuestionComment
has text: may be you are missing the correct version of the jar you are adding there. check that also.
comment on: http://stackoverflow.com/q/23863343

http://stackoverflow.com/q/23838646
has title: How To Set Default Language for Android app?
downvote count: 0
has answer: http://stackoverflow.com/a/23838742
favorite count: 0
has comment: http://stackoverflow.com/comment/36681953
tagged with: android
answer count: 4
upvote count: 11
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/63567425
score: 11
has body: I've created an app in two languages. The second one (english), is used when user's default system language is english. If it's not, then the first one is used. I want to set the second language (that's english) as a DEFAULT language, which means that when user opens my app and his system language is not the first one, nor English, the English language will appear as a default one. I tried: Locale locale = new Locale("en_US"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; context.getApplicationContext.getResources().updateConfiguration(config, null); But got "context cannot be resolved" error everytime.. Is this piece of code right or..?
tagged with: java
has comment: http://stackoverflow.com/comment/100868037
has answer: http://stackoverflow.com/a/23838792
has answer: http://stackoverflow.com/a/23838729
type: Question

http://stackoverflow.com/comment/36813547
comment on: http://stackoverflow.com/a/23800454
score: 0
type: AnswerComment
has text: @Gagravarr Hi. I changed my codes again because I was told that I need to use hashmap. Now that I have changed my codes, it doesn't show the data.
type: Comment

http://stackoverflow.com/comment/36691312
has text: in your build path under "order and export" you will have to check them all (or atleast the jars/libraries for which you have noclassdef).. have you done it?
score: 1
comment on: http://stackoverflow.com/q/23843701
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23854402
tagged with: sockets
has title: java socket send strings instead of bytes
has comment: http://stackoverflow.com/comment/36712278
has comment: http://stackoverflow.com/comment/36712305
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23854494
score: 0
possible better answer: http://stackoverflow.com/a/23854443
answer count: 2
has answer: http://stackoverflow.com/a/23854443
linked to: http://stackoverflow.com/q/17440795
has body: I'm new at sending data through sockets but I figured out how to do it now. My problem is that I can only send and receive bytes, is there a way that I can send and receive strings in stead of bytes? Or is it always bytes? I'm sorry for my bad understanding of how sockets work but I'm trying (; Thanks in advance!
has answer: http://stackoverflow.com/a/23854494

http://stackoverflow.com/comment/36757938
score: 0
comment on: http://stackoverflow.com/q/23878251
has text: Perhaps you can take a look inside the startup script to understand what location is being searched for. You will most likely find that either `startup.bat` or `catalina.bat` is attempting to use a variable that is not defined.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36772391
type: Comment
score: 0
has text: @Rogue And? If they're wrong they should be downvoted, nu? and upvoted if they're right?
comment on: http://stackoverflow.com/a/23885553
type: AnswerComment

http://stackoverflow.com/comment/36881584
type: AnswerComment
score: 0
has text: Since this is the only thing accessing the database, and accesses it only once per 60-seconds - the connection pool would seem to be overkill. But thanks for the suggestion and for the info about the db caching the prepared statement.
comment on: http://stackoverflow.com/a/23921274
type: Comment

http://stackoverflow.com/q/23856497
has body: I'm creating a GUI calculator, using FlowLayout, GridLayout and BorderLayout. I have the following code. import java.awt.*; import javax.swing.*; //Imports visual components for program import java.awt.event.*; //Imports functions for providing performing action on object public class Calc extends JFrame implements ActionListener { JPanel[] row = new JPanel[5]; //5 panels are created for 5 rows of buttons JButton[] button = new JButton[19]; String[] buttonString = {"1","2","3","+","4","5","6","-", "7","8","9","*",".","/","C","rt","%", "=", "0"}; double[] temporary = {0,0}; //Two memory locations for current number and upcoming number for signs such as *,/,%,+,- boolean[] sign = new boolean[5]; //5 values for +,-,*,/,% are stored in array because they expect another number upon invocation JTextArea display = new JTextArea(1,10); //Creates display with location specified Calc(){ //Constructor begins here setResizable(false); //Sets calculator size to be fixed at 380x250 //5x5 is created and selected for the calculator for(int a = 0; a &lt; 5; a++) sign[a] = false; //Initialises the state of the signs for +,-,*,/,% JPanel displaypanel = new JPanel(); JPanel first = new JPanel(); JPanel last = new JPanel(); //Create three panels for buttons to be placed in displaypanel.setLayout(new FlowLayout()); displaypanel.add(display); //Display is added first.setLayout(new GridLayout(3,5)); for(int a = 0; a&lt;15; a++) first.add(button[a]); //"first" panel is added last.setLayout(new GridLayout(1,4)); last.add(button[15]); last.add(button[16]); last.add(button[17]); last.add(button[18]); JFrame window = new JFrame("Task twelve"); window.setLayout(new BorderLayout()); window.add(displaypanel, BorderLayout.PAGE_START); window.add(first, BorderLayout.CENTER); window.add(last, BorderLayout.PAGE_END); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(400, 400); for(int a = 0; a &lt; 19; a++){ button[a] = new JButton(); button[a].setText(butt…
score: -1
has title: Run-time error for GUI calculator in Java
has answer: http://stackoverflow.com/a/23856590
tagged with: user-interface
answer count: 1
tagged with: calculator
favorite count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/36716145
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23856590
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36716157
has comment: http://stackoverflow.com/comment/36717939
upvote count: 1
type: Question
tagged with: actionlistener

http://stackoverflow.com/comment/93987809
score: 1
has text: This worked for me with Spring "3.1.2.RELEASE" (modified to work with Java 8). I bumped both "aspectjrt" and "aspectjweaver" from 1.6.5 to 1.9.2.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23802247

http://stackoverflow.com/comment/36858212
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23931546
has text: Did you read this question http://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java -- Can you post the test code?

http://stackoverflow.com/a/23865413
score: 1
upvote count: 1
has body: Try overriding the onError() function of your form an see if you get there, I suspect that your validator returns an error and you do not get into the onSubmit() because of that. Than I would suggest to use a proper Model for your input fields. Try adding 2 String properties to your Page (hawKennung and password) and getter/setters for them. Create the input fields like this: TextField&lt;String&gt; hawKennung = new TextField&lt;&gt;("hawKennung", new PropertyModel(Login.this, "hawKennung"); and just use the property hawKennung in the onSubmit(). Wicket will take care of assigning the value.
answers question: http://stackoverflow.com/q/23843918
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23843918
downvote count: 0
type: Answer

weblogic
tags question: http://stackoverflow.com/q/23790162
tags question: http://stackoverflow.com/q/23831997
tags question: http://stackoverflow.com/q/23906236
tag name: weblogic
tags question: http://stackoverflow.com/q/23919927
type: Tag
tags question: http://stackoverflow.com/q/23778958

http://stackoverflow.com/q/23872099
linked to: http://stackoverflow.com/q/18709334
has title: How do I get the list of numbers off of a file that the user inputs in Java?
has answer: http://stackoverflow.com/a/23872217
has comment: http://stackoverflow.com/comment/36746131
has comment: http://stackoverflow.com/comment/36745481
score: 0
linked to: http://stackoverflow.com/q/5996989
answer count: 3
has comment: http://stackoverflow.com/comment/36755665
has answer: http://stackoverflow.com/a/23872639
has comment: http://stackoverflow.com/comment/36755340
possible better answer: http://stackoverflow.com/a/23872211
has comment: http://stackoverflow.com/comment/36745282
favorite count: 0
has answer: http://stackoverflow.com/a/23872211
accepted answer: http://stackoverflow.com/a/23872639
upvote count: 2
has body: I am using Java eclipse and I would like to have the user input the filename to retrieve a list of scores from the file. My goal is to take the average of those numbers. What line of code do I need just to get the user to input a file name and for the program to take those numbers so that I can compute with them? Currently I can have the user input scores, But I need to get the numbers from the file instead. I have visited numerous resources on this site. Here are a few: BufferedReader, Error finding file, Getting a list from a file package Average; /**An average of scores*/ import java.util.Scanner; public class Average2 { public static void main(String[] args) { int grade = 0; int students = 0; float total = 0; double average = 0; Scanner input = new Scanner(System.in); System.out.println("Enter number of students: "); students = input.nextInt(); if (students &lt;= 10) { System.out.println("Enter the grades of the students: "); for(int i = 0; i &lt; students; i++) { do { grade = input.nextInt(); } while(grade &lt; 0 || grade &gt; 100); total += grade; } average = (total/students); int median = ((82+84)/2); System.out.println("The average is " + average); System.out.println("The mean is " + median); } } } Update since above post! package trials; import java.io.File; import java.io.IOException; import java.util.Scanner; public class trials2 { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub // Create new Scanner object to read from the keyboard Scanner in = new Scanner(System.in); // Grab the name of the file System.out.println("Enter filename: "); String fileName = in.next(); // Access the file Scanner fileToRead = new Scanner(new File(fileName)); // While there is still stuff in the file... double sum = 0; while (fileToRead.hasNext()) { if (fileToRead.hasNextDouble()) { sum += fileToRead.nextDouble(); } else { fileToRead.next(); } } { fileToRead.close(); } System.out.println(sum); } } The results I get from this: Enter…
tagged with: input
has comment: http://stackoverflow.com/comment/36745292
linked to: http://stackoverflow.com/q/22973652
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36752371
tagged with: filenames
tagged with: java
downvote count: 2
tagged with: average
type: Question

http://stackoverflow.com/comment/36596414
score: 1
has text: @HonzaZidek Yes. That is so. But it doesn't modify the callers reference type. See my example above, using an array of `int`.
type: Comment
comment on: http://stackoverflow.com/a/23793346
type: AnswerComment

http://stackoverflow.com/comment/36837682
score: 0
comment on: http://stackoverflow.com/q/23920090
has text: Related: [JSF 2 Default DateTime Converter Pattern](http://stackoverflow.com/q/14990960/1065197).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23888809
downvote count: 0
has comment: http://stackoverflow.com/comment/36777558
has comment: http://stackoverflow.com/comment/36778345
has comment: http://stackoverflow.com/comment/36778013
type: Answer
has comment: http://stackoverflow.com/comment/36779405
upvote count: 6
answers question: http://stackoverflow.com/q/23887667
has comment: http://stackoverflow.com/comment/36777640
score: 6
accepted answer of: http://stackoverflow.com/q/23887667
has comment: http://stackoverflow.com/comment/36777329
has comment: http://stackoverflow.com/comment/36777920
has comment: http://stackoverflow.com/comment/36777514
has body: In your item.xml make it checkable: &lt;item android:id="@+id/bookmark" android:icon="@drawable/nobookmark" android:checkable="true" android:showAsAction="ifRoom" android:title="Add to Favorites"/&gt; In the java you must manually toggle the checked state and select the icon: @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId() == R.id.bookmark){ item.setChecked(!item.isChecked()); item.setIcon(item.isChecked() ? R.drawable.bookmark : R.drawable.nobookmark); return true; } return false; }
has comment: http://stackoverflow.com/comment/36779383
has comment: http://stackoverflow.com/comment/36778564
type: AcceptedAnswer

winreg
tags question: http://stackoverflow.com/q/23853363
type: Tag
tag name: winreg

http://stackoverflow.com/comment/36764313
has text: If you're running into NullPointerExceptions, please post the full exception with stack trace and use the debugger to realize which field exactly is null. These are information that are necessary to resolve your problem.
comment on: http://stackoverflow.com/q/23877306
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36581208
type: Comment
comment on: http://stackoverflow.com/a/23783836
has text: @sina72 not if you don't use a BOM
type: AnswerComment
score: 0

http://stackoverflow.com/a/23844291
answers question: http://stackoverflow.com/q/23844226
type: Answer
has body: try to replace your special characters with their unicode. for example replace é with &amp;\#223 See this http://www.codetable.net/unicodecharacters for more information
score: 0

http://stackoverflow.com/comment/36586185
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23788175
has text: You mean you want to have that output on the JSP page, I think.

http://stackoverflow.com/a/23847132
has comment: http://stackoverflow.com/comment/36697882
has comment: http://stackoverflow.com/comment/36698104
type: AcceptedAnswer
downvote count: 0
has body: By default, JFrame has BorderLayout with CENTER alignment. Thats why single component will takes full screen. So add a suitable Layout Manager to JFrame. For details, go through, How to Use Various Layout Managers.
type: Answer
has comment: http://stackoverflow.com/comment/36698153
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23847118
answers question: http://stackoverflow.com/q/23847118

http://stackoverflow.com/comment/44910943
type: AnswerComment
has text: daysBetween counts the number of full days (# 24 h) within a range and not the number of midnights....
type: Comment
comment on: http://stackoverflow.com/a/23788937
score: 0

http://stackoverflow.com/comment/36597012
type: AnswerComment
has text: Nice example, but why should the OP choose to use it? Also, you're not disposing of the graphics context which could, on some systems, prevent anything from been painted ;)
comment on: http://stackoverflow.com/a/23793574
type: Comment
score: 2

http://stackoverflow.com/comment/36710941
has text: Where do you see status code 302? It doesn't appear in the log you have posted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23835441
score: 1

http://stackoverflow.com/comment/36767633
type: AnswerComment
score: 0
type: Comment
has text: Okay, I didn't understand it just now. But I got it and solved the problem. Thank you
comment on: http://stackoverflow.com/a/23882753

geotools
type: Tag
tags question: http://stackoverflow.com/q/23912086
tag name: geotools

http://stackoverflow.com/a/23948689
has body: I have used JAXB Based JSON support i used following call for change format of JSON response. import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.ws.rs.Produces; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; import javax.xml.bind.JAXBContext; import org.springframework.stereotype.Component; import com.ws.convertors.EmployeeTimeTrackingConvertor; import com.sun.jersey.api.json.JSONConfiguration; import com.sun.jersey.api.json.JSONJAXBContext; @Provider @Component @SuppressWarnings("unchecked") @Produces("application/json") public class JAXBContextResolver implements ContextResolver&lt;JAXBContext&gt;{ private Class[] types = { EmployeeTimeTrackingConvertor.class}; private JAXBContext context; private final Set&lt;Class&gt; typeSet; public JAXBContextResolver() throws Exception { this.context = new JSONJAXBContext(JSONConfiguration.natural().build(), types); this.typeSet = new HashSet(Arrays.asList(types)); } public JAXBContext getContext(Class&lt;?&gt; objectType) { return (typeSet.contains(objectType)) ? context : null; } } And configuration in Xml file for bean initialization. @XmlRootElement(name = "employeeTimeTracking") public class EmployeeTimeTrackingConvertor { private EmployeeTimeTrackingWrapper employeeTimeTrackingWrapper; private Integer returnCode=null; private List&lt;EmployeeTimeTrackingWrapper&gt; employeeTimeTrackingWrapperList; private List&lt;EmployeeLeaveStatusHistoryNewWrapper&gt; timeOffHistoryList; -----setter and getter methods } it will automatically change jersey producer result. you can read this https://jersey.java.net/documentation/1.18/json.html
answers question: http://stackoverflow.com/q/23912554
score: 0
type: Answer

http://stackoverflow.com/a/23797929
upvote count: 1
has body: You need to download JCE zip file from Oracle download site according to your jdk version. It will come with 2 jars of local_policy.jar &amp; US_export_policy.jar, and README.txt file. You need to follow instructions from README file, in fact need Installation section.
accepted answer of: http://stackoverflow.com/q/23797289
answers question: http://stackoverflow.com/q/23797289
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/36715262
type: QuestionComment
comment on: http://stackoverflow.com/q/23855974
has text: Sorry! Yes you are correct, header at the very top, two panels which are half the size of the header panel just below the header, then two the same just below those, and finally the footer.
score: 0
type: Comment

http://stackoverflow.com/a/23978154
has comment: http://stackoverflow.com/comment/37470468
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37249799
has comment: http://stackoverflow.com/comment/37292972
has comment: http://stackoverflow.com/comment/37246624
has comment: http://stackoverflow.com/comment/37319183
has comment: http://stackoverflow.com/comment/37551853
has comment: http://stackoverflow.com/comment/37288710
has comment: http://stackoverflow.com/comment/37119569
has comment: http://stackoverflow.com/comment/37282016
has comment: http://stackoverflow.com/comment/37492593
has comment: http://stackoverflow.com/comment/37044106
has comment: http://stackoverflow.com/comment/37083600
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37246251
downvote count: 0
has comment: http://stackoverflow.com/comment/38053132
has comment: http://stackoverflow.com/comment/37084275
has comment: http://stackoverflow.com/comment/37057315
accepted answer of: http://stackoverflow.com/q/23778653
has comment: http://stackoverflow.com/comment/37011618
type: Answer
has body: The java classes in the code sample were indeed generated with Java version 1.7. All you need is to generate new classes compatible with your own environment. Here you can find an explanation on how to do it using the wsimport JDK utility.
answers question: http://stackoverflow.com/q/23778653
has comment: http://stackoverflow.com/comment/37027353

http://stackoverflow.com/a/23883824
downvote count: 0
has body: Here what is your intention to compare . If it is to compare arrays then you may go with Arrays.equal(arr1,arr2). or if your intention to compare the index vales then you can go string.equals(str2);
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23883724
upvote count: 1

http://stackoverflow.com/comment/36825079
comment on: http://stackoverflow.com/a/23898937
score: 0
type: AnswerComment
type: Comment
has text: Can I just use Arraylist instead of hashtable to store the containing words? I dont see why I need to <key,value> pair here. I was thinking on the lines of: Collection<String> firstString = new ArrayList<String>(); words.add(*); similarly for the other String. Then use firstString.retainAll(secondString); ... Is this less optimal?

blackberry
tags question: http://stackoverflow.com/q/23864354
type: Tag
tag name: blackberry

http://stackoverflow.com/comment/36719132
has text: BTW - Your answer was very helpful. I wish I could have selected both since you were both correct and helpful, but I just picked one randomly.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23850028

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/23789893

http://stackoverflow.com/comment/36689889
comment on: http://stackoverflow.com/q/23838828
score: 1
type: Comment
has text: i just removed the server-side part and replaced by simple jradiobuttons
type: QuestionComment

http://stackoverflow.com/a/23917636
type: Answer
has body: A BorderLayout with the table in (a scroll pane) in the CENTER and button panel in the PAGE_START should do it. Thought I'd probably use a JToolBar (instead of a JPanel) for the buttons.
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23917603
answers question: http://stackoverflow.com/q/23917603
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/121006390
type: Comment
comment on: http://stackoverflow.com/a/23838355
score: 0
type: AnswerComment
has text: Is there a way to test if the peer is already there to avoid the broken pipe ? I have the same problem. I kill my server then the TCP client throw a IOException Broken Pipe and I cannot re open my connection.

http://stackoverflow.com/a/23912265
score: 1
upvote count: 1
downvote count: 0
has body: Looks like your program is calling carveMaze() recursively without any base conditions and thus you are getting StackOverFlow Issue.Can you identify a case when this function should stop calling itself.Please find an example here
answers question: http://stackoverflow.com/q/23911834
type: Answer
has comment: http://stackoverflow.com/comment/36822978
has comment: http://stackoverflow.com/comment/36822688

http://stackoverflow.com/q/23934503
has answer: http://stackoverflow.com/a/23934570
type: UnansweredQuestion
has title: Retrieving drawn Rectangle2D object and read it's properties
upvote count: 0
favorite count: 0
type: Question
score: -1
tagged with: java
has body: I am drawing a rectangle from method DrawRect using swings like this - Graphics2D graph2 = (Graphics2D) g; Rectangle2D rect = new Rectangle2D.Double(100, 100, 100, 100); graph2.draw(rect); In other method getDrawnRect, I want to get that object of drawn rectangle and read its properties. I mean, is there any method available that returns objects drawn (like rectangles,circles) or any other way to get those objects indirectly.
tagged with: swing
answer count: 1
downvote count: 1

http://stackoverflow.com/q/23865978
answer count: 1
has answer: http://stackoverflow.com/a/24282909
score: 0
tagged with: asteriskami
has body: I created in manager.conf a user manager named : mark , in "sip.conf" user named "utilisateur" i want to call user : "utilisateur" via Asterisk-java , i tried this code : import java.io.IOException; import org.asteriskjava.manager.AuthenticationFailedException; import org.asteriskjava.manager.ManagerConnection; import org.asteriskjava.manager.ManagerConnectionFactory; import org.asteriskjava.manager.TimeoutException; import org.asteriskjava.manager.action.OriginateAction; import org.asteriskjava.manager.response.ManagerResponse; public class HelloManager { private ManagerConnection managerConnection; public HelloManager() throws IOException { ManagerConnectionFactory factory = new ManagerConnectionFactory( "localhost", "mark", "1234"); this.managerConnection = factory.createManagerConnection(); } public void run() throws IOException, AuthenticationFailedException, TimeoutException { OriginateAction originateAction; ManagerResponse originateResponse; originateAction = new OriginateAction(); originateAction.setChannel("SIP/utilisateur"); originateAction.setContext("default"); originateAction.setExten("2222"); originateAction.setPriority(new Integer(1)); originateAction.setTimeout(new Integer(30000)); // connect to Asterisk and log in managerConnection.login(); // send the originate action and wait for a maximum of 30 seconds for Asterisk // to send a reply originateResponse = managerConnection.sendAction(originateAction, 30000); // print out whether the originate succeeded or not System.out.println(originateResponse.getResponse()); // and finally log off and disconnect managerConnection.logoff(); } public static void main(String[] args) throws Exception { HelloManager helloManager; helloManager = new HelloManager(); helloManager.run(); } } And in extension.conf i added this extension : [default] exten =&gt; 2222,1,Dial(SIP/utilisateur) exten =&gt; 2222,2,Answer and i get this error fromasterisk server so could somone help me : Exception in thread "main" org.asteriskja…
type: UnansweredQuestion
tagged with: java
type: Question
has title: how calling a person vi asterisk-java

http://stackoverflow.com/q/23831157
score: 35
upvote count: 35
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/23837955
has comment: http://stackoverflow.com/comment/36678894
has comment: http://stackoverflow.com/comment/36667329
has body: ArrayList have a default capacity of 10 objects. As the size exceeds 10 objects, an ArrayList will internally increase its capacity. Does the capacity decrease when we remove the object from ArrayList. If the ArrayList capacity doesn't decrease, could this lead to performance issues?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36667269
has answer: http://stackoverflow.com/a/23831915
has comment: http://stackoverflow.com/comment/36667373
tagged with: java
has title: Does the capacity of ArrayList decrease when we remove elements?
has comment: http://stackoverflow.com/comment/36667265
linked to: http://stackoverflow.com/q/21974361
has answer: http://stackoverflow.com/a/23831296
tagged with: collections
possible better answer: http://stackoverflow.com/a/23831307
type: Question
has answer: http://stackoverflow.com/a/23831322
has answer: http://stackoverflow.com/a/23831307
has comment: http://stackoverflow.com/comment/36667231
accepted answer: http://stackoverflow.com/a/23831296
has answer: http://stackoverflow.com/a/66744922
has answer: http://stackoverflow.com/a/23831369
has comment: http://stackoverflow.com/comment/118305383
tagged with: arraylist

http://stackoverflow.com/comment/36680664
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23838060
has text: I don't understand your question.

http://stackoverflow.com/a/23934175
has body: Equivalent String Literals (even those stored in separate classes in separate packages) will refer to the same String object. In general, String Literals are not eligible for garbage collection. Ever. Strings created at run-time will always be distinct from those created from String Literals. You can reuse String Literals with run-time Strings by utilizing the intern() method. The best way to check for String equality is to use the equals() method. Source : http://www.javaranch.com/journal/200409/ScjpTipLine-StringsLiterally.html Note that this is a bit advanced - you have to know something about the inner workings of class String to understand this. A String objects stores its data in a character array. When you take a substring of a string, by calling the substring() method, then the new String object that is created does not copy part of the data of the original string. Instead, it stores a reference to the underlying data of the original string, along with an offset and length to indicate what part of the old string the new String object represents. When you have a very long string (for example you read the contents of a file into a String object) and you take a substring out of it, then the JVM will retain all the data of the original string in memory - even if you discard the original String object, because the String object created with substring() still holds a reference to the whole character array with all the data. To prevent this memory inefficiency, you can explicitly create a new String object using the substring object. That second new String object will copy the data from the substring object, but just the part that you need. view plainprint? Note: Text content in the code blocks is automatically word-wrapped // Suppose this contains 100K characters read from a file String largeString = ...; // This will refer to the 100K char array from largeString, keeping the whole buffer in memory // even though sub represents only 20 characters String sub = larg…
type: Answer
answers question: http://stackoverflow.com/q/23933912
score: 0
has comment: http://stackoverflow.com/comment/92700510

http://stackoverflow.com/comment/36672675
score: 0
comment on: http://stackoverflow.com/q/23833934
type: Comment
type: QuestionComment
has text: https://ideone.com/2Da8Xg

http://stackoverflow.com/a/23858053
has comment: http://stackoverflow.com/comment/36722678
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23857938
accepted answer of: http://stackoverflow.com/q/23857938
has body: It seems that you assume that a servlet is something that is bound to an HTTP request (like the execution of scripts in PHP). Well... It is not. A servlet based application is indeed a full blown application. You start it, and it runs. On and on. The servlet API just defines some ways to interact with you application and that API targets HTTP as a communication protocol primarily, but can even be used for other protocols. Anyway: Too archieve your goal you probably want to implement a ServletContextListener. This will fire as soon as your sevlet application is started and once it is stopped. Usually you don't start and stop your application randomly, but only if you update your application or the like. In these cases there is hardly away around aborting your loop. In this ServletContextListener of yours you can start your own threads of your own liking and keep them running as you please. You should also add a mechanism for shutdown if your server is stopped, because otherwise a server restart results in your threads forcefully beeing terminated in an undefined state and/or memory leaks. As I mentioned the shutdown will only happen in situation when there is hardly a way around a shutdown. Your application can run for years without a shutdown. You need to register your ServletContextListener in your web.xml file so that it has some effect.
has comment: http://stackoverflow.com/comment/36723510

http://stackoverflow.com/comment/41845340
type: QuestionComment
has text: Rajesh I desperately needs your help,I'm stuck here.
comment on: http://stackoverflow.com/q/23784422
score: 0
type: Comment

http://stackoverflow.com/q/23840977
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/36686695
type: UnansweredQuestion
has title: initialize() before actionPerformed()
has comment: http://stackoverflow.com/comment/36757013
has comment: http://stackoverflow.com/comment/36756705
has comment: http://stackoverflow.com/comment/36686662
has body: I have a class which implements ActionListener. My actionPerformed() method runs fine. However, there are some things I want to do once before my program starts to run actionPerformed(). I could put a boolean in actionPerformed() and just run it once that way, but I was looking for something cleaner. I cannot just use my constructor, because I need a fully constructed object for what I am trying to do. Is there a way to add a method such as initialize() or start() which will run before actionPerformed() starts? Some sample code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Game implements ActionListener { public Game() { // Constructor } public void initialize() { // I want a method of some sort here which is run before the main game // loop so I can set it up } @Override public void actionPerformed(ActionEvent e) { // main game runs } }
favorite count: 0
has comment: http://stackoverflow.com/comment/36758410
type: Question
has comment: http://stackoverflow.com/comment/36686714
tagged with: initializer
has comment: http://stackoverflow.com/comment/36686680
has comment: http://stackoverflow.com/comment/36686679
has answer: http://stackoverflow.com/a/23841004
score: 0
tagged with: java
upvote count: 1
tagged with: swing
answer count: 1
downvote count: 1
tagged with: startup

http://stackoverflow.com/comment/36849992
has text: Done! I didn't accept initially because I was exploring to see if I could apply it to my use case. Thanks. :)
type: Comment
comment on: http://stackoverflow.com/a/23924810
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36823172
type: QuestionComment
comment on: http://stackoverflow.com/q/23911196
has text: Does [this question](http://stackoverflow.com/questions/18572088/how-to-get-oauth-2-refresh-token-using-access-token) help?
score: 0
type: Comment

http://stackoverflow.com/q/23911578
has comment: http://stackoverflow.com/comment/36823325
has comment: http://stackoverflow.com/comment/36820957
tagged with: java
has title: connected DHCP clients to a Router in java
has comment: http://stackoverflow.com/comment/36821798
tagged with: ip
type: Question
tagged with: dhcp
score: 0
has comment: http://stackoverflow.com/comment/36822977
has comment: http://stackoverflow.com/comment/36847379
has comment: http://stackoverflow.com/comment/36822085
answer count: 0
has body: To get the connected devices' ip address, I applied below approach Ping(ICMP) ip addresses. Example : (192.168.0.1 to 255 with time limit 5000ms). If device will not respond in 5000ms then it will drop the IP. For dropped IP addresses; find the http port(80) accessibility on that IP address.(But this failed again bcz of firewall). I downloaded utilities like IPScanner but this is also showing the same ip addresses as i am getting in my java code. Is there any way to ping by going through firewall? Edited: I am using this code(ICMP) to ping, InetAddress inet = InetAddress.getByAddress(new byte[] { (byte) 192, (byte) 168, 1,(byte)1 }); System.out.println("Sending Ping Request to " + inet); System.out.println(inet.isReachable(10000) ? "Host is reachable": ""); and if a IP is not reachable then I try to find its open HTTP port 80 by this code, HttpURLConnection urlcon = (HttpURLConnection) url.openConnection(); urlcon.connect(); if (urlcon.getResponseCode() == 200) { System.out.println("Connected"); }
type: UnansweredQuestion
tagged with: router

http://stackoverflow.com/q/23869027
accepted answer: http://stackoverflow.com/a/23869164
has comment: http://stackoverflow.com/comment/36739712
upvote count: 0
has answer: http://stackoverflow.com/a/23869164
tagged with: maven
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: How to use maven without setting M2_HOME system variable?
score: -1
type: Question
has comment: http://stackoverflow.com/comment/36739825
answer count: 1
tagged with: maven-3
favorite count: 0
has body: I have maven 3 setup on my D: drive. Due to lack of administrative access I dont want to set M2_HOME variable. Is there any other workaround for that? or not possible?

simpledateformat
tags question: http://stackoverflow.com/q/23919788
tags question: http://stackoverflow.com/q/23873575
tags question: http://stackoverflow.com/q/23821647
tags question: http://stackoverflow.com/q/23784765
tags question: http://stackoverflow.com/q/23859955
tags question: http://stackoverflow.com/q/23821792
tags question: http://stackoverflow.com/q/23864843
tags question: http://stackoverflow.com/q/23914287
tags question: http://stackoverflow.com/q/23826923
type: Tag
tag name: simpledateformat
tags question: http://stackoverflow.com/q/23791078
tags question: http://stackoverflow.com/q/23837689

http://stackoverflow.com/q/23928429
answer count: 2
has answer: http://stackoverflow.com/a/23929738
upvote count: 0
has comment: http://stackoverflow.com/comment/36852898
has body: I am a newbie to Java and am currently stuck with my assignment at school. I am trying to read the data from a file that has both strings and Integers. ------ *-----------------*---------- Sample data in the file John mathew 0 2 3 4 Brian Barrow 4 3 2 ------ *-----------------*---------- I was given the below piece of code I have all my results in a variable "atBatResults" Could some one tell me how do i red the data in the variable "atBatResults" how do i tell the computer "If atBatResult is an integer then do this else if it is a string then print it" while (input.hasNext()) { String lastName = input.next(); String firstName = input.next(); while (input.hasNextInt()) { int atBatResult = input.nextInt(); System.out.println(lastName); System.out.println(firstName); System.out.println(atBatResult); When i print the "atBatResult" i get a list of all the numbers in my input file.
favorite count: 0
has answer: http://stackoverflow.com/a/23928493
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36852736
downvote count: 1
has title: Reading data in a variable
tagged with: java
has comment: http://stackoverflow.com/comment/36852936
score: -1
type: Question

http://stackoverflow.com/comment/36855830
comment on: http://stackoverflow.com/q/23929819
score: 0
type: QuestionComment
has text: Wow you are right, thank you. Check the Problem 1 in the main post for a little update. I still don't know what to do tho...
type: Comment

http://stackoverflow.com/comment/36706363
comment on: http://stackoverflow.com/q/23851152
type: Comment
type: QuestionComment
has text: Example added to my answer - please make sure to click the up arrow and the checkmark if it helps
score: 0

http://stackoverflow.com/a/23860408
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23860062
has body: It is stopping because getview is called again and again when list items are visible thus resetting the view to avoid any frame skips/lag on the devices.. what you need to do is to create a view holder with boolean and set it as a tag to the view.. each time is it animating boolean should be true and false when it stops.. so when getview is called your progressbar animation is still starting or stopping depending on the boolean..
score: 3

http://stackoverflow.com/q/23909205
type: Question
answer count: 2
score: 0
has body: I don't know how to properly explain this, so here's a picture: You can see quite a bit of the background around the green line, especially at the start and below the line. How can I fix this?
type: UnansweredQuestion
tagged with: jprogressbar
tagged with: swing
has answer: http://stackoverflow.com/a/23909417
has answer: http://stackoverflow.com/a/23909822
has title: JProgressBar line smaller than the bar
tagged with: java

http://stackoverflow.com/comment/36762805
has text: @vikeng21 Yes its in the .m2 folder
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23881074
score: 0

http://stackoverflow.com/q/23790106
has answer: http://stackoverflow.com/a/23897044
answer count: 1
accepted answer: http://stackoverflow.com/a/23897044
score: 0
tagged with: java
tagged with: scenebuilder
has comment: http://stackoverflow.com/comment/36608849
type: Question
has body: I have an FXML file that does some certain animations with some right now static(so to speak) shapes that are hard-coded into the fxml. What I am trying to do is dynamically create shapes from Java Objects that have certain properties such as color which these objects will be pulling from a database and populate the fxml with these object based shapes, I am not sure how to go about doing this. Below is the code for the main class, I know why the error is happening but not sure how to do it any other way. public class TestConveyorView extends GuiceApplication { @Inject private GuiceFXMLLoader fxmlLoader; public Injector createInjector() { return Guice.createInjector(new AbstractModule() { @Override protected void configure() { } }); } public static void main(String[] args) { Application.launch(args); } @Override public void init(List&lt;Module&gt; modules) throws Exception { } @Override public void start(Stage stage) throws Exception { //GridPane root = new GridPane(); Parent root = fxmlLoader.load(getClass().getClassLoader().getResource("fxml/TestConveyorView.fxml")).getRoot(); Box box = new Box(1, red); Rectangle rectangle = new Rectangle(50,50,box.getColor()); // Can't seem to add it to the scene, problem occurs here. root.getChildren().add(rectangle); Scene scene = new Scene(root); // BackgroundImage background = new BackgroundImage(null, BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT); stage.setScene(scene); stage.show(); } }
has title: SceneBuilder 2.0 Dynamic shape generation
type: AnsweredQuestion
tagged with: javafx-2

http://stackoverflow.com/a/23963280
answers question: http://stackoverflow.com/q/23933057
type: AcceptedAnswer
has body: With MVC you could check componant if there are all validate before submitting here a good code it's helpful and good luck here is the code
accepted answer of: http://stackoverflow.com/q/23933057
score: 0
type: Answer

http://stackoverflow.com/comment/36635153
type: Comment
has text: @Vivek: You are only writing once (or a few times). The overhead for write operations shouldn't matter, and the overhead for _volatile reads_ is low.
comment on: http://stackoverflow.com/a/23813875
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36608787
score: 0
type: Comment
has text: Can you answer my previous question as well
comment on: http://stackoverflow.com/a/23799045
type: AnswerComment

http://stackoverflow.com/a/23914845
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23909111
upvote count: 2
has body: Try to replace m = (Message)response.getItems().get(i); with m = service.getMessage(response.getItems().get(i).getItemId());
answers question: http://stackoverflow.com/q/23909111

http://stackoverflow.com/a/23824768
score: 1
has body: Here is what I did at the end to make it work : _ticket = Login.getAlfTicket("admin", "alfresco"); String url = "http://localhost:8080/alfresco/service/api/upload"; MultiValueMap&lt;String, Object&gt; request = new LinkedMultiValueMap&lt;String, Object&gt;(); FileSystemResource rsc = new FileSystemResource("&lt;PATH_TO_FOLDER&gt;/the-file-name.txt"); request.add("filedata", rsc); request.add("siteid", "yoursite"); request.add("containerid", "documentLibrary"); request.add("uploaddirectory", "test"); //restTemplate is an instance of RestTemplate class restTemplate.postForEntity(url + "?alf_ticket=" + _ticket, request, String.class); Hope this help.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23780696
downvote count: 0

http://stackoverflow.com/a/23868984
has body: Maybe try to print an int? Instead of : frameRate = String.format("FPS %s", frameCount); Change it to: frameRate = String.format("FPS %d", frameCount);
type: Answer
answers question: http://stackoverflow.com/q/23868957
score: 0

http://stackoverflow.com/comment/36763485
type: Comment
has text: @Grigor,have you add any other layout in parent LinearLayout ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23881434

http://stackoverflow.com/q/23844502
accepted answer: http://stackoverflow.com/a/23844525
downvote count: 0
has comment: http://stackoverflow.com/comment/36692922
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36693249
has title: Rewind iterator
has answer: http://stackoverflow.com/a/23844525
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm making a game using Libgdx. In my main loop, I use an iterator to iterate through all the elements of my world. My World class look like this : public class World implements Iterable&lt;GameElement&gt; { ... public Iterator&lt;GameElement&gt; iterator() { return listGameElements.iterator(); } } But when I profile my application, there is a lot of allocations coming from the line listGameElements.iterator() (this line is called at every game loop, so a lot of times in a second). I wanted to put my iterator as an private attribute of my class, but the iterator can be used only one time. Is there a way to rewind an iterator, to avoid making more allocations?
tagged with: iterator

http://stackoverflow.com/a/23823152
has body: I'm concerned by your wording: When actionSate becomes true the addURL() method should be called. Do you realise that this if statement is evaluated just once, when the constructor is called? //constructor public buttons(){ if(actionState == true || hyperlinkState == true){ // &lt;-- only evaluated once addURL(field); System.out.println("URL added"); } } If actionState becomes true at a later time, the addURL() method will not be called. It's not clear from your code example whether you are even calling this constructor. Possible you are calling it in the loadData() method. However, since the last action of your action listener is to set actionState to true, there is no chance that your addURL() method is being called. Solution? You probably need to directly invoke the addURL() method from your action listener method. Ensure your action listener class has a reference to an instance of your Buttons class, then it can invoke the method directly. E.g. public class Foo { // private boolean actionState = false; remove this? private Buttons buttons; public Foo(Buttons buttons) { this.buttons = buttons; } private void actionListenerCalls(){ //action performed when user types url into input box and presses Enter key field.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e){ loadData(e.getActionCommand()); buttons.addURL((JTextField) e.getSource()); } } ); } }
upvote count: 1
answers question: http://stackoverflow.com/q/23823046
type: Answer
has comment: http://stackoverflow.com/comment/36652253
downvote count: 0
score: 1

http://stackoverflow.com/a/23807993
has comment: http://stackoverflow.com/comment/36623049
upvote count: 0
type: Answer
has body: try this httpReqquest.addHeader("Accept-Language","en-US");
downvote count: 1
has comment: http://stackoverflow.com/comment/36626276
score: -1
answers question: http://stackoverflow.com/q/23807445
has comment: http://stackoverflow.com/comment/36623891

http://stackoverflow.com/a/75896946
has body: If you are using maven you can include following dependency: org.apache.geronimo.specs geronimo-corba_3.0_spec 1.1
answers question: http://stackoverflow.com/q/23897604
score: 0
type: Answer

http://stackoverflow.com/a/23849252
accepted answer of: http://stackoverflow.com/q/23834170
answers question: http://stackoverflow.com/q/23834170
score: 0
type: AcceptedAnswer
type: Answer
has body: Add the directory containing the generated stub and skeleton code to your classpath. The JacORB jar is also required javac -cp /path/to/stubcode:jacorb.jar:. Server.java

http://stackoverflow.com/comment/36845395
score: 0
type: Comment
has text: Alter? Do you mean `radius = Math.sqrt(x*x + y*y)`?
comment on: http://stackoverflow.com/a/23924243
type: AnswerComment

http://stackoverflow.com/comment/36593408
has text: @FarhadAliNoo: it is a version for Java, but the same technic can be use with PCRE too. Take a look at this post: http://stackoverflow.com/questions/23001137/capturing-quantifiers-and-quantifier-arithmetic/23002044#23002044
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23791742

http://stackoverflow.com/q/23794481
possible better answer: http://stackoverflow.com/a/27086925
answer count: 2
has answer: http://stackoverflow.com/a/27086925
has title: CsvMapReader doesn't appear to parse my file
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23807596
tagged with: http://stackoverflow.com/tag/csv
has body: I have a very simple tsv file, with entries as so: 614 2006-07-13 15:30:05 2009-11-20 23:56:21 510 350 3265 10 34 1038 2006-07-15 16:12:15 2009-11-16 05:12:11 304 443 4405 7 156 1437 2006-07-16 12:29:24 2009-11-16 16:25:12 45 73 725 6 37 2615 2006-07-19 23:23:55 2009-11-27 18:34:36 211 230 211 7 0 3148 2006-07-26 14:17:22 2009-11-20 17:35:18 7346 7244 11438 8 97 5593 2006-09-08 10:58:49 2009-11-24 06:08:27 898 1024 2897 8 56 It does not have headers, and I'm getting it from another source, so I have no control over how it's written. I want to read in the first column, do something with it, and ignore the rest. My code is: List&lt;Long&gt; userIds = new ArrayList&lt;Long&gt;(); ICsvMapReader mapReader = null; try { mapReader = new CsvMapReader(new FileReader(inFile), CsvPreference.TAB_PREFERENCE); // only map the first column - setting header elements to null means those columns are ignored final String[] header = new String[] { "userid", null, null, null, null, null, null }; final CellProcessor[] processors = new CellProcessor[] {null, null, null, null, null, null, null }; Map&lt;String, Object&gt; userMap; while( (userMap = mapReader.read(header, processors)) != null ) { Long userId = Long.parseLong(userMap.get("userid").toString()); userIds.add(userId); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { IOUtils.closeQuietly(mapReader); } I get no exceptions, but the mapReader.read() line always returns null. I tried using new ParseLong() in place of null in the first position of the processor, and that had no effect. I feel like I'm missing something really basic.
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23807596
type: AnsweredQuestion
tagged with: supercsv

http://stackoverflow.com/comment/36868003
has text: I want the data returned from the servlet to be used in this function here: PDFJS.getDocument(data).then(function(pdf) {});
type: QuestionComment
comment on: http://stackoverflow.com/q/23936152
score: 0
type: Comment

http://stackoverflow.com/a/23814416
has body: Turns out Eclipse was setting different encodings for different files and it was breaking the characters. A similar post about this problem is here: Wrong Charset Encoding with Play Framework 2.1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23793589
accepted answer of: http://stackoverflow.com/q/23793589
type: Answer
score: 0

http://stackoverflow.com/comment/36665520
score: 0
type: Comment
has text: Sorry if my gesture seemed bit aggressive... and i apologize for the same... But try keeping an app on the foreground (which apparently not running a heavy process intensive task on the UI thread) and don't let the lights of your phone to get off, you will see it running as long as you don't close it.
comment on: http://stackoverflow.com/a/23823209
type: AnswerComment

http://stackoverflow.com/q/23835441
tagged with: https
type: Question
has comment: http://stackoverflow.com/comment/36750663
tagged with: ssl
has comment: http://stackoverflow.com/comment/36710941
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36748531
type: UnansweredQuestion
tagged with: web-services
has title: Receiving HTTP 302 error code when communicating with https web service
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/42390591
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/36750010
has body: I have a java web service hosted in Apache Tomcat. Tomcat Server.xml file have an entry like this: Connector port="8025" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" But, the port 8443 (suppose to be ssl port) is commented out. Using HTTPWatch, I noticed that server is redirecting the client request to http://sa-dev-sf.erp.net/testWSthree/service?wsdl. instead of https://.. and has following Header info in httpwatch: (Status-Line) HTTP/1.1 302 Found; Connection close Location sa-dev-sf.erp.net/testWSthree/service?wsdl Here is my client test class. If I deploy the client in tomcat server and call the service I am getting error (See log below). Please note this is working fine from my local machine using Eclipse IDE import a.Service; //from wsimport import a.ServiceImplService; //from wsimport public class Call { public String callTest(){ ServiceImplService serviceImpl = new ServiceImplService(); Service s = serviceImpl.getServiceImplPort(); final BindingProvider getResultBP = (BindingProvider) s ; getResultBP.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"https://sa-dev.erp.xxxx.net/testWSthree/service"); System.out.println(s.salaryUpgrade("sanjoy")); }} Here are the two classes generated by wsimport: @WebService(name = "Service", targetNamespace = "http://a/") @SOAPBinding(style = SOAPBinding.Style.RPC) public interface Service { /** * @param name * @return returns java.lang.String */ @WebMethod(operationName = "SalaryUpgrade") @WebResult(partName = "return") @Action(input = "http://a/Service/SalaryUpgradeRequest", output = "http://a/Service/SalaryUpgradeResponse") public String salaryUpgrade( @WebParam(name = "name", partName = "name") String name); } and @WebServiceClient(name = "ServiceImplService", targetNamespace = "http://a/", wsdlLocation = "https://sa-dev.erp.xxxxx.net/testWSthree/service?wsdl") public class ServiceImplService extends javax.xml.ws.Service { private final static URL SERVICEIMPLSERVICE_WSDL_LOCATION; pr…

http://stackoverflow.com/q/23795249
has title: How do I get the path of a resource when using Maven?
type: Question
accepted answer: http://stackoverflow.com/a/23795294
has answer: http://stackoverflow.com/a/23795439
answer count: 3
downvote count: 0
tagged with: maven-2
favorite count: 0
has comment: http://stackoverflow.com/comment/36599445
has answer: http://stackoverflow.com/a/23795362
has answer: http://stackoverflow.com/a/23795294
has comment: http://stackoverflow.com/comment/36599419
tagged with: maven
has body: This is what I've tried: String myPath = myStaticClass.class.getResource("en-us").getPath(); // returns C:/Users/Charles/Workspace/ProjectName/target/classes/ My resources are in C:/Users/Charles/Workspace/ProjectName/src/main/resources Does anyone know why this is happening? Edit: I suppose I should have mentioned that the path is being used in a library to load resources, but is failing.
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/23795362
upvote count: 2
tagged with: java

http://stackoverflow.com/a/23936740
answers question: http://stackoverflow.com/q/23936636
type: Answer
has comment: http://stackoverflow.com/comment/36868102
upvote count: 3
has comment: http://stackoverflow.com/comment/36868130
has comment: http://stackoverflow.com/comment/36868060
score: 3
has comment: http://stackoverflow.com/comment/36868035
downvote count: 0
has body: Since you don't care about the map values, you only need to iterate over the keySet: Iterator&lt;Date&gt; iter = weeks.keySet().iterator(); while (iter.hasNext()) { if (iter.next().before(monDate)) iter.remove(); else return; // since TreeMap is sorted by key }

http://stackoverflow.com/q/23825442
has comment: http://stackoverflow.com/comment/36657293
answer count: 4
upvote count: 2
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/13670692
has answer: http://stackoverflow.com/a/23825713
has comment: http://stackoverflow.com/comment/36656773
type: Question
has answer: http://stackoverflow.com/a/23825937
has answer: http://stackoverflow.com/a/23825573
has comment: http://stackoverflow.com/comment/36657025
has comment: http://stackoverflow.com/comment/36657799
has title: java.net.UnknownHostException:www.google.com
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/55529563
favorite count: 0
tagged with: exception
has body: I am developing a sanity check web application. I tried getting url response using HttpUrlConnection method but I am getting UnknownHostException. System.setProperty("java.net.preferIPv4Stack" , "true"); String[] uat_targetUrls={"https://www.google.com"}; String[] uat_targetResponse=new String[uat_targetUrls.length]; HttpURLConnection httpUrlConn; httpUrlConn = (HttpURLConnection) new URL(uat_targetUrls[i]) .openConnection(); httpUrlConn.setRequestMethod("GET"); httpUrlConn.setConnectTimeout(30000); httpUrlConn.setReadTimeout(30000); if(httpUrlConn.getResponseCode()==200) uat_targetResponse[i]="UP"; else uat_targetResponse[i]="DOWN"; When executing this, I am getting UnknownHostException for various urls. Can anyone help me on this. I am using Eclipse IDE. This is the error I am getting: java.net.UnknownHostException: www.google.com at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) Thanks.

http://stackoverflow.com/q/23863543
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23863630
answer count: 3
has answer: http://stackoverflow.com/a/23863686
accepted answer: http://stackoverflow.com/a/23863686
tagged with: arrays
has title: cost of retrieving an element from array in java
linked to: http://stackoverflow.com/q/8648826
has comment: http://stackoverflow.com/comment/36729863
duplicate of: http://stackoverflow.com/q/20615908
favorite count: 0
possible better answer: http://stackoverflow.com/a/23863630
has answer: http://stackoverflow.com/a/23863765
has comment: http://stackoverflow.com/comment/36730259
type: AnsweredQuestion
score: 2
has body: I have one very basic question. In java(or I think valid for any similar language), what's the retrieval time of an element from an array. Since the size of array and its element type is a constant known at compile time or computed at run-time, I believe that retrieval should happen in constant time, O(1). For example, int[] arr = new int[10]; Though I am not sure of internal memory representation of array, I think operation like arr[3], should directly access memory after calculating address from array start address, size of element type(here 32) and index passed(here 3) something like below: address of arr[3] = address of a[0] + 32 * 3. Thanks for the help.
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36730631
has comment: http://stackoverflow.com/comment/36730218
has comment: http://stackoverflow.com/comment/36731031

http://stackoverflow.com/a/23786536
has body: You don't need to do this one byte at a time. I would just do all the bytes at once. int length = input.available(); byte[] array = new byte[length]; String logText = new String(array, 0); // assume ISO-8859-1 encoding
upvote count: 2
has comment: http://stackoverflow.com/comment/36611683
type: Answer
answers question: http://stackoverflow.com/q/23786426
score: 2
downvote count: 0

http://stackoverflow.com/q/23933057
tagged with: java
possible better answer: http://stackoverflow.com/a/23940303
tagged with: forms
has answer: http://stackoverflow.com/a/23940303
answer count: 2
has body: I'm new in zk ,I have a form with field and I defined some constraint on those fields and a submit button ,who can I link the submit button with the form and fields ,so I want click on the button the fields where the constraint not satisfied will appear in red ,Now my button doesn't see if the constraint are satisfied ,I know that I could verify in java code but that will not make the fields.
has title: How to link the ZK form with submit button
accepted answer: http://stackoverflow.com/a/23963280
tagged with: zk
type: AnsweredQuestion
tagged with: form-submit
score: 0
type: Question
has answer: http://stackoverflow.com/a/23963280

http://stackoverflow.com/q/23911460
tagged with: java
accepted answer: http://stackoverflow.com/a/23937043
type: Question
has body: As the title suggests, i am in the process of creating a client/server application where the server(PHP) reads a file which is being written on by ffmpeg and then outputs it to the client(JAVA). I have succeeded in writing the server script in php which initiates the ffmpeg and then after a while starts to read the file and concurrently sends it to the JAVA client, the problem is that after a while the client stops to receive any sort of data and then just quits, For example if i have a 5MB file, it would read only 12KB and then it quits. Could someone tell what can be the issue here? Is it on the server side or on the client side. For References i am attaching both the reading of file code in php and the client side code. Code For Reading the file while FFMPEG converts the file(PHP): $file = 'D:\\'.$destination; $fp = @fopen($file, 'r'); //ob_end_clean(); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header("Cache-control: private"); header('Pragma: private'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header('Content-Length: ' . filesize($file)); $buffer = 4096; while(!feof($fp)) { usleep(300000); echo fread($fp, $buffer); ob_flush(); flush(); } fclose($fp); exit(); Code For reading the File transferred by PHP (JAVA): URL u = new URL(streamURL); clientSocket = (HttpURLConnection) u.openConnection(); if( clientSocket.getResponseCode() == HttpURLConnection.HTTP_OK ){ //clientSocket.setReadTimeout(0); inRemoteStream = clientSocket.getInputStream(); while (((count = inRemoteStream.read(buf)) != -1)) { offset += count; System.out.println(offset); fileOutputStream.write(buf, 0, count); setVideoOffset(offset, contentLength); } I`ll be very happy if someone can solve this problem for me :) .
answer count: 1
favorite count: 0
has title: Reading a File while it is being written by FFMPEG
has answer: http://stackoverflow.com/a/23937043
tagged with: ffmpeg
upvote count: 2
score: 1
tagged with: php
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23789411
tags question: http://stackoverflow.com/q/23917717
tags question: http://stackoverflow.com/q/23813704
tags question: http://stackoverflow.com/q/23858599
tags question: http://stackoverflow.com/q/23843788
tags question: http://stackoverflow.com/q/23821265
tags question: http://stackoverflow.com/q/23814615
tags question: http://stackoverflow.com/q/23846370
tags question: http://stackoverflow.com/q/23907035
tags question: http://stackoverflow.com/q/23864828
tags question: http://stackoverflow.com/q/23902271
tags question: http://stackoverflow.com/q/23853396
tags question: http://stackoverflow.com/q/23779674
tags question: http://stackoverflow.com/q/23874491
tags question: http://stackoverflow.com/q/23896021
tags question: http://stackoverflow.com/q/23916595
tags question: http://stackoverflow.com/q/23832934
tags question: http://stackoverflow.com/q/23864935
tags question: http://stackoverflow.com/q/23836397
tags question: http://stackoverflow.com/q/23843729
type: Tag
tags question: http://stackoverflow.com/q/23887667
tags question: http://stackoverflow.com/q/23926065
tags question: http://stackoverflow.com/q/23883023
tags question: http://stackoverflow.com/q/23824082
tags question: http://stackoverflow.com/q/23798341
tags question: http://stackoverflow.com/q/23807863
tags question: http://stackoverflow.com/q/23881919
tags question: http://stackoverflow.com/q/23902161
tags question: http://stackoverflow.com/q/23789049
tags question: http://stackoverflow.com/q/23867256
tags question: http://stackoverflow.com/q/23842920
tags question: http://stackoverflow.com/q/23939109
tags question: http://stackoverflow.com/q/23789320
tags question: http://stackoverflow.com/q/23784558
tags question: http://stackoverflow.com/q/23806784
tags question: http://stackoverflow.com/q/23909344
tags question: http://stackoverflow.com/q/23819095
tags question: http://stackoverflow.com/q/23865287
tags question: http://stackoverflow.com/q/23810388
tags question: http://stackoverflow.com/q/23834981
tags question: http://stackoverflow.com/q/23921658
tags question: http://stackoverflow.com/q/23918426
tags question: http://stackoverflow.com/q/23904705
tags question: http://stackoverflow.com/q/23904508
tags question: http://stackoverflow.com/q/23934725
tags question: http://stackoverflow.com/q/23783593
tags question: http://stackoverflow.com/q/23812574
tags question: http://stackoverflow.com/q/23813779
tags question: http://stackoverflow.com/q/23846498
tags question: http://stackoverflow.com/q/23846950
tags question: http://stackoverflow.com/q/23933009
tags question: http://stackoverflow.com/q/23897335
tags question: http://stackoverflow.com/q/23866937
tags question: http://stackoverflow.com/q/23832707
tags question: http://stackoverflow.com/q/23843125
tags question: http://stackoverflow.com/q/23916843
tags question: http://stackoverflow.com/q/23889279
tags question: http://stackoverflow.com/q/23924827
tags question: http://stackoverflow.com/q/23866602
tags question: http://stackoverflow.com/q/23868527
tags question: http://stackoverflow.com/q/23880718
tags question: http://stackoverflow.com/q/23899416
tag name: xml
tags question: http://stackoverflow.com/q/23890541
tags question: http://stackoverflow.com/q/23857169
tags question: http://stackoverflow.com/q/23843285
tags question: http://stackoverflow.com/q/23878112
tags question: http://stackoverflow.com/q/23908606
tags question: http://stackoverflow.com/q/23886463
tags question: http://stackoverflow.com/q/23815195
tags question: http://stackoverflow.com/q/23914998
tags question: http://stackoverflow.com/q/23917900
tags question: http://stackoverflow.com/q/23797026
tags question: http://stackoverflow.com/q/23809490
tags question: http://stackoverflow.com/q/23800647
tags question: http://stackoverflow.com/q/23794617
tags question: http://stackoverflow.com/q/23876798
tags question: http://stackoverflow.com/q/23884720
tags question: http://stackoverflow.com/q/23889389

http://stackoverflow.com/a/23805596
type: Answer
has body: First of all you need to extract the text from the text field. In your example url is the object of type TextField. Call its getText method to get the contents of the text field. That will be a String. So do it like this: x.format("%s\n", url.getText()); Assuming that you are storing a new url on a different line. Otherwise you can use your own seperator.
answers question: http://stackoverflow.com/q/23803762
score: 0

http://stackoverflow.com/q/23782996
has title: page not redirecting in controller
tagged with: spring
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/23783060
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23783060
has answer: http://stackoverflow.com/a/23783146
tagged with: java
has body: This my link Create Form this is my controller @ResponseBody @RequestMapping("/createform") public String createform(Model uiModel, HttpServletRequest request) { //some other codes return "form"; } and this is my view.xml <put-attribute name="content" value="/WEB-INF/views/jsps/tags/Form.jsp" /> My problem is Form.jsp is not opening.When hit the link the URL changes to `localhost:8080/pro/createform' but the contents of Form.jsp is not opening instead I am getting only one word "form". When I debug then I can see the control is going to controller but the contents of Form.jsp is not opening Can any body tell me the reason?
type: Question
score: 0
answer count: 2
tagged with: jsp
has comment: http://stackoverflow.com/comment/36576262
accepted answer: http://stackoverflow.com/a/23783146

http://stackoverflow.com/comment/36653231
score: 1
type: Comment
has text: This should work. Have you tried to clean/reload/rebuild your project?
type: QuestionComment
comment on: http://stackoverflow.com/q/23815645

http://stackoverflow.com/comment/36621347
has text: What is your servlet name and are you using eclipse ide?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23805909

http://stackoverflow.com/comment/36687395
has text: I see that when the option objects are components, then it should work as expected. Why is that we should pass the icons instead? Can you please explain?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23841400
type: Comment

http://stackoverflow.com/comment/36719434
has text: Instead of parsing the error message, rather check for the SQL error number
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23858082

http://stackoverflow.com/q/23846950
has answer: http://stackoverflow.com/a/23847025
type: UnansweredQuestion
tagged with: android
tagged with: android-fragments
tagged with: java
has title: Access Fragment Class Method From FragmentActivity Class in Android
type: Question
tagged with: android-layout
has body: I'm trying to achieve access Fragment Method from FragmentActivity Class and change some TextView in that Fragment Layout. My MainActivity extends FragmentActivty (v4) and its layout -> activity_main.xml: &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/android.support.v4.view.ViewPager&gt; SelectionFragment class Extends Fragment which has updateLoadMembersData() method (v4) and its layout -> selection_fragment.xml which contains , tags etc. In MainActivity Class I'm tryin to run this code: protected void onResume() { super.onResume(); viewPager.setCurrentItem(0); SelectionFragment instanceFragment = (SelectionFragment) getSupportFragmentManager().findFragmentById(R.layout.selection_fragment); instanceFragment.updateLoadMembersData(); Toast.makeText(this, "Saved Data Succesfully Added!", Toast.LENGTH_LONG); } instanceFragment.updateLoadMembersData(); This method try to change some textViews editTexts etc i could not run this method. But I'm getting errors such as ClassCastException i looked some question like that but could not find and reasonable solution.I'dont have fragment /fragment tags i have only /android.support.v4.view.ViewPager in activity_main.xml.
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23885901
has answer: http://stackoverflow.com/a/23886156
has body: I am trying to send email from Java using Java mail APIs in Eclipse and it is working fine if I give the full email address in the TO address. But I could see in outlook and all if i give the user id (8 character length ) and press Ctrl + K, it is changed to email address. So is there any facility by which we can give user id in the TO address column which will be mapped to the corresponding email id ?
type: Question
score: 1
tagged with: java
tagged with: jakarta-mail
answer count: 3
has title: Java Mailing API - To address
downvote count: 0
has answer: http://stackoverflow.com/a/23886461
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36772126
has answer: http://stackoverflow.com/a/23886292
upvote count: 1

http://stackoverflow.com/comment/36643515
type: Comment
type: QuestionComment
has text: Do you have `log4j.xml` or `log4j.properties` in the classpath of the project?
comment on: http://stackoverflow.com/q/23818520
score: 0

http://stackoverflow.com/q/23929380
type: AnsweredQuestion
has title: How to send request, by using RESTFul web services?
tagged with: java
type: Question
tagged with: ios
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/23930870
answer count: 1
has body: I have sucessfully received value from http://rest-service.guides.spring.io/greeting by using RESTFul and json web services. But unable to send my own text box value in request to my own server running apache on another machine. my working code -: - (IBAction)fetchGreeting; { NSURL *url = [NSURL URLWithString:@"http://rest-service.guides.spring.io/greeting"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { if (data.length &gt; 0 &amp;&amp; connectionError == nil) { NSDictionary *greeting = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; self.greetingId.text = [[greeting objectForKey:@"id"] stringValue]; self.greetingContent.text = [greeting objectForKey:@"content"]; } }]; } But it stop working when i change NSURL *url = [NSURL URLWithString:@"http://rest-service.guides.spring.io/greeting"]; value to my own server address, and also unable to wrap my own text box value in request.
tagged with: spring
accepted answer: http://stackoverflow.com/a/23930870

http://stackoverflow.com/a/23885913
upvote count: 1
answers question: http://stackoverflow.com/q/23885071
has comment: http://stackoverflow.com/comment/36777355
has comment: http://stackoverflow.com/comment/36777497
score: 1
has body: Your criteria query doesn't seem right. You are trying to filter by an instance of media entity but passing the name as parameter. Try something like this: criteria.add(Restrictions.eq("media", this));
downvote count: 0
has comment: http://stackoverflow.com/comment/36778482
type: Answer
has comment: http://stackoverflow.com/comment/36772745

http://stackoverflow.com/comment/36677652
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23836004
score: 0
has text: One question, why "may be" , is it cause perhaps it's was calculated before? or something else?

http://stackoverflow.com/q/23888289
favorite count: 0
tagged with: arraylist
tagged with: android
type: AnsweredQuestion
has title: How to retrieve a value in ArrayList<Object> where it contains two different object type arraylist..?
upvote count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/23888372
has body: I have two ArrayList of types ArrayList&lt;ObjectType1&gt; and ArrayList&lt;ObjectType2&gt;. Then I have created another ArrayList&lt;Object&gt; as object is super class of every object type. ArrayList&lt;Object1&gt; obj1 = new ArrayList&lt;Object1&gt;(); ArrayList&lt;Object2&gt; obj2 = new ArrayList&lt;Object2&gt;(); These two object class has its own specific getters and setters method. ArrayList&lt;Object&gt; obj3 = new ArrayList&lt;Object&gt;(); obj3.add(obj1); obj3.add(obj2); Now when I am accessing obj3 I want to fetch obj1 and obj2's getters and setters.?? Can any one please help for a solution..???
type: Question
has answer: http://stackoverflow.com/a/23888514
has answer: http://stackoverflow.com/a/23888372
tagged with: object
tagged with: java
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36776292
has answer: http://stackoverflow.com/a/23888488
accepted answer: http://stackoverflow.com/a/23888514
has comment: http://stackoverflow.com/comment/36776327

http://stackoverflow.com/comment/36744323
type: Comment
comment on: http://stackoverflow.com/a/23871185
has text: See my update, maybe that helps, if the problem you are facing is that you want to access the cardlayout from the panel
type: AnswerComment
score: 0

http://stackoverflow.com/a/23928674
has comment: http://stackoverflow.com/comment/36872536
has comment: http://stackoverflow.com/comment/36853773
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23928279
has comment: http://stackoverflow.com/comment/36855463
has comment: http://stackoverflow.com/comment/36853988
accepted answer of: http://stackoverflow.com/q/23928279
type: Answer
has body: onCreate is executed in the application's Main (or UI) thread. If you try to do network operations in the UI thread you will get a NetworkOnMainThreadException. One way to fix this is to use a AsyncTask like in the answer here. Also note that you can't touch the views from doInBackground. You can set the values to the TextView from onPostExecute.
has comment: http://stackoverflow.com/comment/36855894
score: 0

http://stackoverflow.com/q/23926306
tagged with: tomcat6
type: Question
has body: I integrated Tomcat 6 into Eclipse Indigo. When I start the server in Eclipse, it shows that Tomcat is up and running, but when I go to localhost:8080 in my browser, it does not respond at all. I have Tomcat server entry in the Servers tab with "Use Tomcat Installation" and it didnt help me. I have removed my entire projects from eclipse and started importing it again to set it up from the beginning and it didnt help either. Could you please some help me out?
has comment: http://stackoverflow.com/comment/36852326
score: 0
has comment: http://stackoverflow.com/comment/36849061
has answer: http://stackoverflow.com/a/23926720
answer count: 1
has comment: http://stackoverflow.com/comment/36851991
has title: Tomcat 6 is running in Eclipse but localhost:8080 never responds in browser
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36849004
has comment: http://stackoverflow.com/comment/36849052
has comment: http://stackoverflow.com/comment/36849086
has comment: http://stackoverflow.com/comment/36849399
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36683341
type: Comment
has text: With the `close()` changed to `flush()`, you have an infinite loop. Once again, is this your actual code?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23837630

http://stackoverflow.com/comment/36798034
has text: You`re right. Better practice is to have JVM properly configured rather than manually override timezone each call.
type: AnswerComment
comment on: http://stackoverflow.com/a/23899179
score: 0
type: Comment

http://stackoverflow.com/comment/36855912
type: Comment
has text: What are the specific places?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23930117

http://stackoverflow.com/q/23938276
answer count: 2
has comment: http://stackoverflow.com/comment/36871762
has comment: http://stackoverflow.com/comment/36871186
has answer: http://stackoverflow.com/a/23940588
has comment: http://stackoverflow.com/comment/36871285
has title: java program not getting inside while loop for unique row result set
possible better answer: http://stackoverflow.com/a/23939307
has comment: http://stackoverflow.com/comment/36874171
tagged with: oracle9i
score: 0
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/23940588
has body: I have a result set that should contain 1 row (I have tested this). My program is not getting inside the while(rs2.next()) loop, I have noticed this after debugging. that's why I'm getting SQLException : not all variables bound. ResultSet constitues = cnx.createStatement().executeQuery(Request.getConstitues()); while(constitues.next()){ PreparedStatement ps = cnx.prepareStatement(Request.setNewConstitue()); PreparedStatement ps2 = cnx.prepareStatement(Request.getDossierFromNumeroParcelle()); ps2.setInt(1, constitues.getInt("NUM_ORDRE")); ps2.setInt(2, constitues.getInt("NUM_PARCELLE")); //rs2 contains one row ResultSet rs2 = ps2.executeQuery(); // Program is not entering this loop while(rs2.next()){ ps.setInt(1, rs2.getInt("NUM_DOSSIER")); ps.setString(2, rs2.getString("INDICE")); ps.setString(3, constitues.getString("OBSERVATIONS")); ps.setInt(4, constitues.getInt("TYPE_CONSISTANCE")); } ps.executeUpdate(); rs2.close(); ps.close(); } Request.getConstitues() is : select * from PARC_CONSTITUES Request.setNewConstitue() is : Insert into CONSTITUE(NUM_DOSSIER,INDICE,Observation,CODE_CONSISTANCE) values(?,?,?,?) Request.getDossierFromNumeroParcelle() is : select NUM_DOSSIER,INDICE from PARC_PARCELLES where num_ordre = ? and num_parcelle= ? Why program is not getting inside the while loop ?
has comment: http://stackoverflow.com/comment/36871949
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23939307
type: Question
has comment: http://stackoverflow.com/comment/36871392

http://stackoverflow.com/comment/36705865
score: 2
has text: What does it do, and what do you expect it to do?
type: QuestionComment
comment on: http://stackoverflow.com/q/23851030
type: Comment

http://stackoverflow.com/a/23921334
score: 0
answers question: http://stackoverflow.com/q/23920872
has body: Try with: ApplicationContext APPLICATION_CONTEXT = new ClassPathXmlApplicationContext("/spring/context/application-context.xml"); If it does not work, try putting application-context.xml directly in src/main/resources and then load it with ApplicationContext APPLICATION_CONTEXT = new ClassPathXmlApplicationContext("application-context.xml");
type: Answer

http://stackoverflow.com/comment/36794100
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23897265
score: 0
has text: possible duplicate of [handling iframe in webdriver](http://stackoverflow.com/questions/9942928/handling-iframe-in-webdriver)

http://stackoverflow.com/a/23858876
type: Answer
has comment: http://stackoverflow.com/comment/36721316
upvote count: 13
downvote count: 1
has comment: http://stackoverflow.com/comment/36721254
has body: You can use the javax.ws.rs.CookieParam annotation on an argument of your method. @POST @Path("/search") public SearchResponse doSearch( SearchRequest searchRequest, @CookieParam("cookieName") Cookie cookie ) { //method body } The Cookie class used here is javax.ws.rs.core.Cookie but you don't have to use it. You can use this annotation on any argument as long as is: is a primitive type is a Cookie (same as in the example above) has a constructor that accepts a single String argument has a static method named valueOf or fromString that accepts a single String argument (see, for example, Integer.valueOf(String)) havs a registered implementation of ParamConverterProvider JAX-RS extension SPI that returns a ParamConverter instance capable of a "from string" conversion for the type. Be List&lt;T&gt;, Set&lt;T&gt; or SortedSet&lt;T&gt;, where T satisfies 2, 3, 4 or 5 above. The resulting collection is read-only. These rules come from the documentation of the @CookieParam annotation as implemented in Jersey, the reference implementation of JAX-RS
score: 12
has comment: http://stackoverflow.com/comment/36721170
accepted answer of: http://stackoverflow.com/q/23858807
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36721226
answers question: http://stackoverflow.com/q/23858807

http://stackoverflow.com/comment/36729678
has text: just changed the comma for a dot
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23863451

http://stackoverflow.com/comment/49817967
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27321783
score: 2
has text: If you want to use your Converter by default (on all entities). You can edit your Converter with this annotation: @Converter(autoApply = true)

http://stackoverflow.com/comment/36725828
type: QuestionComment
has text: @MadProgrammer I have having trouble with the actionlistener and the `getImage()` method part in the `MainCharacter` class
comment on: http://stackoverflow.com/q/23860755
type: Comment
score: 0

http://stackoverflow.com/a/24056288
answers question: http://stackoverflow.com/q/23916429
has comment: http://stackoverflow.com/comment/112451963
has body: The IzPack doc. page here gives an overview of using OS Restrictions. Also, within that page you'll find a link to A List of known OS names and architectures.. or click here. After a brief reading of the page @ 2nd-link-above, it seems that os arch=x86_64 works for Linux family and, as such, it isn't listed for windows 64-bit. At the end of that page you'll find a sample code to find out the values of os.name, os.version and os.arch specific to your system. you may use these values directly in &lt;os arch="XXX"/&gt; the page also mentions that Values that only match the beginning of os.name or os.arch are also valid (e.g. if you specify Windows and the os.name is Windows 98, for example, everything works out fine) so there IS some flexibility in naming conventions. also, once you get this working for your system, pls email your combination of os.name, version and arch to the email address mentioned in the above page so that they too can be listed.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37111985
accepted answer of: http://stackoverflow.com/q/23916429

maven-jaxb2-plugin
type: Tag
tag name: maven-jaxb2-plugin
tags question: http://stackoverflow.com/q/23781719

http://stackoverflow.com/a/23841639
type: Answer
has body: data.createEntry(0, 0, totalWater, 0, 0, 0, 0, 0, 0, 0); &amp; String[] columns = new String[] {KEY_ROWID, KEY_ROCK, KEY_METEORROCK, KEY_WATER, KEY_POPULATION, KEY_SHOVEL, KEY_BUCKET, KEY_PICKAXE, KEY_SHOVELEXP, KEY_BUCKETEXP, KEY_PICKAXEEXP}; columns are not match
score: 0
answers question: http://stackoverflow.com/q/23841386
has comment: http://stackoverflow.com/comment/36723989

http://stackoverflow.com/comment/36693623
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23843068
type: AnswerComment
has text: @Andy \w is a word character, not a whole word

http://stackoverflow.com/q/23911847
has body: I have some problems with my GF4 and SSL. I have installed GF4 and made every change listed at this tutorial Everything went fine but now that I want to use the GF Server online and on an pruductiv enviroment, I want to change the SSL Cert to a bought one. I already bought a SSL123 Thawte SSL Cert which is just Domain signed (should be enough for starters). Now I have the .key the .csr and .crt file. I already looked up, how to import a given Key and CRT File into an existing Keystore. (using openssl and producing and p12 file) Now if I just stop the GF domain and erase the two alias "s1as" and "glassfish-instance" and import the new SSL Cert under this alias, I cannot start the domain again. I get the following two errors in the server.log: [2014-05-28T14:33:55.105+0200] [glassfish 4.0] [WARNING] [] [org.glassfish.grizzly.config.SSLConfigurator] [tid: _ThreadID=28 _ThreadName=http-listener-2(4)] [timeMillis: 1401280435105] [levelValue: 900] [[ GRIZZLY0050: SSL support could not be configured! java.io.IOException: A MultiException has 2 exceptions. They are: 1. java.lang.Error: java.security.UnrecoverableKeyException: Cannot recover key 2. java.lang.IllegalStateException: Unable to perform operation: post construct on com.sun.enterprise.security.ssl.SSLUtils at org.glassfish.grizzly.config.ssl.JSSE14SocketFactory.init(JSSE14SocketFactory.java:162) at org.glassfish.grizzly.config.SSLConfigurator.initializeSSLContext(SSLConfigurator.java:249) at org.glassfish.grizzly.config.SSLConfigurator.configureSSL(SSLConfigurator.java:131) at org.glassfish.grizzly.config.SSLConfigurator$InternalSSLContextConfigurator.createSSLContext(SSLConfigurator.java:389) at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:180) at org.glassfish.grizzly.ssl.SSLBaseFilter$SSLTransportFilterWrapper.handleRead(SSLBaseFilter.java:968) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterc…
tagged with: https
type: Question
tagged with: ssl
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/30115033
has title: Glassfish 4.0 SSL cert from Thawte
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: glassfish-4

source-maps
type: Tag
tag name: source-maps
tags question: http://stackoverflow.com/q/23850898

http://stackoverflow.com/q/23799561
has comment: http://stackoverflow.com/comment/36607485
tagged with: tomcat
favorite count: 0
has body: I am trying to install apache-tomcat-6.0.35 on Mac OS x 10.9, but I have this error in catalina.out when I run startup.sh : /Library/Tomcat/Home/bin/catalina.sh: line 375: /Library/Java/Home/bin/java: No such file or directory And thus, the server isn't launched. Here is what I get in terminal (bash) : myMac:bin administrator$ ./startup.sh Using CATALINA_BASE: /Library/Tomcat/Home Using CATALINA_HOME: /Library/Tomcat/Home Using CATALINA_TMPDIR: /Library/Tomcat/Home/temp Using JRE_HOME: /Library/Java/Home Using CLASSPATH: /Library/Tomcat/Home/bin/bootstrap.jar Any advice?
has title: Tomcat 6.0.35 installation on Mac OS X Mavericks 10.9
tagged with: macos
has comment: http://stackoverflow.com/comment/36609308
upvote count: 5
has answer: http://stackoverflow.com/a/24515278
type: UnansweredQuestion
score: 1
tagged with: osx-mavericks
tagged with: java
tagged with: tomcat6
type: Question
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/23799813

http://stackoverflow.com/comment/36678647
type: Comment
type: QuestionComment
score: 2
has text: I never had one, I'm learning on my own right now.
comment on: http://stackoverflow.com/q/23836980

http://stackoverflow.com/a/23889922
score: 0
has body: You can use this piece of code: String input = "@Table(name = \"T_MEM_MEMBER_ADDRESS1\")"; String regexPattern=".*\"(.*)\".*"; Pattern pattern = Pattern.compile(regexPattern); Matcher matcher = pattern.matcher(input); boolean matches = matcher.matches(); if (matches){ System.out.println(matcher.group(1)); } Hope it helps.
answers question: http://stackoverflow.com/q/23889675
type: Answer

http://stackoverflow.com/comment/36874208
score: 0
type: Comment
type: QuestionComment
has text: Hi Luiggi, we have no visibility on the parameter we will recieve. do you have any suggestion to solve the issue without the usage of scriptlets?
comment on: http://stackoverflow.com/q/23938957

http://stackoverflow.com/comment/36575842
score: 1
comment on: http://stackoverflow.com/a/23782336
type: AnswerComment
has text: It might be a bug in the Scala IDE (once the thread is stopped again after `invokeMethod`, it should refresh it's stack frame variables and propagate the change to the variable view). We could discuss on the [scala-ide-dev](https://groups.google.com/forum/#!forum/scala-ide-dev) group.
type: Comment

http://stackoverflow.com/a/23859948
answers question: http://stackoverflow.com/q/23858751
has body: when Tomee start up, You can see the log of config JPA Persistence Unit. If there wasn't log about that, make sure your META-INF directory at the root class path.
type: Answer
downvote count: 1
upvote count: 0
score: -1

http://stackoverflow.com/comment/36995621
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23984139
has text: The solution of creating an intermediary interface definitely gets around this but muddies the code. We're choosing to scope to broadly for this one class where we have the issue.
type: AnswerComment

communication
tag name: communication
tags question: http://stackoverflow.com/q/23843694
type: Tag

http://stackoverflow.com/comment/36770889
type: QuestionComment
comment on: http://stackoverflow.com/q/23885342
score: 1
has text: possible duplicate of [Java : accessing annotations through reflection](http://stackoverflow.com/questions/2286998/java-accessing-annotations-through-reflection)
type: Comment

http://stackoverflow.com/a/23829235
answers question: http://stackoverflow.com/q/23829118
has comment: http://stackoverflow.com/comment/36663659
score: 0
has comment: http://stackoverflow.com/comment/36664044
has body: There is a great class in java which is call Scanner and can be use for many things related to the stream data. File file = new File("data.txt"); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); System.out.println(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } You can use it for a file. It will read line by line. Here it's printing but store it in array and it's done !
has comment: http://stackoverflow.com/comment/36663552
type: Answer

http://stackoverflow.com/a/23863759
accepted answer of: http://stackoverflow.com/q/23852451
has body: why would you want to do that? If you use terradata as a data warehouse, you could feed it in a separate, asynchronous process. That being said, you don't strictly need an XA driver to run as part of a JTA transaction. Of course, not doing so leads you to make some compromise, especially in case of recovery. All JTA-aware transaction managers I know have the notion of Last Resource Commit (or LRC, check this page for more details). You could configure your Teradata datasource as LRC. Resources Bitronix config Atomikos config
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23852451
type: Answer

http://stackoverflow.com/comment/36729414
type: Comment
has text: Like examining other fields? stock.getFoo().equals("something")? Or any other case?
comment on: http://stackoverflow.com/a/23863032
score: 0
type: AnswerComment

http://stackoverflow.com/a/23828844
score: 2
has body: I am not sure where did you get this path but I assume that \ before space was added to escape it so you need to change your method to also remove this \ before space. Also since this method doesn't affect state of instance of your class you can make it static. private static String replaceWhitespace(String str) { if (str.contains("\\ ")) { str = str.replace("\\ ", "%20"); } return str; } Demo: String file = "file:///opt/storage/user-data/attachments/1_00100\\ 0042.jpg"; file = replaceWhitespace(file); URI u = new URI(file); System.out.println(u.getRawPath()); System.out.println(u.getPath()); output: /opt/storage/user-data/attachments/1_00100%200042.jpg /opt/storage/user-data/attachments/1_00100 0042.jpg
downvote count: 0
answers question: http://stackoverflow.com/q/23828105
type: Answer
upvote count: 2

http://stackoverflow.com/comment/36655589
comment on: http://stackoverflow.com/q/23824564
score: 0
type: QuestionComment
type: Comment
has text: Can you post your code in a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve)?

http://stackoverflow.com/comment/36585546
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787866
has text: I would start with the built in serialization and only modify it if you really needed it.

http://stackoverflow.com/q/23806343
upvote count: 2
tagged with: maven
linked to: http://stackoverflow.com/q/15506043
linked to: http://stackoverflow.com/q/2855339
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23806427
type: Question
accepted answer: http://stackoverflow.com/a/23852202
has answer: http://stackoverflow.com/a/23806427
answer count: 2
has body: I have installed the last version of kepler the one has the maven embedded in it when I tried many times to create application from any archetype I always got Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories. Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\onourdean\.m2\repository) Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\onourdean\.m2\repository) even though: I have deleted the repository folder inside .m2 and its created again by it self I have downloaded an external maven and used it I made the proxy in sittings on both the embedded and the external any other ideas? My settings.xml <?xml version="1.0" encoding="UTF-8"?> true http stsproxy 8080 localhost|127.0.0.1 Note That: i have tried all the soultions in the Create a Maven project in Eclipse complains "Could not resolve archetype" except making a variable for maven due to company restriction so is this variable necessary to run the embedded version?
downvote count: 0
has answer: http://stackoverflow.com/a/23852202
favorite count: 0
has title: Maven 3 Eclipse Kepler is it necessary to have the environment variable to work for embedded Maven?

http://stackoverflow.com/comment/36589039
comment on: http://stackoverflow.com/q/23789515
type: Comment
type: QuestionComment
has text: @Hnr.Snd. lol! don't worry about it... sometimes people get a little uppitty about formatting and stuff.
score: 0

http://stackoverflow.com/comment/36577513
score: 1
has text: Why do you use String array? A string is an array of char, you do not need `String[]` to iterate over characters.
comment on: http://stackoverflow.com/q/23783710
type: Comment
type: QuestionComment

http://stackoverflow.com/a/67941530
answers question: http://stackoverflow.com/q/23790743
score: 0
has body: For future readers. I solved this a slightly different way ... using "java config". The most important part of the below is: @Bean @Profile(SPRING_PROFILE_DEFAULT) public DataSourceInitializer getDataSourceInitializer(final DataSource dataSource) { That will load the .sql file NOT named "data.sql"....only when that profile is active. import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.jdbc.datasource.init.DataSourceInitializer; import org.springframework.jdbc.datasource.init.DatabasePopulator; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.sql.DataSource; import java.util.Optional; import java.util.Properties; @Configuration @EnableTransactionManagement /* below @CS is not needed with setPackagesToScan */ //@ComponentScan(basePackageClasses = {SomeJpaEntityOne.class, SomeJpaEntityTwo.class}) public class PersistenceJpaConfig { public static final String SPRING_PROFILE_DEFAULT = "default"; /* the below file-name is purposely not "data.sql" (or data-spring.sql) to avoid/bypass "auto-find" spring-data logic. the file/resource is referred to later in a specific spring profile */ @Value("classpath:develope…
type: Answer

http://stackoverflow.com/comment/37474932
comment on: http://stackoverflow.com/q/23823248
score: 0
type: QuestionComment
type: Comment
has text: its ok anushka, no worries, should v b in touch?

http://stackoverflow.com/q/23847729
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has title: Where to instantiate context.xml in Test Environment
downvote count: 0
score: 1
has body: We are using Spring Framework (XML Version) 4.0.5.RELAESE in our Java project. In our application the context.xml is instantiated at the begin of the application start, and provides every properties via dependecy injection. Now I am wondering what is the best (and commonly used) strategy on where to instantiate it in the test environment. (We have some Unit, Integration and System tests who at least need the databaseBaseConnector bean provided in the context.xml,) I thought about making an abstract class which every test extends from, but in this case it would be newly instantiated before every test. I would like to a have a solution similiar to the main application, where the context is only instantiated one time, and everything else needed is set via dependency injection. Researching this topic didn`t help much yet, so I decided to ask the question.
tagged with: unit-testing
type: Question
tagged with: testing
tagged with: java
accepted answer: http://stackoverflow.com/a/23848055
has comment: http://stackoverflow.com/comment/36699343
upvote count: 1
has answer: http://stackoverflow.com/a/23848055
answer count: 1

http://stackoverflow.com/q/23905265
has comment: http://stackoverflow.com/comment/36815595
tagged with: java
has comment: http://stackoverflow.com/comment/36809607
type: Question
linked to: http://stackoverflow.com/q/18697584
tagged with: tomcat
tagged with: linux
tagged with: shell
has comment: http://stackoverflow.com/comment/36816015
has comment: http://stackoverflow.com/comment/36813782
has body: I have to use setenv.sh to set system properties. I am using Linux and Tomcat server 6. As described here, I have created a setenv.sh in tomcat/bin and the only thing I added is: export JAVA_OPTS =”-Dmyprojectvar.subname=value -Danothervariable=value -Danother.variable=value” I don't know is this enough to set the properties. I just want to add three properties to tomcat as system property using setenv.sh. What should I do to complete it successfully? What are the steps for it? I saw this post and there is answer given and I don't even understand the question. Do we need to set CATALINA_HOME and other properties somewhere in setenv.sh?.
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36816709
has title: Create setenv.sh to set system property

http://stackoverflow.com/a/23784566
downvote count: 0
score: 1
has body: Any attribute you use must correspond to a property with a corresponding public set...(...) method. There is no writable property called width (i.e. there is no public setWidth(...) method) defined in HBox. See the Javadocs for the properties and methods that are defined.
answers question: http://stackoverflow.com/q/23783920
upvote count: 1
type: Answer

http://stackoverflow.com/q/23872008
answer count: 3
upvote count: 1
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/36763229
has comment: http://stackoverflow.com/comment/36745123
has comment: http://stackoverflow.com/comment/36745439
has comment: http://stackoverflow.com/comment/36745312
has answer: http://stackoverflow.com/a/23872206
has answer: http://stackoverflow.com/a/23872212
possible better answer: http://stackoverflow.com/a/23872206
has comment: http://stackoverflow.com/comment/36745353
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23172934
has answer: http://stackoverflow.com/a/23872233
favorite count: 0
has comment: http://stackoverflow.com/comment/36745162
linked to: http://stackoverflow.com/q/23653778
has title: Crash when adding a OnClickListener to a Button
type: Question
accepted answer: http://stackoverflow.com/a/23872212
tagged with: android
has comment: http://stackoverflow.com/comment/36745130
has comment: http://stackoverflow.com/comment/36745164
has comment: http://stackoverflow.com/comment/36745214
has body: I'm a total newbie with Android, and I'm trying to switch between two activities ("MainActivity" and "LoginDisplayActivity") and adding the "OnClickListener" seem to make my app crash on startup. Here is my code : package info.dremor.kronos; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.os.Build; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(savedInstanceState == null) { getFragmentManager().beginTransaction().add(R.id.container, new MainFragment()).commit(); } final Button loginButton = (Button) findViewById(R.id.connect); loginButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, LoginDisplayActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class MainFragment extends Fragment { public MainFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanc…
has comment: http://stackoverflow.com/comment/36745383
score: 0
tagged with: java

tcp
type: Tag
tags question: http://stackoverflow.com/q/23907415
tags question: http://stackoverflow.com/q/23847419
tags question: http://stackoverflow.com/q/23795682
tags question: http://stackoverflow.com/q/23834934
tags question: http://stackoverflow.com/q/23918067
tags question: http://stackoverflow.com/q/23905065
tag name: tcp

http://stackoverflow.com/comment/36714666
has text: I can understand that you've trouble getting your hands on GP specs and whatever from your country, but that's not a good reason to swamp SO with questions. If we have to explain all of GP here, it's take pages upon pages.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23800685
score: 0

http://stackoverflow.com/comment/36833708
score: 0
type: Comment
type: QuestionComment
has text: @Mifmif That was the problem; Accessor and Mutator for bean properties were not named getPageMap()/setPageMap(). I am still getting warnings within my faces-config.xml such as `Bean property pageId not found on parent class SSCPageMapBean`.
comment on: http://stackoverflow.com/q/23916420

http://stackoverflow.com/comment/36815364
has text: i do not know how to save changes to the same xml
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23907035
type: QuestionComment

http://stackoverflow.com/q/23928937
has comment: http://stackoverflow.com/comment/36853647
accepted answer: http://stackoverflow.com/a/23929189
type: Question
upvote count: 2
has title: Make a Random Integer from String list
has comment: http://stackoverflow.com/comment/36853658
answer count: 1
score: -1
has answer: http://stackoverflow.com/a/23929189
has comment: http://stackoverflow.com/comment/36853849
has comment: http://stackoverflow.com/comment/36853669
tagged with: random
downvote count: 3
tagged with: string
tagged with: integer
favorite count: 0
has body: I'm trying to randomize some strings which have been converted to Integer. But the thing is, my coding throws the folloing exception: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1 2 3 4 5" Here is my code: int sample = Integer.parseInt(jTextField1.getText()); int foo = Integer.parseInt(jTextArea1.getText()); String a = ""; Random randomGenerator = new Random(); { for (int i = 1; i &lt;= sample; i++) { int randomInt = randomGenerator.nextInt(foo); a = a + i + foo + "\n"; jTextField2.setText("" + randomInt + a + "\n"); } What did I do wrong?
has comment: http://stackoverflow.com/comment/36853661
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36853652
tagged with: java

http://stackoverflow.com/comment/36666521
type: Comment
score: 0
type: AnswerComment
has text: this isn't a link only answer @pippin1289.
comment on: http://stackoverflow.com/a/23828962

http://stackoverflow.com/q/23887739
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: so i'm completely clueless here on the subject of retrieving, displaying and such using an API. I've already gotten a JSON URL with all the parameters setup and such but I don't know how to express this in an Android application. I used jsongen.com to format everything and parse the JSON into java objects but am clueless from that point on. Java Code: package com.android.tumblr.api; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; public class MainActivity extends Activity { ImageView image; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { ImageView image = (ImageView)findViewById(R.id.tvImage); Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL("https://pbs.twimg.com/profile_images/423147305605554176/EYnBh68.jpeg") .getContent()); image.setImageBitmap(bitmap); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } XML code of the Layout <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tvImage" android:minHeight="50dp" android:minWidth="50dp"/> XML code of manifest <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.INTERNET" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2471935
tagged with: image
linked to: http://stackoverflow.com/q/5314813
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23888129
favorite count: 0
has comment: http://stackoverflow.com/comment/36781919
type: UnansweredQuestion
tagged with: android
has title: Using JSON to retrieve and display images from Tumblr
has comment: http://stackoverflow.com/comment/36787630
has answer: http://stackoverflow.com/a/23891025

http://stackoverflow.com/comment/36597936
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23794374
has text: Please can you share some piece of code relevant to this issue?

http://stackoverflow.com/q/23895067
has answer: http://stackoverflow.com/a/23895131
has title: How do you replace pre-entered characters (one at a time) in the JTextField?
tagged with: java
type: Question
has body: I am trying to create a text field that at first contains only underscores and dashes, in which the user will enter numbers, for entering social security numbers. Every time the user enters a character, the underscore in the string will be replaced with that number, for example, ___-__-____ then xxx-__-____, xxx-xx-____, but the dashes will not be replaced, instead skipped over.I'm really stuck on this, and any help at all is appreciated.
score: 0
tagged with: character-replacement
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/23903759
has body: First of all it's a very bad idea to make your layouts null. As for the answer to your question try this.. JPanel pn= new JPanel(); pn.setLayout(null); //Do not do this, I'm just using this as an example JScrollPane scroll = new JScrollPane(panel); JScrollPane s = new JScrollPane(pn, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
accepted answer of: http://stackoverflow.com/q/23903566
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23903566
score: 1

http://stackoverflow.com/comment/36609090
has text: I found it, I reduced the size of the frame, and I can see it now, Thank you so much:)
comment on: http://stackoverflow.com/a/23798833
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36856915
score: 0
type: AnswerComment
has text: Another option would be to host the Servlet in a regular container and just call it with an HTTP client from the DirectAction. This would be slower but probably way easier.
type: Comment
comment on: http://stackoverflow.com/a/23916802

http://stackoverflow.com/comment/36819438
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23890430
has text: DaveNewton is talking about an answer that was deleted by it's owner. I'm asking to not delete answers right above.

http://stackoverflow.com/comment/36808187
comment on: http://stackoverflow.com/q/23904391
has text: @pramod.nikam.dev sorry no clue how to use this. should I setup spanish font?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36764855
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23882092
has text: it seems that commonj is [JSR 237](https://jcp.org/en/jsr/detail?id=237) implementation, which has been withdrawn for some reason. There might be something useful there, but main stream are JEE7 built in schedulers and Quartz for pre-JEE7 apps

http://stackoverflow.com/comment/36583837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787035
has text: What do you think the first character should be? Have you consulted an ASCII chart?
score: 0

http://stackoverflow.com/comment/45259756
type: Comment
type: AnswerComment
score: 5
comment on: http://stackoverflow.com/a/26047717
has text: Simple, easy and clean, and worked immediately. I went for the Google JsonToken first and switched here after messing with unresolved dependencies and pages of code to assemble a simple JWT.

http://stackoverflow.com/comment/36697422
has text: Wow! I Was staring at this for about an hour... no way I would have found this myself :-). Thanks!
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23846856

http://stackoverflow.com/comment/37042053
score: 0
has text: Hi Cassie. I've been thinking about this. It seems to me that you're dealing with some kind of bug in POI. I mean, the Javadoc for `getRow` clearly states that it "returns the logical row ( 0-based). If you ask for a row that is not defined you get a null." So the fact that you've got a spreadsheet with two rows, and `getRow(1)` is returning null violates the Javadoc. I suggest contacting Apache via their user mailing list at http://poi.apache.org/mailinglists.html. It would be good if you could break all of this down into a much smaller test case first ... maybe with just ...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23924963

http://stackoverflow.com/comment/36752381
has text: Did not get it clearly any example you have?
type: QuestionComment
comment on: http://stackoverflow.com/q/23875862
score: 0
type: Comment

http://stackoverflow.com/q/23880515
tagged with: jsp
has comment: http://stackoverflow.com/comment/36768482
tagged with: jquery
favorite count: 0
tagged with: ajax
type: UnansweredQuestion
has body: I have an action named "Login.action" that puts a certain type of object in the SESSION but depending on this object i want to do something with jQuery this is my example public String execute() { HttpServletRequest request = ServletActionContext.getRequest(); HttpSession sesion = request.getSession(); sesion.setAttribute(user.getprofile(), user); return SUCCESS; } as i said i put an object in my SESSION so i want to acces later on JSP with jQuery (if the user's profile is "Admin" i want to make an "Admin Panel" button appear using jQuery) Also i want to know if this is a good way to get this result or there's another (and better) way to do it
tagged with: java
has title: How to get SESSION through Jquery im using Struts2
downvote count: 2
has comment: http://stackoverflow.com/comment/36761710
type: Question
score: -2
tagged with: struts2
has answer: http://stackoverflow.com/a/23880613
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/36572094
has text: Please read http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23780700

http://stackoverflow.com/q/23808803
possible better answer: http://stackoverflow.com/a/64061184
has title: sun.reflect.Reflection.getCallerClass alternative
has comment: http://stackoverflow.com/comment/36624629
has answer: http://stackoverflow.com/a/64061184
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/40325143
upvote count: 16
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/46843713
has comment: http://stackoverflow.com/comment/36624825
has comment: http://stackoverflow.com/comment/36625790
tagged with: java
linked to: http://stackoverflow.com/q/421280
score: 16
tagged with: stack-trace
accepted answer: http://stackoverflow.com/a/40325143
type: Question
has comment: http://stackoverflow.com/comment/36625578
has body: From How do I find the caller of a method using stacktrace or reflection? ( as I didn't have enough reputation to comment there itself ) Since sun.reflect.Reflection.getCallerClass has been removed in jdk8, What could be an alternative ? How about using sun.misc.SharedSecrets JavaLangAccess access = SharedSecrets.getJavaLangAccess(); Throwable throwable = new Throwable(); int depth = access.getStackTraceDepth(throwable); StackTraceElement frame = access.getStackTraceElement(throwable, depth);

http://stackoverflow.com/comment/36690786
type: Comment
comment on: http://stackoverflow.com/a/23840859
has text: I tried some benchmarking on this and can conclude that it is highly performant, but cannot beat the code of `byteArrayCheck3b`. And `ByteBuffer`, etc. are directly mapped to machine instructions in the JVM, hence it seems to not work. Then again, I haven't tested this kind of code in C or C++ either.
score: 0
type: AnswerComment

socialauth
tags question: http://stackoverflow.com/q/23935445
type: Tag
tag name: socialauth

http://stackoverflow.com/comment/36795409
type: Comment
score: 1
has text: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
comment on: http://stackoverflow.com/q/23897829
type: QuestionComment

http://stackoverflow.com/a/23825255
has body: Everything started working by downgrading JSF 2.2.6 to JSF 2.2.2
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23780474

http://stackoverflow.com/comment/36661290
type: Comment
type: QuestionComment
has text: why do you even use [a]syncExec? You are not accessing anything from GUI so it is not needed.
comment on: http://stackoverflow.com/q/23827565
score: 0

http://stackoverflow.com/comment/36763913
score: 0
type: Comment
has text: I see your point. The only crux is that it can't be done, so if you want encapsulation of the values for algo and key length you have to provide it yourself.
comment on: http://stackoverflow.com/a/23880791
type: AnswerComment

http://stackoverflow.com/q/23843921
has answer: http://stackoverflow.com/a/23843998
favorite count: 0
type: Question
has title: Java syntax confusion
score: -1
has comment: http://stackoverflow.com/comment/36691715
possible better answer: http://stackoverflow.com/a/23843945
downvote count: 2
accepted answer: http://stackoverflow.com/a/23843998
has answer: http://stackoverflow.com/a/23843945
answer count: 2
upvote count: 1
has body: Given two strings,write a method to decide if one is a permutation of the other. Below is the model solution. I don't understand this statement: if(--letters[c]&lt;0) {return false;} Why not just write if(letters[c]==0){return false;} Can someone please clarify. public boolean permutation(String s, String t) { if(s.length()!=t.length()) { return false; } int[] letters = new int[256]; char[] s_array = s.toCharArray(); for(char c : s_array){ letters[c]++; } for(int i=0; i&lt;t.length(); i++) { int c = (int) t.charAt(i); if(--letters[c]&lt;0) { return false; } } return true; }
tagged with: java
has comment: http://stackoverflow.com/comment/36691678
has comment: http://stackoverflow.com/comment/36691673
type: AnsweredQuestion

http://stackoverflow.com/comment/36623886
score: 0
type: Comment
type: QuestionComment
has text: Could you share some more details? Are you working with plain Java or with servers, Java EE etc? Moreover, could you give some indication about how many table rows you are talking about?
comment on: http://stackoverflow.com/q/23805995

http://stackoverflow.com/comment/36674359
has text: No difference: Spring Integration populates the same `MessageEndpoint`, so you can continue to configure (or reuse) all other Spring WS infrastructure
comment on: http://stackoverflow.com/a/23831712
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23830929
type: Answer
answers question: http://stackoverflow.com/q/23830542
has body: Just a little thing: if your operationsList is empty or the currentOperation is not null your thread starts going in circles really fast. You could use Thread.wait() and .notify() to avoid this. Also you are using currentOperation with and without synchronized. This could get you into trouble.
score: 0

http://stackoverflow.com/comment/36871530
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23914909
has text: So if it doesn't impact correctness nor performance what exactly is the problem? I mean you can make sure the custom classloader isn't removed but it's hacky without any benefits and who knows what relies on this behavior.

http://stackoverflow.com/comment/36859921
type: QuestionComment
score: 0
has text: In which phase this code gets executed..? Main or inside mapper..?
type: Comment
comment on: http://stackoverflow.com/q/23931932

http://stackoverflow.com/q/23936722
has body: I had some software developed on oDesk about a year ago. What I get back is a java based .EXE It runs as a standalone without any sort of installation. The problem is they screwed up some graphics for the buttons, it didn't bother me at the time, because I got what I wanted, a minimal viable product that got the job done. With that said, it's been bothering me for a while, and when I reach back out to the guy - I can't get him. I used 7zip to open the .EXE and extracted all the contents. I found where the buttons were and fixed them, obviously trying to drag it into 7Zip in the specified location isn't going to work. How do I go about recompiling everything? I'm new to all this, so if you need any additional information, please don't hesitate to ask. I just want this thing to look as I intended.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36868339
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36905613
has title: How to Recompile Deconstructed EXE
has comment: http://stackoverflow.com/comment/36868072
tagged with: recompile
has comment: http://stackoverflow.com/comment/36905852
answer count: 0

http://stackoverflow.com/comment/36880478
comment on: http://stackoverflow.com/a/23916693
type: Comment
score: 0
type: AnswerComment
has text: That's what I thought at first. However, the 3 services are being declared in the same XML. I updated the question with the component declarations. If I run the application, I see the ClockWidget constructor being called three times.

http://stackoverflow.com/q/23827251
linked to: http://stackoverflow.com/q/160970
has answer: http://stackoverflow.com/a/23827349
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36660087
has comment: http://stackoverflow.com/comment/36659757
has comment: http://stackoverflow.com/comment/36659820
type: Question
accepted answer: http://stackoverflow.com/a/23827349
has comment: http://stackoverflow.com/comment/36659730
has title: Build method call from class instance and string?
has comment: http://stackoverflow.com/comment/36659771
has comment: http://stackoverflow.com/comment/36659953
has body: In Java is it possible to execute a method call given the class instance and the method call saved as a string? I want to make a sequence of different method calls random so I was going to put the method parts in a list as Strings and shuffle them. How do I then use this string as part of a method call? e.g. myClass.temp below is being treated as a property. If I put the full myClaims. in the List as Objects it will try to execute them there. List&lt;String&gt; methodList = new ArrayList&lt;String&gt;() methodList.add("createMethodx(params...)") methodList.add("createMethody(params...)") methodList.add("insertMethodz(params...)") String temp = methodList.get(0) myClass.temp //Execute the method.....doesn't work
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36659839
answer count: 1
has comment: http://stackoverflow.com/comment/36659679

http://stackoverflow.com/comment/36708775
has text: Yes, you can can write to your stream and pass the call to your parent method) but the parent method is trying to find the request url at the routes file, and of course , as i said above, it wont find it there. So again, how can i redirect this request directly to another method without going through routes file?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23783470
score: 0

http://stackoverflow.com/comment/36595047
score: 0
type: AnswerComment
type: Comment
has text: Read the tutorial I linked, if you want to learn custom painting
comment on: http://stackoverflow.com/a/23792727

http://stackoverflow.com/q/23833765
has answer: http://stackoverflow.com/a/23833888
type: AnsweredQuestion
has body: i want to draw this arc in a panel that the preferedSize is set to (200,50): i found it hard to understand what does the parameters in drawArc(). how to draw this one?
possible better answer: http://stackoverflow.com/a/23833900
score: 1
tagged with: java
upvote count: 1
has title: how to use drawArc()
type: Question
accepted answer: http://stackoverflow.com/a/23833888
answer count: 2
has comment: http://stackoverflow.com/comment/36672481
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23833900
tagged with: drawing

http://stackoverflow.com/comment/36592640
has text: it gives me error on dot R.drawable.mohsenchavoshione the dot before mohsen chavoshi
type: Comment
comment on: http://stackoverflow.com/a/23791227
score: 0
type: AnswerComment

http://stackoverflow.com/a/27875783
upvote count: 13
accepted answer of: http://stackoverflow.com/q/23872603
has body: Here is the article which proposes fair set of alternatives with detailed enough explanations: Fail instead of Skip a Test when TestNG’s DataProvider throws an Exception For me best way happened to add test for data providers and here is brief illustration of idea: public class MyClass { @DataProvider(name = "my-data-provider") private Object [][] myProvider() { // ... } @Test public void testDataProviders() { Assert.assertTrue(myProvider().length &gt; 0); } @Test // ... Real tests. }
has comment: http://stackoverflow.com/comment/44860087
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23872603
type: Answer
score: 13

http://stackoverflow.com/q/23852923
has title: Organize imports of java files using eclipse from command line
tagged with: command-line
tagged with: java
has body: I want to format java code and organize the imports in the pre-commit hook using command line, When i searched how to do this i found this link which explains how to format the code using eclipse from command line as the following: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -config {setting}/org.eclipse.jdt.core.prefs {project.basedir}/src But couldn't know the parameter name that is responsible for formatting the code, as i expect the command will be like this: eclipse -application {Java_Import_Organizer_Parameter} -config {setting}/org.eclipse.jdt.ui.prefs {project.basedir}/src any idea?
tagged with: eclipse
tagged with: import
type: Question
tagged with: pre-commit-hook
has comment: http://stackoverflow.com/comment/36710190
has answer: http://stackoverflow.com/a/46679136
has comment: http://stackoverflow.com/comment/60708719
answer count: 1
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion

http://stackoverflow.com/q/23844694
tagged with: java
tagged with: pkcs#11
has comment: http://stackoverflow.com/comment/36698891
type: Question
answer count: 2
has body: My application is accessing e-Token for decrypting the response coming from the server The session key from the server is encrypted using :- RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING I am using SunPKCS11 Provider for implementing the access to crypto token. Whenever i try to decrypt this using the above mechanishm i.e. with RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING i am getting :- **javax.crypto.BadPaddingException: doFinal() failed at sun.security.pkcs11.P11RSACipher.implDoFinal(P11RSACipher.java:328) at sun.security.pkcs11.P11RSACipher.engineDoFinal(P11RSACipher.java:353) at javax.crypto.Cipher.doFinal(DashoA13*..) The following is my code :- private static final String TRANSFORMATION = "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING"; private static final String SECURITY_PROVIDER = "BC"; private static final String DIGEST_ALGORITHM = "SHA-256"; private static final String MASKING_FUNCTION = "MGF1"; The code snippet where the error is coming is as follows :- private byte[] decryptSecretKeyData(byte[] encryptedSecretKey, byte[] iv, PrivateKey privateKey) throws Exception { try { Cipher rsaCipher = Cipher.getInstance(TRANSFORMATION, SECURITY_PROVIDER); System.out.println("Cipher block initialized"); - **Printed** PSource pSrc = (new PSource.PSpecified(iv)); System.out.println("PSource inisitialized"); - **Printed** rsaCipher.init(Cipher.DECRYPT_MODE, privateKey, new OAEPParameterSpec(DIGEST_ALGORITHM, MASKING_FUNCTION, MGF1ParameterSpec.SHA256, pSrc)); System.out.println("Here after cipher initilaization"); - **Not Printed*** return rsaCipher.doFinal(encryptedSecretKey); } catch (GeneralSecurityException e) { System.out.println("GeneralSecurityException is "+e.getMessage()); throw new Exception("Failed to decrypt AES secret key using RSA.", e); } } I am Stuck in here and unable to decrypt the OAEP Transformation.
downvote count: 0
has answer: http://stackoverflow.com/a/23853610
favorite count: 0
has comment: http://stackoverflow.com/comment/36699489
has comment: http://stackoverflow.com/comment/36694093
tagged with: smartcard
possible better answer: http://stackoverflow.com/a/23859386
has answer: http://stackoverflow.com/a/23859386
has comment: http://stackoverflow.com/comment/36700294
has title: Bad Padding Exception - RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING in pkcs11
tagged with: bouncycastle
upvote count: 2
tagged with: encryption
accepted answer: http://stackoverflow.com/a/23853610
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/23907672
type: Answer
has comment: http://stackoverflow.com/comment/36820270
score: 77
has comment: http://stackoverflow.com/comment/36831893
has body: Yeah, the Groovy parser does not accept Java 8 Lambdas (not closures). You can use a closure in place of it (assuming you're on Groovy 2.3.*) ie: Person.findAll().stream().filter( { e -&gt; e.age &gt; 20 } ) edit: Groovy 3.0+ will accept lambda format
has comment: http://stackoverflow.com/comment/81743350
has comment: http://stackoverflow.com/comment/120773623
has comment: http://stackoverflow.com/comment/36824227
has comment: http://stackoverflow.com/comment/47286995
answers question: http://stackoverflow.com/q/23906748
has comment: http://stackoverflow.com/comment/47287153
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23906748
upvote count: 77
has comment: http://stackoverflow.com/comment/55262748

http://stackoverflow.com/a/23917073
has comment: http://stackoverflow.com/comment/36831365
type: Answer
has comment: http://stackoverflow.com/comment/36831917
downvote count: 0
has comment: http://stackoverflow.com/comment/36831737
has body: I think this should do the trick ExtendedJob.this.callback();
answers question: http://stackoverflow.com/q/23916902
score: 3
accepted answer of: http://stackoverflow.com/q/23916902
has comment: http://stackoverflow.com/comment/36831399
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/36732570
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23864045
has text: You code has a few "issues", see my update for a list of the main ones ;)
score: 0

http://stackoverflow.com/a/23799602
type: Answer
has body: Instead of using... int RW = radmWord.indexOf(guessedLetter); To determine if the entered value matches a character, which will only return the first index, you should, instead, use a loop of some kind to check every character boolean found = false; for (int rw = 0; rw &lt; genRadmLetter2.length; rw++) { if (genRadmLetter2[rw] == guessedLetter) { genRadmLetter[rw] = guessedLetter; found = true; } } Now, because you're relying on the value of RW to determine if a match was found or not, I changed it so that the boolean found flag can used instead, for example... if (!found) { System.out.println("Wrong letter, try again."); counter = counter - 1; System.out.println("Lives left: " + counter); } You also have duplicate sets of code, which can be reduced to a single do-while loop instead, which will make it easier to read and make changes, for example... do { //... } while (counter != 0); To your second problem, a Set of some kind would be the simplest solution... Set&lt;Character&gt; guesses = new HashSet&lt;Character&gt;(); //... char guessedLetter = Input.next().charAt(0); if (guesses.contains(guessedLetter)) { System.out.println("You've used this guess, guess again"); } else { guesses.add(guessedLetter); For example... And because it's not always easy to translate code snippets ... this is my test code... import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Hangman { public static void main(String[] args) { Scanner Input = new Scanner(System.in); String[] CollectionOfWords = {"", "gravity", "banana", "gate", "processor", "momentum", "earth", "star", "light", "television", "pan", "cupboard"}; int radmNumber = (int) Math.ceil(Math.random() * CollectionOfWords.length); int counter = 10; String radmWord = "banana"; //CollectionOfWords[radmNumber]; char[] genRadmLetter = radmWord.toCharArray(); char[] genRadmLetter2 = radmWord.toCharArray(); for (int x = 0; x &lt; genRadmLetter.length; x++) { genRadmLetter[x] = '?…
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23799013
upvote count: 1
has comment: http://stackoverflow.com/comment/36607609
answers question: http://stackoverflow.com/q/23799013
has comment: http://stackoverflow.com/comment/37075813
downvote count: 0

http://stackoverflow.com/a/23908390
has body: You're only calling a non-terminal operation on the stream. So your code doesn't consume the data from the stream. All it does is saying: "when a terminal operation will be called, you'll have to map the strings using the check() method". Use List&lt;Integer&gt; transformed = argList.stream().map((String name) -&gt; check(name)).collect(Collectors.toList()); for example, and then the call to collect(), which is a terminal operation, will trigger the iteration on the stream elements and the transformation of its elements.
answers question: http://stackoverflow.com/q/23908170
accepted answer of: http://stackoverflow.com/q/23908170
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23857701
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I need to match the following string with regex: texthere("othertext") There might be some whitespaces in before and after the string. What I tried to do was this (s is a String): s.matches("\\s*\\w*(\"\\w*\")\\s*"); However, this doesn't work. Then I tried several things, until I found out that the following does work: s.matches("\\s*\\w*(.*\\w*.*)\\s*"); This would mean that the \" part is not recognised as ". How can I solve this?
downvote count: 0
has title: Match a quotation mark " with regex
has answer: http://stackoverflow.com/a/23857782
answer count: 2
accepted answer: http://stackoverflow.com/a/23857743
favorite count: 0
has answer: http://stackoverflow.com/a/23857743
tagged with: regex
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23857782

http://stackoverflow.com/comment/36828153
has text: Cast `i` and `j` to float before dividing.
comment on: http://stackoverflow.com/q/23912987
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23916544
has body: AAR files are more similar to Jars than to Dlls for the following reason: Dlls can be shared across applications where as AARs and jars are packaged in with your app. AARs vs Jars: The main difference between a Jar and a AAR is that AARs include resources such as layouts, drawables etc. This makes it a lot easier to create self-contained visual components. For example if you have multiple apps that use the same login screen, with Jars you could share classes but not the layout, styles, etc., you still had to duplicate them. With AARs everything is bundled in one neat package. In conclusion, AARs are a big step in the right direction. Note: Similar attempts were made with apk-libs but they are now obsolete as AARs are much better.
has comment: http://stackoverflow.com/comment/71216895
type: Answer
has comment: http://stackoverflow.com/comment/55740722
score: 253
downvote count: 0
answers question: http://stackoverflow.com/q/23915619
accepted answer of: http://stackoverflow.com/q/23915619
has comment: http://stackoverflow.com/comment/65314393
has comment: http://stackoverflow.com/comment/64794486
has comment: http://stackoverflow.com/comment/73858937
upvote count: 253
type: AcceptedAnswer

http://stackoverflow.com/comment/36812539
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23894046
has text: If you were to implement this yourself, then a ConcurrentHashMap would be a good place to start

http://stackoverflow.com/q/23892576
has comment: http://stackoverflow.com/comment/36784874
has comment: http://stackoverflow.com/comment/36785012
score: -2
has answer: http://stackoverflow.com/a/23892612
has title: Arraylist not public in my program
tagged with: arraylist
has body: I made a Jframe in Netbeans and using an initialize button, it displays five CDs. I have an add button, but when I type CDs (my arraylist's name).add it shows an error. public class GUI extends javax.swing.JFrame { public GUI() { initComponents(); addButton.setEnabled(false); removeButton.setEnabled(false); displayButton.setEnabled(false); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jToggleButton3 = new javax.swing.JToggleButton(); jPanel1 = new javax.swing.JPanel(); titleLabel = new javax.swing.JLabel(); titleartistLabel = new javax.swing.JLabel(); CDInput = new javax.swing.JTextField(); displayButton = new javax.swing.JToggleButton(); initializeButton = new javax.swing.JToggleButton(); addButton = new javax.swing.JToggleButton(); removeButton = new javax.swing.JButton(); outputScroll = new javax.swing.JScrollPane(); output = new javax.swing.JTextArea(); jToggleButton3.setText("jToggleButton3"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(0, 0, 0)); jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); titleLabel.setFont(new java.awt.Font("Courier New", 0, 14)); // NOI18N titleLabel.setForeground(new java.awt.Color(102, 255, 51)); titleLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); titleLabel.setText("CD Collection\n"); titleartistLabel.setFont(new java.awt.Font("Courier New", 0, 11)); // NOI18N titleartistLabel.setForeground(new java.awt.Color(102, 255, 51)); titleartistLabel.setText("Title - Artist"); CDInput.setFont(new java.awt.Font("Courier New", 0, 11)); // NOI18N CDInput.setForeground(new java.awt.Color(51, 51, 51)); CDInput.addActionListener(new java.…
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36784814
has answer: http://stackoverflow.com/a/23892694
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36785135
has comment: http://stackoverflow.com/comment/36784943
upvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/23844127
has comment: http://stackoverflow.com/comment/36692230
accepted answer of: http://stackoverflow.com/q/23844096
upvote count: 2
answers question: http://stackoverflow.com/q/23844096
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36692003
type: Answer
has body: Provided that all three methods belong to the same class, and that all threads have the same instance of that class, synchronized is enough to ensure that only one of these three methods can be executing at any instance of time. If another thread tries running one of these three methods while a thread is executing, that second thread would automatically wait for the method to complete.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36692315

jna
tags question: http://stackoverflow.com/q/23856477
tags question: http://stackoverflow.com/q/23856748
tags question: http://stackoverflow.com/q/23889529
type: Tag
tags question: http://stackoverflow.com/q/23919410
tags question: http://stackoverflow.com/q/23867622
tags question: http://stackoverflow.com/q/23841518
tags question: http://stackoverflow.com/q/23898720
tag name: jna

http://stackoverflow.com/q/23783282
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/36619078
tagged with: logback
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23790875
score: 8
favorite count: 0
tagged with: cdi
upvote count: 8
type: UnansweredQuestion
has title: How to use InjectMocks if the instance to be injected has a final class
has comment: http://stackoverflow.com/comment/36577930
has body: I want to test some services with mockito. The services are based on CDI and, unfortunately, use field injection, which I can't change. public class Service { @Inject Logger logger; public void method() { logger.info("some log text"); } } Now it is quite easy to create the testable instances with mockito's @InjectMocks annotation. It will inject either mocks and spies. @RunWith(MockitoJUnitRunner.class) public class ServiceTest { @Spy Logger logger = LoggerFactory.getLogger(Service.class); @InjectMocks Service service; @Test public void test() { // Given // When service.method(); // Then } I need some working logger injected into my service class under test. The logger framework is slf4j, the preferred logger is logback. But unfortunately again, logback's implementation of Logger is final, so I can't spy on that, it results in a runtime exception. Workarounds, that come to my mind: use reflection to initialize the logger attribute on the service (poor man's injection) implement a spyable (non-final) logger wrapper that delegates to the final logback logger But is there a clean or at least better solution for that (those) problem(s)?
tagged with: java

http://stackoverflow.com/comment/36888609
score: 0
type: Comment
has text: It was all working fine for around a month after I unzippped liferay bundle.
comment on: http://stackoverflow.com/a/23940777
type: AnswerComment

http://stackoverflow.com/comment/36572730
type: QuestionComment
comment on: http://stackoverflow.com/q/23781104
has text: What isn't working? Do you get a red font all the time, a blue one, or none at all?
score: 0
type: Comment

http://stackoverflow.com/comment/36648044
score: 0
type: Comment
type: QuestionComment
has text: i had that idea but i don't know how to create a background Service. Can u please Share some Code? It would be a big help.
comment on: http://stackoverflow.com/q/23820796

http://stackoverflow.com/q/23829187
type: Question
has body: I am facing an issue while working on JFileChooser for Java 7.When I click enter key(Directory Browse) on a directory, I see no actions and key press is ignored. Below is my code implementation. public static void main(String[] a) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFileChooser fileChooser = new JFileChooser("."); fileChooser.setControlButtonsAreShown(false); frame.add(fileChooser, BorderLayout.CENTER); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println(actionEvent.getSource()); JFileChooser theFileChooser = (JFileChooser) actionEvent.getSource(); String command = actionEvent.getActionCommand(); if (command.equals(JFileChooser.APPROVE_SELECTION)) { File selectedFile = theFileChooser.getSelectedFile(); System.out.println(selectedFile.getParent()); System.out.println(selectedFile.getName()); } else if (command.equals(JFileChooser.CANCEL_SELECTION)) { System.out.println(JFileChooser.CANCEL_SELECTION); } } }; fileChooser.addActionListener(actionListener); frame.pack(); frame.setVisible(true); } } Any Help is Really Appreciated !!! Thanks
favorite count: 0
upvote count: 2
answer count: 1
has title: Enter Key not working in JFileChoose in Java 7
tagged with: java
has answer: http://stackoverflow.com/a/23829791
tagged with: jfilechooser
score: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23845992
type: Answer
has body: You have to search for the value in the entire map: for (Entry&lt;String, List&lt;String&gt;&gt; entry : cat.entrySet()) { for (String s : entry.getValue()) { if (s.equals("Carrot")) System.out.println(entry.getKey()); } }
has comment: http://stackoverflow.com/comment/36723765
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23845935

http://stackoverflow.com/comment/36820725
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23911044
has text: @Prince : Sometimes we could read and write some code based on our experience without testing it.
type: AnswerComment

http://stackoverflow.com/a/23857236
type: Answer
has comment: http://stackoverflow.com/comment/36718176
has comment: http://stackoverflow.com/comment/36717672
accepted answer of: http://stackoverflow.com/q/23857102
score: 1
upvote count: 1
has body: The Observer pattern in Java is implemented using events and listeners. You just need to set up listeners for the events you want, and you are away. Events pass (to the listener method) an argument which inherits from java.util.EventObject, and these contain the information about the particular event. Listeners are an object (concrete, or anonymous) which implements a listener interface containing one or more methods that are invoked when an event occurs Adapter classes, such as WindowListener provide pre-implemented superclasses for interfaces with multiple listener methods, allowing you to inherit and only implement the one or two you want. Event listeners are frequently implemented using anonymous classes For example, listening to a click event on a button: button.addActionListener(new ActionListener(){ // this is an "anonymous class" @Override public void actionPerformed(ActionEvent arg0) { // TODO: do something } }); You can generate your own event sources as well, so you can use the Observer pattern throughout to watch for changes to objects and update the UI, and also to react to UI events. "Listener" was not a formal GOF pattern, but in Java listener refers to the interfaces and objects used to react to events.
has comment: http://stackoverflow.com/comment/36717644
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23857102
has comment: http://stackoverflow.com/comment/36718030
downvote count: 0

http://stackoverflow.com/q/23846028
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/304268
has comment: http://stackoverflow.com/comment/36697364
has comment: http://stackoverflow.com/comment/36695768
has answer: http://stackoverflow.com/a/23846907
type: Question
possible better answer: http://stackoverflow.com/a/23846079
answer count: 2
has answer: http://stackoverflow.com/a/23846079
has body: I have a file with several hundreds of stopwords. I want to be able to check if the file has been modified by a user for example or even if it is corrupted. The way I am thinking of doing it currently is by looking if the number of lines is correct. I could also check if the total number of characters is the one expected or even have the whole stopwords list loaded in memory to check if every single one of them is in the file. All 3 of the ways I thought of seem inefficient and/or bad so I thought of asking if there is any better way of doing it. What I am thinking of implementing: private static final int WORD_COUNT = 354; public static boolean stopwordsCorrupted(File file) { int numOfLines = countLines(file); return WORD_COUNT != numOfLines; }
has title: How to check if a stopword file is corrupted or wrong
score: 0
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/23846907
has comment: http://stackoverflow.com/comment/36696582
tagged with: newline
has comment: http://stackoverflow.com/comment/36695742
has comment: http://stackoverflow.com/comment/36695841
tagged with: boolean
has comment: http://stackoverflow.com/comment/36696214
tagged with: char
has comment: http://stackoverflow.com/comment/36695748

http://stackoverflow.com/q/23812067
has comment: http://stackoverflow.com/comment/36631117
has body: I'm developing a small API for personal use only, and it envolves A LOT of math. But, I just found that using "double == double", returns false. So, my API uses a lot of these calculations, and I must re-write a lot of it. But, the API have for now 85,000 lines of code, so I think it would be a lot... problematic... re-writing it manually. Is there any Eclipse plugin for auto-detecting these wrong statements and, if possible, fix them? Thanks. @Additional info: I found this while testing some methods with all Number classes, and when I tested Doubles, here what I got: Number of type 'class java.lang.Double': First value: 3.2 Second value: 3.2 first == second: false first != second: true second == first: false second != first: true first equals second: true second equals first: true I ALWAYS used Number classes, almost never raw primitives. So now it's a big of a problem for me.
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36631003
type: Question
has comment: http://stackoverflow.com/comment/36631548
has answer: http://stackoverflow.com/a/23826723
accepted answer: http://stackoverflow.com/a/23826723
answer count: 2
has title: Eclipse plugin to auto-fix "Double == Double" statements?
score: 0
has answer: http://stackoverflow.com/a/23814619
has comment: http://stackoverflow.com/comment/36631286
possible better answer: http://stackoverflow.com/a/23814619
tagged with: equals
has comment: http://stackoverflow.com/comment/36632776
tagged with: double
has comment: http://stackoverflow.com/comment/36631402
has comment: http://stackoverflow.com/comment/36631381
tagged with: plugins
type: AnsweredQuestion

http://stackoverflow.com/q/23779041
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
accepted answer: http://stackoverflow.com/a/23788488
has body: I am trying to make use of Apache POI to read an excel file and convert it to a 2-dimensional object array. Attached is the code section. public class ImportUtil { public static DefaultTableModel importFromFile(File f) { DefaultTableModel tableModel = null; try { FileInputStream file = new FileInputStream(f); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); Iterator&lt;Row&gt; rowIterator = sheet.iterator(); List&lt;Object&gt; columnNames = new ArrayList&lt;Object&gt;(); Vector&lt;Object&gt; cellVals = new Vector&lt;Object&gt;(); Vector&lt;Vector&lt;Object&gt;&gt; tempData = new Vector&lt;Vector&lt;Object&gt;&gt;(); while(rowIterator.hasNext()){ //cellVals.clear(); cellVals.clear(); Row row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); /* * Treat first row in excel file as column names, column names are assumed to be of type String */ if(row.getRowNum()==0){ while(cellIterator.hasNext()){ Cell cell = cellIterator.next(); columnNames.add(cell.getStringCellValue()); } }else{ while(cellIterator.hasNext()){ Cell cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: if(DateUtil.isCellDateFormatted(cell)){ cellVals.add(cell.getDateCellValue()); }else{ cellVals.add(cell.getNumericCellValue()); } break; case Cell.CELL_TYPE_STRING: cellVals.add(cell.getStringCellValue()); break; default: System.out.print("Unhanlded Type." + "\t\t\t"); break; } } System.out.println(cellVals); tempData.add(cellVals); } } file.close(); Object[][] modelData = VectorToArray.to2DArray(tempData); for(int i=0;i&lt;modelData.length;i++){ for(int j=0;j&lt;modelData[i].length;j++){ System.out.print(modelData[i][j]); } System.out.println(""); } tableModel = new DefaultTableModel(modelData, columnNames.toArray()); } catch (IOException e) { e.printStackTrace(); } return tableModel; } } class VectorToArray{ public static Object[][] to2DArray(Vector&lt;Vector&lt;Object&gt;&gt; v){ Object[][] out = new O…
type: Question
has answer: http://stackoverflow.com/a/23796489
has title: POI excel into 2D array
possible better answer: http://stackoverflow.com/a/23796489
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23788488

http://stackoverflow.com/comment/36711085
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23852130
has text: @lefloh , I would be thankfull if you can show me how to map to a limited view, I'm new to JAX-RS.

http://stackoverflow.com/a/23887776
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23887660
has comment: http://stackoverflow.com/comment/36775806
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36775791
answers question: http://stackoverflow.com/q/23887660
type: Answer
has body: Some advice .. 1. String fileInfo = getInfo.readLine(); //Gets the key or 'true' .. reads only 1 line (if that is what you want..) 2. use fileInfo =fileInfo.trim() // to remove leading and trailing whitespaces. 3. If you just want to "read" the file, use FileReader, BufferedReader. If you want to "parse" the file, use a Scanner.
score: 2
has comment: http://stackoverflow.com/comment/36775332

http://stackoverflow.com/comment/36822459
type: QuestionComment
has text: I notice you want to add events when updating or creating entities. Have a look at CDI Events or @Stereotypes. It will help you avoid putting all the boiler plate codes in your beans
score: 0
comment on: http://stackoverflow.com/q/23912293
type: Comment

command-line
tags question: http://stackoverflow.com/q/23790069
tags question: http://stackoverflow.com/q/23852923
tags question: http://stackoverflow.com/q/23802951
type: Tag
tag name: command-line
tags question: http://stackoverflow.com/q/23898683

http://stackoverflow.com/comment/36866505
type: Comment
type: QuestionComment
has text: javax.servlet.http.HttpServletRequest.getSession() -> HttpSession
score: 0
comment on: http://stackoverflow.com/q/23935445

http://stackoverflow.com/comment/36874584
type: QuestionComment
has text: Yes your `System Time` and supplying `DateTime` to a form are two different paths
score: 0
comment on: http://stackoverflow.com/q/23940124
type: Comment

http://stackoverflow.com/q/23890800
has comment: http://stackoverflow.com/comment/36787535
favorite count: 0
has title: Spring session bean instantation
type: UnansweredQuestion
tagged with: spring
tagged with: jsf
downvote count: 0
answer count: 0
score: 1
tagged with: java
type: Question
has body: I'm trying to instantize a new session bean with dependency injection. This is what im trying to do &lt;bean id="pluginManager" class="desktop.pluginsystem.PluginManager" scope="singleton"&gt; &lt;property name="abd" ref="autoBeanDeclarer" /&gt; &lt;/bean&gt; &lt;bean id="userBean" class="webapp.beans.UserBean" scope="session"&gt; &lt;constructor-arg&gt;&lt;ref bean="pluginManager"/&gt;&lt;/constructor-arg&gt; &lt;/bean&gt; I tried to pass reference to plugin manager through a property, but it was Null every time! Plugin Manager injection for any other bean declared works fine but in this session scoped bean it doesn't work. When using property it says it's NULL anyways but in using it says Error creating bean with name 'userBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities) And this is UserBean class: public class UserBean { private PluginManager pm; public UserBean(PluginManager pm){ this.pm = pm; } public void setPm(PluginManager pm) { this.pm = pm; } } What's wrong?
tagged with: dependency-injection
tagged with: session
has comment: http://stackoverflow.com/comment/36788034
upvote count: 1

http://stackoverflow.com/a/23997763
answers question: http://stackoverflow.com/q/23896912
type: Answer
accepted answer of: http://stackoverflow.com/q/23896912
has body: This is a bug in the HmtlUnitRequestBuilder in how it is converting from HtmlUnit's request to Spring's MockHttpServletRequest. You can find additional details in spring-test-mvc-htmlunit/issues/28. I have pushed out a fix to master so you can update to the latest snapshot of spring-test-mvc-htmlunit to resolve your issue.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/36605710
type: QuestionComment
comment on: http://stackoverflow.com/q/23798679
score: 0
has text: We don't know what a class type declaration of `MyWaterFowl` looks like. We don't know if it extends `CanQuack` or implements `CanWalk`.
type: Comment

http://stackoverflow.com/q/23849763
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36703502
has body: I was looking around and I found a few answers that use ClassLoader.findLoadedClass(String className) but they all require overriding the permissions with setAccessible(boolean flag), and that just seems like you shouldn't be doing that. (What's the point of permissions anyway if you can just change them in runtime). is there any other way to see whether or not a classes is loaded? This seems like it would be a pretty basic thing to check.
linked to: http://stackoverflow.com/q/482633
answer count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/482633
favorite count: 0
has comment: http://stackoverflow.com/comment/36703407
type: Question
tagged with: classloader
has title: Java Is there a simple way to check if a class is loaded?
score: 0
tagged with: java

http://stackoverflow.com/comment/36830952
has text: is this how you calling findEvents? only once?
comment on: http://stackoverflow.com/q/23916756
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23898464
has answer: http://stackoverflow.com/a/23898582
type: Question
tagged with: algorithm
has body: I have two Strings that I am checking for specific common words in both of them. I already have the semantic scores; irrelevant in this case as these words are technical abbreviations and have special emphasis. The more set of common words they have, higher the score and closer they are. There are many ways of going about this. So far I have thought of two. 1) I create two ArrayList with the words of the strings. I have to another set of words that I search if they exist in both the ArrayList. If they do, I give them a score +1. then I can have multiple conditions like if((firstString.contains(keyWord)) &amp;&amp; (secondString.contains(keyWord))) then +1 if((firstString.contains(anotherKeyWord)) &amp;&amp; (secondString.contains(anotherKeyWord))) then +1 2> Take two string and have regex search using if firstString.("(.*)someExpression(.*)")) &amp;&amp; secondString.("(.*)someExpression(.*)")) then +1 if firstString.("(.*)someOtherExpression(.*)")) &amp;&amp; secondString.("(.*)someOtherExpression(.*)")) then +1 Are there other better ways of doing this? I am more inclined to use regex now. It looks pretty efficient way of doing this. Basically what I am doing is I am trying to cluster similar sentences by grouping sentences with abbreviations such as "ACLS", "ASHD", "CXR" (Common medical terms) as I know these sentences talk about those issues primarily. Then I get semantic scores to group those sentences that have these words in them. Wrong Approach :/ ? Thank you :)
tagged with: java
tagged with: semantic-analysis
score: 0
answer count: 2
has title: Optimizing search for keywords in two strings
tagged with: regex
tagged with: semantics
has answer: http://stackoverflow.com/a/23898937
accepted answer: http://stackoverflow.com/a/23898937
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23898582

http://stackoverflow.com/a/24265503
score: 2
answers question: http://stackoverflow.com/q/23825143
has comment: http://stackoverflow.com/comment/50721083
upvote count: 2
has body: Either 1. Set the run window to be in either split and then shrink it down to be as small as possible. 2. Set the windows to be in floating mode and then shrink it down and move it somewhere less distracting.
downvote count: 0
type: Answer

http://stackoverflow.com/q/23860755
has comment: http://stackoverflow.com/comment/36724850
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36726266
tagged with: java
has body: I'm creating a program for a school project. It is a fan based program of Pokémon and I am having a little trouble understanding how to change images based on the key strokes. Here is the code so far for the Character Class import java.awt.Image; import java.awt.event.KeyEvent; import java.io.*; //the File class import java.util.*; //the Scanner class import javax.swing.ImageIcon; import javax.swing.JPanel; import java.awt.image.*; import javax.swing.ImageIcon; public class MainCharacter { private Image up, up1, up2, down, down1, down2, left, left1, left2, right, right1, right2; private void loadImages() { up = new ImageIcon("Up.png").getImage(); up1 = new ImageIcon("Up1.png").getImage(); up2 = new ImageIcon("Up2.png").getImage(); down = new ImageIcon("Down.png").getImage(); down1 = new ImageIcon("Down1.png").getImage(); down2= new ImageIcon("Down2.png").getImage(); left = new ImageIcon("Left.png").getImage(); left1 = new ImageIcon("Left1.png").getImage(); left2 = new ImageIcon("Left2.png").getImage(); right = new ImageIcon("Right.png").getImage(); right1 = new ImageIcon("Right1.png").getImage(); right2 = new ImageIcon("Right2.png").getImage(); } /*public Image getImage() { //dont know what to return here } */ public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { //dont know what to do } if (key == KeyEvent.VK_RIGHT) { //dont know what to do } if (key == KeyEvent.VK_UP) { //dont know what to do } if (key == KeyEvent.VK_DOWN) { //dont know what to do } } public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { //dont know what to do } if (key == KeyEvent.VK_RIGHT) { //dont know what to do } if (key == KeyEvent.VK_UP) { //dont know what to do } if (key == KeyEvent.VK_DOWN) { //dont know what to do } } } Here is the class where it moves along with the map: import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.event.ActionEvent; i…
tagged with: swing
has title: How to change images based on keystrokes
type: Question
accepted answer: http://stackoverflow.com/a/23861786
has comment: http://stackoverflow.com/comment/36726185
tagged with: graphics
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/36725828
has comment: http://stackoverflow.com/comment/36724803
tagged with: jpanel
has comment: http://stackoverflow.com/comment/36726407
score: 0
has comment: http://stackoverflow.com/comment/36726084
answer count: 1
has comment: http://stackoverflow.com/comment/36726145
has answer: http://stackoverflow.com/a/23861786
has comment: http://stackoverflow.com/comment/36724774
has comment: http://stackoverflow.com/comment/36725774
has comment: http://stackoverflow.com/comment/36725813

http://stackoverflow.com/comment/98992778
has text: The `found` value should not be always greater than `0`? If that's true then you should increment the `index` value before assigning it to `found`
comment on: http://stackoverflow.com/a/23935453
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23863374
answers question: http://stackoverflow.com/q/23863133
score: 0
type: Answer
has body: Use StringBuilder sb = new StringBuilder(); and in loop use sb.append( "loop element at index" );

http://stackoverflow.com/comment/36782828
has text: You can't do this. `Field` is a runtime representation of a class member, there's no way to check which class member are we talking about at compile-time.
comment on: http://stackoverflow.com/q/23891624
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23900941
tagged with: java
type: Question
upvote count: 2
has title: Design pattern for a client Server app
has comment: http://stackoverflow.com/comment/36852590
tagged with: client-server
answer count: 1
has comment: http://stackoverflow.com/comment/36847442
favorite count: 0
has comment: http://stackoverflow.com/comment/36808891
tagged with: rpc
has comment: http://stackoverflow.com/comment/36802689
has body: We have a client server application in GWT. The user from the client browser will be given options on provided services. I want to send all request through a single RPC (Remote Procedure Call) method. This means I will send a string, representing the service, the server will receive this string and return the result. Now since this will go through a single RPC request I have only the option to return to the client a single type of result and it must be serializeable (cannot return a java object). So for example the user can want Users , the application will return a List of user objects or the user can want transactions and the server will return a List transaction objects or in the future the user can ask for an Apple and the server will return a String. Want to gather all services and place it under a strategy or command pattern, but each service can return a different type, how can I resolve this? Or what pattern do you guys think is best? The best thing I can come up with is have a Wrapper object that will contain all the different return types of all services, set it on the server, and get the result on the client, but it looks kind of messy. Appreciate any advice. Please note the server executes Java code (Servlet), so this is a Java question and the client is basically Java but with Limitations since GWT translates it to JavaScript on compile time. Thank you.
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: design-patterns
tagged with: gwt
has answer: http://stackoverflow.com/a/23953024

http://stackoverflow.com/comment/37459249
score: 0
comment on: http://stackoverflow.com/q/23937578
has text: Check out [this](http://stackoverflow.com/questions/6847430/why-is-registerforcontextmenu-passing-oncreatecontextmenu-a-null-contextmenuinfo#comment26940568_6847430) comment, maybe this helps
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37091810
has text: Aleksandr M Please modify this answer to be suitable for this question. I am little bit confused... now...
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24055501

http://stackoverflow.com/q/23783457
favorite count: 0
has answer: http://stackoverflow.com/a/23804594
type: Question
tagged with: encryption
has answer: http://stackoverflow.com/a/23881476
tagged with: java
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36581574
type: UnansweredQuestion
tagged with: chat
has title: Loud Noise on Encrypted Voice Chat in Java Through UDP
tagged with: udp
has comment: http://stackoverflow.com/comment/36612378
has body: We had to built a encrypted/decrypted voice chat through UDP. Chat is working without encryption but when I add AES code to encrypt, i hear very loud noise which is continuous periodic beep signal but at the same time I also hear decrypted conversations which is fine. I need to eliminate this noise. We will be so grateful for your help. Thank you Sending import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import javax.sound.sampled.*; public class MicPlayer { private static final String IP_TO_STREAM_TO = "localhost" ; private static final int PORT_TO_STREAM_TO = 1234 ; /** Creates a new instance of MicPlayer */ public MicPlayer() { } /** * @param args the command line arguments */ public static void main(String[] args) { Mixer.Info minfo[] = AudioSystem.getMixerInfo() ; for( int i = 0 ; i &lt; minfo.length ; i++ ) { System.out.println( minfo[i] ) ; } if (AudioSystem.isLineSupported(Port.Info.MICROPHONE)) { try { DataLine.Info dataLineInfo = new DataLine.Info( TargetDataLine.class , getAudioFormat() ) ; TargetDataLine targetDataLine = (TargetDataLine)AudioSystem.getLine( dataLineInfo ) ; targetDataLine.open( getAudioFormat() ); targetDataLine.start(); byte tempBuffer[] = new byte[8192] ; while( true ) { targetDataLine.read( tempBuffer , 0 , tempBuffer.length ); byte[] encrypt = AES.encrypt(tempBuffer); sendThruUDP(encrypt) ; } } catch(Exception e ) { System.out.println(" not correct " ) ; System.exit(0) ; } } } public static AudioFormat getAudioFormat(){ float sampleRate = 8000.0F; //8000,11025,16000,22050,44100 int sampleSizeInBits = 16; //8,16 int channels = 1; //1,2 boolean signed = true; //true,false boolean bigEndian = false; //true,false return new AudioFormat( sampleRate, sampleSizeInBits, channels, signed, bigEndian ); } public static void sendThruUDP( byte soundpacket[] ) { try { DatagramSocket sock = new DatagramSocket() ; sock.send( new DatagramPacket( soundpacket , soundpacket.length , InetAddress.getByName( IP_TO_…
downvote count: 0
tagged with: voice
score: 1

http://stackoverflow.com/comment/36783059
type: Comment
comment on: http://stackoverflow.com/a/23891510
score: 0
type: AnswerComment
has text: You are assuming that the form has an id, and you know its value. It's not clear if FTSoft has this information.

http://stackoverflow.com/comment/36881234
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23837596
has text: Will do when I'm home.
score: 0

http://stackoverflow.com/q/23807835
has title: java.lang.IllegalStateException: Unknown protocol: classpath
downvote count: 0
favorite count: 0
tagged with: apache-felix
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36622968
has comment: http://stackoverflow.com/comment/36623677
answer count: 0
has comment: http://stackoverflow.com/comment/36624445
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36624269
type: Question
has body: When i try to configure ehcache.xsd in ehcache.xml with the below code snippet &lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="classpath:ehcache.xsd" updateCheck="false"&gt; I get this exception when i try to start the server. Caused by: java.net.MalformedURLException: Unknown protocol: classpath ehcache.xml is placed in my blueprint folder. Is classpath not recognized by osgi bundles?
has comment: http://stackoverflow.com/comment/36622693
linked to: http://stackoverflow.com/q/13266339

http://stackoverflow.com/q/23926312
has body: What is the Difference between Hash32 and Hash in String Object While Debugging I have found the String Object displays hash=0 and hash32=0 as shown in below image.Some could please explain the reason it is displayed. Thanks for the Reply
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/36849027
linked to: http://stackoverflow.com/q/11946486
has comment: http://stackoverflow.com/comment/36849009
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36849041
has answer: http://stackoverflow.com/a/23926405
has title: Difference between Hash32 and Hash in Java string Object
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36848996
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/11946486
tagged with: java
has comment: http://stackoverflow.com/comment/36849008
type: Question

http://stackoverflow.com/a/23854784
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36714711
answers question: http://stackoverflow.com/q/23849001
upvote count: 2
has body: I'm having the exact same problem with my app. I think they must have changed something in the most recent update to GameHelper.java. Here's something I tried, but just so you know, this only got rid of the errors so I could compile my code, it doesn't fix the source of the problem. // Api options to use when adding each API, null for none Games.GamesOptions mGamesApiOptions = null; Plus.PlusOptions mPlusApiOptions = null; Api.ApiOptions mAppStateApiOptions = null; I also changed the methods further down so that the Classes matched... /** * Sets the options to pass when setting up the Games API. Call before * setup(). */ public void setGamesApiOptions(Games.GamesOptions options) { doApiOptionsPreCheck(); mGamesApiOptions = options; } /** * Sets the options to pass when setting up the AppState API. Call before * setup(). */ public void setAppStateApiOptions(Api.ApiOptions options) { doApiOptionsPreCheck(); mAppStateApiOptions = options; } /** * Sets the options to pass when setting up the Plus API. Call before * setup(). */ public void setPlusApiOptions(Plus.PlusOptions options) { doApiOptionsPreCheck(); mPlusApiOptions = options; } I was still getting errors so I finally just had to get rid of the second parameters of these addApi() method calls because they weren't accepting these Class types. Fortunately the addApi() method doesn't need the options parameter, but removing it pretty much defeats the entire purpose of having these variables in the first place. if (0 != (mRequestedClients &amp; CLIENT_GAMES)) { builder.addApi(Games.API); //, mGamesApiOptions); builder.addScope(Games.SCOPE_GAMES); } if (0 != (mRequestedClients &amp; CLIENT_PLUS)) { builder.addApi(Plus.API); //, mPlusApiOptions); builder.addScope(Plus.SCOPE_PLUS_LOGIN); } if (0 != (mRequestedClients &amp; CLIENT_APPSTATE)) { builder.addApi(AppStateManager.API); //, mAppStateApiOptions); builder.addScope(AppStateManager.SCOPE_APP_STATE); } I really hope someone comes up with a real solution or they upda…
type: Answer

http://stackoverflow.com/comment/36614627
type: Comment
comment on: http://stackoverflow.com/a/23799813
has text: is the JAVA_HOME variable set ? you need to set that as well besides installing the JDK
score: 0
type: AnswerComment

http://stackoverflow.com/comment/52411145
score: 0
type: Comment
has text: Yes, thanks, problem was solved with @PowerMockIgnore("com.sun.mail.util.*")
comment on: http://stackoverflow.com/a/23949223
type: AnswerComment

http://stackoverflow.com/comment/36791243
score: 0
type: Comment
type: QuestionComment
has text: can you show how you are using at view side ?
comment on: http://stackoverflow.com/q/23895715

http://stackoverflow.com/a/23979327
score: 6
has body: You Customer entity will not be found by default because it is not in a sub-pacakge of your Application class. Try using the @EntityScan annotation (see http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-separate-entity-definitions-from-spring-configuration).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23938043
type: Answer
accepted answer of: http://stackoverflow.com/q/23938043
upvote count: 6

http://stackoverflow.com/comment/36621420
comment on: http://stackoverflow.com/q/23807219
type: Comment
type: QuestionComment
score: 6
has text: >"in way a single float would be casted (with loss of information etc) meaning I want to keep only the last 8bits of each float in the array." This is not how the float -> byte conversion works in Java.

http://stackoverflow.com/q/23911860
has comment: http://stackoverflow.com/comment/36821928
favorite count: 0
has comment: http://stackoverflow.com/comment/36821568
downvote count: 2
has body: I am developing a Java desktop application in Netbeans. I run my application on PC but i may have to run it on ARM based tablets also. My application uses JDK7 and swingx library. It also connects to mysql database so it uses mysql library too. How can i know that my application can run on ARM based touch tablets? Is there any simulator for ARM or which tablet device should i buy for testing it? Since i am Windows guy, i need your advice about these topics.
upvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: arm
has answer: http://stackoverflow.com/a/23912092
score: -1
accepted answer: http://stackoverflow.com/a/23912092
has title: which tablets run my Java application
tagged with: tablet
answer count: 1
has comment: http://stackoverflow.com/comment/36821782

http://stackoverflow.com/comment/36774903
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23887023
has text: I tried to debug as well. Works fine for me
score: 0

http://stackoverflow.com/comment/36835205
has text: @ScottBarta actually... you are right. I used the answer in the question you linked and it worked contrary to the statement in that blog entry that aar is directly supported after 0.5.0.
type: Comment
comment on: http://stackoverflow.com/q/23901369
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36804816
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23902766
has text: you can use log.debug() in each step. There is no such tool so far i know to view what codes are implementing line by line. I use log.debug() where i need to monitor the functioning.
score: 0

http://stackoverflow.com/comment/36625722
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23809218
has text: @ AntonH , thanks, I was confused that I might need to add 1 since System.out.println(f(r[i+1])) was saying +1, I guess I should ignore this whole sentence.

http://stackoverflow.com/comment/36655913
comment on: http://stackoverflow.com/q/23824835
score: 0
type: Comment
type: QuestionComment
has text: Can you post some code?

http://stackoverflow.com/comment/36739692
score: 0
comment on: http://stackoverflow.com/q/23869016
type: Comment
type: QuestionComment
has text: Adding 0 to the sum doesn't change it

http://stackoverflow.com/comment/36870384
score: 1
type: AnswerComment
has text: But it is a string, Im starting with a string containing that text not a literal, i cant assign String[] splits to a string; – Paul Taylor 10 secs ago
type: Comment
comment on: http://stackoverflow.com/a/23937860

http://stackoverflow.com/a/23936723
has comment: http://stackoverflow.com/comment/65974294
type: AcceptedAnswer
score: 721
has comment: http://stackoverflow.com/comment/94018874
has comment: http://stackoverflow.com/comment/69223138
has comment: http://stackoverflow.com/comment/65974092
accepted answer of: http://stackoverflow.com/q/23932061
has comment: http://stackoverflow.com/comment/52364127
answers question: http://stackoverflow.com/q/23932061
type: Answer
has comment: http://stackoverflow.com/comment/65599252
has body: Iterable has a spliterator() method, which you can pass to StreamSupport.stream to create a stream: StreamSupport.stream(iterable.spliterator(), false) .filter(...) .moreStreamOps(...); This is a much better answer than using spliteratorUnknownSize directly, as it is both easier and gets a better result. In the worst case, it's the same code (the default implementation uses spliteratorUnknownSize), but in the more common case, where your Iterable is already a collection, you'll get a better spliterator, and therefore better stream performance (maybe even good parallelism). It's also less code. As you can see, getting a stream from an Iterable (see also this question) is not very painful.
upvote count: 723
has comment: http://stackoverflow.com/comment/77200979
downvote count: 2

http://stackoverflow.com/a/23842484
answers question: http://stackoverflow.com/q/23842428
downvote count: 0
has comment: http://stackoverflow.com/comment/36689355
has body: use this : public Board copy(Board parent){ return new Board(parent); } public Board(Board parent){ System.arraycopy(parent.getTable(),0,this.table,0,parent.getTable().length); this.future = new ArrayList&lt;Character&gt;(parent.getFuture()); this.initialiseTileReps(); this.initialiseValueReps(); this.movesTaken = new ArrayList&lt;Character&gt;(parent.getMovesTaken()); }
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/39136976
type: QuestionComment
comment on: http://stackoverflow.com/q/23811267
score: 0
has text: it's the bitwise exclusive OR operator (more about operators [here](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html)). You've got the 0x00FFFFFF mask (alpha, r, g, b) after the or, so imagine that as your maximum value and after the exlusive OR you get back what's left from your maximum amount. Let's take a simpler example: 0xFF(255) for a grayscale image is your maximum value. If you have a pixel with a value of 32 for example and you want to get the negative of that pixel you would subtract 32 from the maximum(255): 223...
type: Comment

http://stackoverflow.com/comment/59641762
has text: I got classdefnotfound error on Base64Url
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23886725

http://stackoverflow.com/q/23846237
score: 0
tagged with: java
answer count: 5
downvote count: 1
has answer: http://stackoverflow.com/a/23846266
has answer: http://stackoverflow.com/a/23846273
has answer: http://stackoverflow.com/a/23846367
has comment: http://stackoverflow.com/comment/36696086
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/744226
has answer: http://stackoverflow.com/a/23846277
favorite count: 0
has answer: http://stackoverflow.com/a/23846279
type: Question
has comment: http://stackoverflow.com/comment/36696104
accepted answer: http://stackoverflow.com/a/23846367
has title: Java get variable name as string
upvote count: 1
has body: final static int DRAGON = 5, SNAKE = 6; String this_item = "DRAGON"; int item_value = super_func(this_item);//must be 5 Is it possible to implement this super_func, as shown above? Or maybe I am asking for too much? EDIT: I am not allowed to use enum. I can: a) use a map (as someone pointed, or 2 array lists) or b) do this with some pro way (but it doesn't seem possible).
possible better answer: http://stackoverflow.com/a/23846279
has comment: http://stackoverflow.com/comment/36696062

http://stackoverflow.com/a/23917803
downvote count: 0
has comment: http://stackoverflow.com/comment/36832794
has comment: http://stackoverflow.com/comment/36832907
has comment: http://stackoverflow.com/comment/36832810
type: Answer
has comment: http://stackoverflow.com/comment/36832919
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/36832955
accepted answer of: http://stackoverflow.com/q/23917717
has body: Use "\&lt;[^\>]+\>" in the split
answers question: http://stackoverflow.com/q/23917717
type: AcceptedAnswer

spring-ws
tags question: http://stackoverflow.com/q/23831146
tag name: spring-ws
tags question: http://stackoverflow.com/q/23863534
type: Tag

http://stackoverflow.com/q/23873507
has title: hidden div doesn't appears where i want it to appear
score: 0
tagged with: visibility
has comment: http://stackoverflow.com/comment/36747878
has answer: http://stackoverflow.com/a/23873642
tagged with: http://stackoverflow.com/tag/html
has body: This is my first on posting here. I hope you understand my question! <% for(cart c: cart) {%> ...... ...... ...... ...... <form action="doEditCart.jsp?id=<%= c.getID() %>" method="post"> <% }%> This Shows a table and, in every row, shows a "Edit" button. My problem here is that, if i press any "Edit" button in any row, "TextBox" and "Save" button appears only in the first row. In this capture I pressed Edit in the fourth row. How to show TextBox and Save button in the row that I pressed the edit button? Thank you.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36748117
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36748061
has answer: http://stackoverflow.com/a/23874508
type: Question
tagged with: java
answer count: 2
tagged with: jsp

buttonclick
type: Tag
tags question: http://stackoverflow.com/q/23796122
tag name: buttonclick
tags question: http://stackoverflow.com/q/23900351

http://stackoverflow.com/q/23780038
possible better answer: http://stackoverflow.com/a/23780136
has body: Hello I want to make "something" in java that is a pack of boolean variables. Coming from C I would create a struct that holds these variables so they are organized somehow. Now in java I am confused on how I should move on. To be more specific I would like to know what is better for this occasion: A class with private members and getters-setters? A class with static private members? An interface with these values? Thx in advance. To be more specific I would like to pass a bunch of options to a function, so instead of calling a function like foo(arg1,arg2,arg3.... argn); //each arg has different type I want to create a pack of this args and call the function like this: foo(packetOfArgs); Can you provide me with any guidelines for this occasion?
has comment: http://stackoverflow.com/comment/36570778
has answer: http://stackoverflow.com/a/23780136
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36570869
downvote count: 0
has answer: http://stackoverflow.com/a/23780151
has answer: http://stackoverflow.com/a/23780126
score: 1
accepted answer: http://stackoverflow.com/a/23780126
tagged with: java
type: Question
has title: Java pack of variables
has comment: http://stackoverflow.com/comment/36570815
has answer: http://stackoverflow.com/a/23780285
has comment: http://stackoverflow.com/comment/36570763
upvote count: 1
has answer: http://stackoverflow.com/a/23780146
favorite count: 0
answer count: 5

http://stackoverflow.com/q/23931208
type: Question
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/36858054
score: 9
answer count: 2
tagged with: single-threaded
tagged with: singlethreadmodel
downvote count: 0
has answer: http://stackoverflow.com/a/26875206
favorite count: 0
tagged with: vert.x
has body: From my understanding, each vert.x instance will be assigned an event loop. Event loop handles all the request an other task for that particular instance. Event loop is a thread, I think. When there are multiple vert.x instance deployed, each instance have there own event loops right? That means there are multiple thread(multi-threading) exists. This is how I understood. This single-threading concept causing me so much headache. Any help will be appreciated.
has title: How vert.x is single threaded?
has comment: http://stackoverflow.com/comment/36993253
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25818196

http://stackoverflow.com/comment/36581263
type: Comment
has text: I dont know how you went from the comment above to your edit...
score: 1
comment on: http://stackoverflow.com/q/23785611
type: QuestionComment

http://stackoverflow.com/q/23873014
tagged with: cmd
score: 1
has answer: http://stackoverflow.com/a/23873297
favorite count: 0
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23873297
upvote count: 1
answer count: 1
has title: Batch script installation
has body: i have written a simple batch for java installation for /f "tokens=3" %%c in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /v Java7FamilyVersion') do set java_version=%%c if %java_version%==1.7.0_55 (goto end) else (goto install) :end exit :install msiexec.exe /I "%~DP0jre1.7.0_55.msi" /q /norestart /L "%windir%\log\Oracle_SUN_JAVA7_SE_Up55_DE_x86_0253_Install.log" I would like to check if the version i want to install is already installed if yes installation should be skipped. When Java is not installed at all then of course the registry key is missing and i get an error. Can someone help me with this problem?
tagged with: batch-file
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/36692917
comment on: http://stackoverflow.com/q/23844538
type: Comment
type: QuestionComment
has text: Have you created entity classes?
score: 0

http://stackoverflow.com/comment/36572766
type: AnswerComment
comment on: http://stackoverflow.com/a/23781197
type: Comment
has text: But you will end up with two empty Strings at the end.
score: 1

http://stackoverflow.com/comment/36653818
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23812106
has text: @maaartinus Yes, although I don't like making assumptions about what optimizations various JVMs will or will not make. Some are better than others :). Even if it's not optimized away though it will have a tiny cost.
type: AnswerComment

http://stackoverflow.com/q/23887660
has body: recently have gone to test a form of key validation code from files in Java. I'm still new to this(IO) and looking online brings endless methods of approaching this but I'm not capable of distinguishing the various pros &amp; cons between these methods. I would like to present my code and ask me how I should tackle in properly, it works but I'm not all too satisfied. I know most of you are against advice-oriented questions and if it is the case I'll gladly put the topic down, just wanted to ask for some help beforehand. Thank you /* * To be able to give you a rundown of the situation: * Inside my project file I have a .txt file named 'MasterKey' * Initially inside this file is a key and validation boolean 'false' * On start-up the program analyzes this file, if it detecs a key it then * Asks the user to input the key. If it is valid it then creates/overwrites the * Previous file with a new .txt with same name but only "true" is inside it. * If the key is incorrect, it will continue requesting for the key */ import java.io.*; import java.util.Scanner; public class MasterKeyValidationTest { private static Scanner input = new Scanner(System.in); public static void main(String[] args) { getFileInfo(); //Method below } private static void getFileInfo(){ File readFile = new File("/Users/Juxhin's Lab/Desktop/Projects/MasterKey.txt"); //My file directory try{ BufferedReader getInfo = new BufferedReader( new FileReader(readFile)); String fileInfo = getInfo.readLine(); //Gets the key or 'true' if(fileInfo.contains("true")){ //If file contains 'true', program is valid System.out.println("Valid"); }else{ System.out.println("Enter Key"); String key = input.next(); //Receive input for the key if(!fileInfo.contains(key)) { //If the file doesn't contain the key you just entered System.out.println("Invalid key"); key = input.next(); //Receive another key input getFileInfo(); //Start the method from top again to check } if (fileInfo.contains(key)) { //If the file contains the key you…
upvote count: 1
accepted answer: http://stackoverflow.com/a/23887776
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36776613
has answer: http://stackoverflow.com/a/23887776
has comment: http://stackoverflow.com/comment/36788452
score: 0
has title: File overwriting/reading advice required
tagged with: io
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36750847
type: Comment
has text: Double backslashes in paths look wrong. With Gradle 1.11, neither `sonar.jacoco.reportPath` nor `sonar.junit.reportsPath` should have to be configured manually (perhaps try with 1.12 just to be sure).
type: QuestionComment
comment on: http://stackoverflow.com/q/23875038
score: 0

http://stackoverflow.com/comment/36753710
comment on: http://stackoverflow.com/q/23875078
score: 0
has text: @Peter Lawrey: Sorry, don't know how to "inrease new size", or how to deal with temp working space getting into tenured space. Are these handled via arguments to the JVM (if so, what args?), or?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23859759
has comment: http://stackoverflow.com/comment/36761245
score: 1
answers question: http://stackoverflow.com/q/23859523
has body: What you need to do is make a server request (GET/POST) with a pair of username and password. You can use the following code new AsyncTask&lt;String, String, String&gt;(){ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.urloflink.com"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;; nameValuePairs.add(new BasicNameValuePair("username", "user")); nameValuePairs.add(new BasicNameValuePair("password", "pass")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } } @Override protected void onPostExecute(String result) { result = response.getresult(); // a hypothetical function according to your server response format // Extract response string from response and check the result if(result == "success"){ // DO something } else if(result == "failure"){ // Do something } }.execute(); This is an asynctask which runs in a separate thread. Hence during this process you can show processing ring or some animation. The content in doInBackground() runs in background and to make any changes to the UI you can use onPostExecute() block. You can use the above code in your password match function as: private boolean passwordsMatch(String mCurrentPassword) { new AsyncTask&lt;String,.... .... }.execute(); } Make sure that you replace the function response.getResult() with an actual function or some code segment that gives you the result.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36723049
upvote count: 1

http://stackoverflow.com/q/23864446
score: 1
has body: I have an ASCII game board that I am displaying in the Mac OS X Terminal, and it needs to be updated frequently. Is there a convenient way to erase or overwrite previously printed content in the Terminal? Or do I need to clear the screen each time and reprint the board? (Looking for solutions that use either Java or Scala)
tagged with: macos
favorite count: 0
tagged with: terminal
type: Question
tagged with: scala
has title: Terminal animation - is clearing screen right approach?
has comment: http://stackoverflow.com/comment/36731429
has comment: http://stackoverflow.com/comment/36731986
linked to: http://stackoverflow.com/q/1321308
has answer: http://stackoverflow.com/a/23869875
tagged with: java
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36731542
accepted answer: http://stackoverflow.com/a/23869875
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/23914846
answers question: http://stackoverflow.com/q/23914695
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23914695
downvote count: 0
has body: The issue could be locale specific. Check Calendar documentation First Week Calendar defines a locale-specific seven day week using two parameters: the first day of the week and the minimal days in first week (from 1 to 7). I suggest you print calendar.getMinimalDaysInFirstWeek() in both platforms and compare
has comment: http://stackoverflow.com/comment/36827437
type: Answer
has comment: http://stackoverflow.com/comment/36827591
upvote count: 5

http://stackoverflow.com/q/23796433
has comment: http://stackoverflow.com/comment/36601641
score: 0
has comment: http://stackoverflow.com/comment/36601758
has comment: http://stackoverflow.com/comment/36601936
has comment: http://stackoverflow.com/comment/36601618
answer count: 1
has title: Gson; list of objects in list of objects
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36601918
tagged with: android
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/23798396
linked to: http://stackoverflow.com/q/17321828
has comment: http://stackoverflow.com/comment/36601709
type: Question
has body: I have json which looks like this: [{ "id":14, "namelanguage1":"Książka", "namelanguage2":"das Buch", "tags": [{ "id":2, "name":"Szkoła", "language_user_id":null, "created_at":"2014-04-11T17:30:28.356Z", "updated_at":"2014-04-11T17:30:28.356Z", "user_id":2 }], "language1_id":5, "language2_id":1, }, { "id":15, "namelanguage1":"das Fußball", "namelanguage2":"Piłka nożna", "tags":[{ "id":2, "name":"Szkoła", "language_user_id":null, "created_at":"2014-04-11T17:30:28.356Z", "updated_at":"2014-04-11T17:30:28.356Z", "user_id":2 }, { "id":3, "name":"Sport", "language_user_id":null, "created_at":"2014-04-11T17:30:33.059Z", "updated_at":"2014-04-11T17:30:36.769Z", "user_id":2 }], "language1_id":1, "language2_id":5, }] I don't know how to get a tag id. Now I have this: public class Word { @SerializedName("id") public long id; @SerializedName("namelanguage1") public String nameLanguage1; @SerializedName("namelanguage2") public String nameLanguage2; @SerializedName("language1_id") public long language1_id; @SerializedName("language2_id") public long language2_id; public ArrayList&lt;Tag&gt; tags; and getters and setters for it. I don't know how to get id of tags. I try understand this example: example from stackoverflow but still I don't know how to do this. It's how i have it in code: words = VolleyDemoApplication.obtain().getGson() .fromJson(response, new TypeToken&lt;ArrayList&lt;Word&gt;&gt;() { }.getType()); I get values from word like this: word.getNameLanguage1() + " " +word.getLanguage1_id() + " " + word.getNameLanguage2()+ " " + word.getLanguage2_id() + " " + word.getTags(). And here word.getTags(). and I don't know what write then.
has comment: http://stackoverflow.com/comment/36601740
has comment: http://stackoverflow.com/comment/36602040

http://stackoverflow.com/comment/36806047
type: QuestionComment
type: Comment
has text: 1) maybe getId is a getter 2) maybe there is no id == 1 3) maybe id is not an int?
comment on: http://stackoverflow.com/q/23903403
score: 0

http://stackoverflow.com/q/23910086
tagged with: generics
linked to: http://stackoverflow.com/q/23871541
has body: I am trying add generic classes for stores common methods used by all my controller and service classes, and so far I got this code: controller https://github.com/klebermo/blog.cms/blob/master/src/main/java/com/config/generic/controller/controller.java service https://github.com/klebermo/blog.cms/blob/master/src/main/java/com/config/generic/service/service.java My goal is be able to implement all my controller and service classes with something like that: controller @Controller @RequestMapping(value="usuario") public class UsuarioController extends controller&lt;Usuario&gt; { public UsuarioController() { super(Usuario.class); } } service @Service public class UsuarioService extends service&lt;Usuario&gt; { public UsuarioService() { super(Usuario.class); } } But right now, I am getting this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'controller' defined in file [/home/kleber/apache-tomcat-7.0.42/webapps/blog/WEB-INF/classes/com/config/generic/controller/controller.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.config.generic.controller.controller]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.config.generic.controller.controller.&lt;init&gt;() at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Abstr…
tagged with: spring
accepted answer: http://stackoverflow.com/a/23910882
tagged with: spring-mvc
type: AnsweredQuestion
has title: Generic class for controller and service classes in a Spring project
tagged with: java
has answer: http://stackoverflow.com/a/23910175
has answer: http://stackoverflow.com/a/23910882
type: Question
has comment: http://stackoverflow.com/comment/36819070
possible better answer: http://stackoverflow.com/a/23910175
has comment: http://stackoverflow.com/comment/36817965
score: 0
answer count: 2

http://stackoverflow.com/comment/36637705
has text: @newbiejava1998 I've pushed some of my Java code for project euler to www.github.com/mananshah99/project-euler. Feel free to check it out if you get stuck on any additional problems :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23815217
score: 0

http://stackoverflow.com/a/23867647
accepted answer of: http://stackoverflow.com/q/23867435
downvote count: 0
has comment: http://stackoverflow.com/comment/36737186
has comment: http://stackoverflow.com/comment/36737149
has comment: http://stackoverflow.com/comment/36737094
has comment: http://stackoverflow.com/comment/36738070
has comment: http://stackoverflow.com/comment/36737431
has body: It's better to stick to an SQL query then, since HQL makes sense only when you plan on changing states from the resulted entities. In your case, the SQL is a better alternative, since it doesn't really follow the standard and you only want a projection anyway. You could remove the group by with distinct but it will require a derived table, which can be done in plain SQL anyway. List dtos = s.createSQLQuery( "SELECT " + " ERRORS.DMN_NAM AS dmnNam, " + " CODES.MSG_TXT AS msgTxt " + "FROM SERV_ERR ERRORS, EVENT_CD CODES " + "WHERE ERRORS.SERV_RESP_CD_TXT = CODES.CD_TXT " + "GROUP BY " + " ERRORS.DMN_NAM, " + " ERRORS.SERV_NAM, " + " CODES.MSG_TXT, " + " ERRORS.SERV_ERR_CNT, " + " ERRORS.ERR_TS_NUM " + "ORDER BY " + " ERRORS.DMN_NAM, " + " CODES.MSG_TXT " .addScalar("dmnNam") .addScalar("msgTxt") .setResultTransformer( Transformers.aliasToBean(MyDTO.class)) .list(); Make sure YourDTO has a matching constructor, and the types are the exactly like ee.dmn.nam and ece msgTxt. Instead of group by I'd choose: SELECT dmnNam, msgTxt FROM ( SELECT DISTINCT ERRORS.DMN_NAM AS dmnNam, ERRORS.SERV_NAM, CODES.MSG_TXT AS msgTxt, ERRORS.SERV_ERR_CNT, ERRORS.ERR_TS_NUM FROM SERV_ERR ERRORS, EVENT_CD CODES WHERE ERRORS.SERV_RESP_CD_TXT = CODES.CD_TXT ORDER BY dmnNam, msgTxt ) as DATA
upvote count: 2
has comment: http://stackoverflow.com/comment/36737051
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23867435
score: 2

http://stackoverflow.com/q/23856818
has body: I have few text fields. How to enable button if user filled all text fields and disable if user delete something? I'm using Swing.
favorite count: 0
tagged with: listener
possible better answer: http://stackoverflow.com/a/23856849
has answer: http://stackoverflow.com/a/23857118
accepted answer: http://stackoverflow.com/a/23857118
has title: Set enable button if text field is fill
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: swing
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/23856849
answer count: 2
upvote count: 1
downvote count: 0
tagged with: button

http://stackoverflow.com/q/23823574
favorite count: 0
tagged with: blocking
tagged with: multithreading
tagged with: netty
has body: Situation: Given the telnet client &amp; server example of the official repo (https://github.com/netty/netty/tree/4.0/example/src/main/java/io/netty/example/telnet), I've change this a little bit using a fake blocking task: https://github.com/knalli/netty-with-bio-task/tree/master/src/main/java/de/knallisworld/poc This is Netty 4! Instead of echo replying the message (like the telnet server demo does), the channel handler blocks the thread for some time (in real world with things like JDBC or JSch, ...). try { Thread.sleep(3000); } catch (InterruptedException e) {}; future = ctx.write("Task finished at " + new Date()); future.addListener(ChannelFutureListener.CLOSE); This actually works: I'm testing this with a echo "Hello" | nc localhost $port) and the thread will be blocked (and nc waits) until it returns 3 seconds later. However, this means I'm blocking a thread of Netty's event loop worker group with an unrelated task. Therefor, I've changed the channel registration and applied a custom executor: public class TelnetServerInitializer extends ChannelInitializer&lt;SocketChannel&gt; { private static final StringDecoder DECODER = new StringDecoder(); private static final StringEncoder ENCODER = new StringEncoder(); private TelnetServerHandler serverHandler; private EventExecutorGroup executorGroup; public TelnetServerInitializer() { executorGroup = new DefaultEventExecutorGroup(10); serverHandler = new TelnetServerHandler(); } @Override protected void initChannel(final SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("framer", new DelimiterBasedFrameDecoder( 8192, Delimiters.lineDelimiter())); pipeline.addLast("decoder", DECODER); pipeline.addLast("encoder", ENCODER); // THIS! pipeline.addLast(executorGroup, "handler", serverHandler); } } Unfortunately, after this configuration the socket will be closed immediately after exiting handler's channelRead0(). I can see that the task itself will be processed including calling…
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23842243
accepted answer: http://stackoverflow.com/a/23842243
type: Question
has title: How can I use a separate task executor for blocking sub tasks in netty?
upvote count: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23813446
type: Answer
has body: The value of threadCount is passed-by-value to the new Thread. Hence the thread will only increment its own threadCount variable. A simple solution would be to give the new thread a reference the its own object and create methods that increment and decrement the threadCounter. Edit: I missed that the integer was stored in a class, which might invalidate my reasoning. However, I still think that all threads are seeing local copies, which would mean that my solution should work.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23812981
accepted answer of: http://stackoverflow.com/q/23812981
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23891170
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23892377
answer count: 1
accepted answer: http://stackoverflow.com/a/23892377
type: AnsweredQuestion
has title: How to add IP Address and userId to log file (Commons-logging lib)
has body: What is the appoarch/mechanism to add IP address and Loggedin userId while logging to lof file.(using some patterns). FYI And we are using commons-logging framework. Thanks in advance.
tagged with: log4j
type: Question

http://stackoverflow.com/q/23847201
tagged with: reference
has body: For example, I have an enum public enum DistanceUnits { METER, KILOMETER, MILE; } I have a global reference type of it DistanceUnits distanceUnit;. At some point of time it is set to some constant value say distanceUnit = DistanceUnits.METER. Now if I want to work temporarily and globally with another constant value say distanceUnit = DistanceUnits.KILOMETER. But after the temporary process, I want to get back to my original value which is distanceUnit = DistanceUnits.METER. How to store distanceUnit = DistanceUnits.METER so that it can be recovered again. I know this is due to the rules of the java language that deal with reference types. So is there a workaround for this issue?. Another questions: - If there is a possible workaround for this problem. Is it applicable for java objects also? - If there is a possible workaround for java objects but not applicable for enums then share it?
tagged with: java
has comment: http://stackoverflow.com/comment/36698022
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36698063
tagged with: object
has comment: http://stackoverflow.com/comment/36698002
tagged with: enums
score: -1
has answer: http://stackoverflow.com/a/23847262
has comment: http://stackoverflow.com/comment/36699313
has title: Workaround for storing an original enum constant value to be used later?
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36698958
favorite count: 0
has comment: http://stackoverflow.com/comment/36698525
type: UnansweredQuestion

http://stackoverflow.com/comment/36854879
has text: Forget for the moment about more difficult case and try `<s:property value="#attr.foo"/>`. Do you understand why it returns `bar`?
comment on: http://stackoverflow.com/q/23919226
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23918529
downvote count: 0
type: Answer
has body: ApplicationContetAware Interface to be implemented by any object that wishes to be notified of the ApplicationContext that it runs in. In your case there is none. You have to first bootstrap Spring as this is a standalone/console app, through java code. You have to first initialize the applicationcontext/BeanFactory. Use ApplicationContext (preferebly ClassPathXmlApplicationContext if your using xml configuration) ApplicationContext context = new ClassPathXmlApplicationContext(contextfile.xml); ApplicationContextHolder will now have the reference of current ApplicationContext.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23918073

http://stackoverflow.com/comment/36861302
type: Comment
has text: Will there be any issues with ArrayList<Bitmap> ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23932776

http://stackoverflow.com/q/23822501
answer count: 1
has answer: http://stackoverflow.com/a/23822694
has title: Struts Tiles taglib class not found
score: 0
accepted answer: http://stackoverflow.com/a/23822694
has comment: http://stackoverflow.com/comment/36651118
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am using struts tiles concept. I got an error: java.lang.ClassNotFoundException org.apache.struts.taglib.tiles.UseAttributeTei I have downloaded apache.struts.1.3.8.jar file.

http://stackoverflow.com/comment/36683576
type: QuestionComment
has text: Where are the files been stored? Are they in the src or are they external files
score: 0
comment on: http://stackoverflow.com/q/23837424
type: Comment

http://stackoverflow.com/a/23929155
has body: First table creation CREATE TABLE mobile ( t_name VARCHAR (20), t_count NUMBER, PRIMARY KEY (t_name) ); And insert statement INSERT INTO mobile VALUES ('Sony', 1); Single statement for insert and update MERGE INTO mobile t USING (SELECT * FROM mobile WHERE LOWER (t_name) = 'sony') s ON (t.t_name = s.t_name) WHEN MATCHED THEN UPDATE SET t.t_count = t_count+1 WHEN NOT MATCHED THEN INSERT (t_name, t_count) VALUES ('sony', 1);
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23929029
score: 1
has comment: http://stackoverflow.com/comment/36853979
downvote count: 0
has comment: http://stackoverflow.com/comment/36854041

http://stackoverflow.com/comment/36598597
comment on: http://stackoverflow.com/q/23794428
score: 0
type: Comment
type: QuestionComment
has text: Are you trying to return one result based on one id or several results based on an array of ids?

http://stackoverflow.com/q/23925424
tagged with: multithreading
has title: Processing a large number of tasks with CompletionService
tagged with: completion-service
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has body: I need to process a large number (>100 million) of requests on a multi-core machine (each request is to process a row in a data file and involves some I/O with a remote system. Although the details do not matter much, the specific task is to load a distributed Hazelcast map from some data files). The execution will be handled through a ThreadPoolExecutor. One thread will read the file then submit the data to multiple independent threads to put it in the map. The machine has 32 cores, so there are enough available for parallel loading of the map. Because of the large number of requests, the common approach of creating tasks and queueing them to the executor service is not feasible as the queued tasks will take up too much memory. Which brings the ExecutorCompletionService. With it, a task would be submitted when a previous operation completed, which is known by calling take() (or poll(), as applicable). This will work fine when all the threads of the executor service are used. However, "loading up all the threads" is not done yet. There are two phases: fill up the queue: while there are still unused threads in the pool, submit tasks to the ExecutorCompletionService and do not wait until submitting more feed the queue: once the threads are all used, submit a task only once a previous task has finished. Thus, rows will be fed as quickly as possible, but not quicker and will not be queued. The above can be coded, but I was wondering if the above logic is already implemented and I somehow missed it. I'm asking because it looks to be a common scenario.
type: Question
tagged with: hazelcast
has answer: http://stackoverflow.com/a/23925523
accepted answer: http://stackoverflow.com/a/23925523
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/23925910
has answer: http://stackoverflow.com/a/23925910
tagged with: executorservice
favorite count: 0

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/23813753
type: Tag
tags question: http://stackoverflow.com/q/23836545
tags question: http://stackoverflow.com/q/23905122
tags question: http://stackoverflow.com/q/23837784

http://stackoverflow.com/q/23868911
type: Question
has answer: http://stackoverflow.com/a/23870885
has body: So to make it relatively simple: I have some Primefaces-Page, which is supposed to represent database records in a table-structure. I keep these records in a List&lt;Customer&gt; which resides in a @ConversationScoped backing bean. I have verified via debugging, that the List gets correctly filled with records from the Database (hibernate db FWIW). This is accomplished with the help of a "businessInterface" Distributor class, that is in fact nothing but a decoupling mask for (Database)Service-Classes. As mentioned, I have verified that the Database, as well as the Distributor correctly return the expected values. Unfortunately in the View there are no records present and instead the emptyMessage is displayed. The application is running on a jBoss 7.1.1-Final Application Server. For better readability I have excluded the h:head, as well as h:body, ui:composition, ui:define and h:form around the provided code, as well as shortened the columns to the two different usages (property display and action exposition) The View (shortened and truncated): &lt;ui:define name="inhalt"&gt; &lt;p:growl id="msgGrowl" autoUpdate="true" showDetail="true" /&gt; &lt;h:form onkeypress="if (event.keyCode == 13) {return false; }"&gt; &lt;p:dataTable var="customeritem" id="customerTable" rowkey="#{customeritem.id}" value="#{customerListController.customerList}" paginator="true" rows="13" autoUpdate="true" filteredValue="#{customerListController.filteredCustomers}" emptyMessage="no customers found!" sortFunction="#{customerListController.filteredCustomers}"&gt; &lt;p:column sortBy="name" filterBy="name" headerText="Kunde" filterMatchMode="contains"&gt; &lt;h:outputText value="#{customeritem.name}" /&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;p:commandButton value="Neuer Kunde" action="${customerListController.addCustomer()}" icon="ui-icon-plus" /&gt; &lt;/f:facet&gt; &lt;p:commandButton id="doViewDetailsButton" icon="ui-icon-clipboard" action="${customerListCont…
accepted answer: http://stackoverflow.com/a/23870885
has title: Loaded Records not showing in view
tagged with: conversation-scope
answer count: 1
downvote count: 0
tagged with: jboss7.x
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
score: 1
tagged with: java

http://stackoverflow.com/a/23844308
score: 0
type: Answer
has body: If you want user to fill the array, you need to use Scanner object. Scanner scanner = new Scanner(System.in); System.out.println("Enter the number of grades: "); int n = scanner.nextInt(); double[] english = new double[n]; for(int i=0; i&lt;n; i++) { System.out.println("Please enter the grade for grade " + (i+1) + ":"); english[i] = scanner.nextDouble(); } scanner.close(); Than you may use Markus Johnsson's code to proceed.
answers question: http://stackoverflow.com/q/23843971

http://stackoverflow.com/comment/39291217
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [How many Java objects are generated by this - new String("abcd")](http://stackoverflow.com/questions/5192574/how-many-java-objects-are-generated-by-this-new-stringabcd)
comment on: http://stackoverflow.com/q/23932722

http://stackoverflow.com/comment/36753915
comment on: http://stackoverflow.com/q/23876514
score: 0
type: Comment
type: QuestionComment
has text: What type of persistence do you use? If you are using JPA, the insert might be delayed until you commit, explaining the observerd behaviour.

http://stackoverflow.com/a/23895902
has comment: http://stackoverflow.com/comment/36813657
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23894725
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/36792130
has body: Based on the given information, it looks like a typical example for task-based concurrency -- not for actor-based concurrency. Imagine you have a method for doing the HTTP request. The method fetches the given URL and returns an object without causing any data races on shared memory: private static Page loadPage(String url) { // ... } You can easily fetch the pages concurrently with an Executor. There are different kinds of Executors, e.g. you can use one with a fixed number of threads. public static void main(String... args) { ExecutorService executor = Executors.newFixedThreadPool(5); List&lt;Future&lt;Page&gt;&gt; futures = new ArrayList&lt;&gt;(); // submit tasks for (String url : args) { futures.add(executor.submit(() -&gt; loadPage(url))); } // access result of tasks (or wait until it is available) for (Future&lt;Page&gt; future : futures) { Page page = future.get(); // ... } executor.shutdown(); } There is no further synchronization required. The Executor framework takes care of that.

http://stackoverflow.com/a/23886503
has body: Use a CollisionListener and check the user data of your fixtures/bodies for the type. Then you can handle it however you want. If you don't want the player/bullet collision to have a response, you should disable the Contact in preSolve (via Contact.setEnabled(false)) and mark the bullet to be destroyed. Having a powerful collision handling system is necessary in this case. I've created a gist which shows how I do it via socalled CollisionHandlers. which are responsible for each type of EntityA vs EntityB collisions. The CollisionFilter can already pre-filter the collisions in total and the CollisionListener will then determine the correct CollisionHandler and forward the callbacks to those. It uses reflection and might not be the fastest approach with a lot of bodies and collisions, but so far I didn't ran into any problems here. You can find the gist here.
type: Answer
has comment: http://stackoverflow.com/comment/36778396
has comment: http://stackoverflow.com/comment/36778549
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36778606
has comment: http://stackoverflow.com/comment/36777308
accepted answer of: http://stackoverflow.com/q/23884606
has comment: http://stackoverflow.com/comment/36778461
has comment: http://stackoverflow.com/comment/36777937
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23884606
has comment: http://stackoverflow.com/comment/36777424

http://stackoverflow.com/q/23785855
favorite count: 0
has answer: http://stackoverflow.com/a/23785929
has body: Good Afternoon in my timezone I am beginning with EJBs , and i have a little question: snippet of code : public class OrderBilling implements MessageListener{ public void onMessage(Message message){ try{ ObjectMessage om = (ObjectMessage)message; Order order = om.getObject(); How the JVM where the MessageBean is running knows how to load the Order class? RMI is able to download classes from one JVM to another, but because in JMS the MessageBean does not communicate directly with the client but communicates with the JMS server how this process is possible ? Thanks in advance Best regards
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23785929
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ejb
has title: Message Driver Beans Message
has comment: http://stackoverflow.com/comment/36581514
answer count: 1
downvote count: 0
tagged with: jms

http://stackoverflow.com/q/23884481
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/15261456
tagged with: jersey
has comment: http://stackoverflow.com/comment/36769232
has body: I read a couple if thing on the net but it's like greek to me. eg : jackson disable fail_on_empty_beans Nothing seems to be related to a non wadl generation trouble. I do have a rest service up and running locally, installed on a Tomcat server. As the service is growing up, i decided to use Jersey ability to get a wadl. But when i tried to call the following adress , i've got an error http://localhost:9090/android-rest-0.0.5-SNAPSHOT/application.wadl ( tried also on server ) I'm quite afraid of integrating wrapper especially as the rest is working fine. May someone kindly explain how i can do to get my wadl generated ? com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class java.io.ByteArrayInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:59) at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:26) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:114) at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:809) at com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString(ObjectWriter.java:684) at com.myc.android.rest.util.LoggingResponseFilter.filter(LoggingResponseFilter.java:27) at org.glassfish.jersey.server.ContainerFilteringStage$ResponseFilterStage.apply(ContainerFilteringStage.java:231) at org.glassfish.jersey.server.ContainerFilteringStage$ResponseFilterStage.apply(ContainerFilteringStage.java:196) at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171) at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:379) at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:371) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.j…
tagged with: rest
has comment: http://stackoverflow.com/comment/36897664
tagged with: wadl
downvote count: 0
has comment: http://stackoverflow.com/comment/36897676
has comment: http://stackoverflow.com/comment/36773180
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/9486835
upvote count: 1
has title: Jersey : Generating a wadl give me No serializer found for class java.io.ByteArrayInputStream
has comment: http://stackoverflow.com/comment/36897905

http://stackoverflow.com/comment/36638059
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813034
has text: well, that is one of my questions... I edited, please take a look. @algui91
score: 0

http://stackoverflow.com/a/23937334
has comment: http://stackoverflow.com/comment/36894210
has comment: http://stackoverflow.com/comment/36897680
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36898835
answers question: http://stackoverflow.com/q/23931718
has comment: http://stackoverflow.com/comment/36944480
type: Answer
has comment: http://stackoverflow.com/comment/36897839
has comment: http://stackoverflow.com/comment/36871584
has body: Artifactory is an artifact repository manager. This means it's a store for artifacts. It's not a Continuous Deployment tool. You should consider a DevOp tool or write your own scripts that will deploy it for you, it's not something that comes out of the box or that you should be expecting from a repository manager.
score: -1

http://stackoverflow.com/comment/36871452
type: Comment
comment on: http://stackoverflow.com/a/23938427
has text: u2 is a an unsigned 2 byte integer, I just updated the answer. The benefit is that it tasks less space in the class file.
score: 1
type: AnswerComment

weka
tags question: http://stackoverflow.com/q/23883014
tags question: http://stackoverflow.com/q/23877776
tags question: http://stackoverflow.com/q/23795738
tags question: http://stackoverflow.com/q/23872807
tags question: http://stackoverflow.com/q/23815084
tag name: weka
tags question: http://stackoverflow.com/q/23882079
type: Tag

http://stackoverflow.com/q/23859934
tagged with: date
has comment: http://stackoverflow.com/comment/36723415
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36723336
type: UnansweredQuestion
tagged with: android
tagged with: parse-error
has answer: http://stackoverflow.com/a/23860149
tagged with: java
has title: ParseExcepion when trying to parse a string to a date in android
has body: i don't know what i'm doing bad. This is the exception that throws: java.text.ParseException: Unparseable date: "Fri Jun 14 13:25:40 ART 2013" (at offset 20) And this is my code to parse the above string date to a object date: public static Date getDateParseFromString(String sDate){ DateFormat dateFormat = new SimpleDateFormat(PARSE_DATE_PATTERN, Locale.getDefault()); dateFormat.setTimeZone(TimeZone.getDefault()); Date d = null; try { d = dateFormat.parse(sDate); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return d; } The pattern is: private static final String PARSE_DATE_PATTERN = "EEE MMM d HH:mm:ss z yyyy"; I see a lots of the issues related to this, but i can not found the problem with this, can help to me? Thanks in advance. Regards!
has comment: http://stackoverflow.com/comment/36723184
type: Question
has comment: http://stackoverflow.com/comment/36723390

http://stackoverflow.com/a/24003053
has body: After some battling and researching (guessing), I came across this class via some Adobe Font Metrics googling. Incidentally I can't remember exactly where I found it, but it solved my issue. I'll spare the SO servers and not post the 1000(+)-line code, but here it is as a gist if anyone has the same problem. I just included it in my project source file as a separate class, and voila... I'm still not sure why my project wouldn't run without this. It worked on other systems, but not my Eclipse Kepler (Mac OS 10.9). If anyone can tell me exactly why it kept failing, I'd be very thankful.
type: Answer
accepted answer of: http://stackoverflow.com/q/23819553
answers question: http://stackoverflow.com/q/23819553
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/49672210
type: Answer
has body: In a background tread (such as in doInBackGround()) no UI elements can be changed at all. If in activity use runOnUiThread or else use textTargetUri.post. This way the setText part takes place on the UI thread as needed.
score: 0
answers question: http://stackoverflow.com/q/23834521

http://stackoverflow.com/comment/36686834
has text: @immy server configuration seems to be correct.You can check server error log to diagnose the problem.
comment on: http://stackoverflow.com/a/23835742
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36773809
has text: What is the error/exception/desired behavior?
score: 0
comment on: http://stackoverflow.com/q/23886986
type: Comment
type: QuestionComment

run-configuration
type: Tag
tag name: run-configuration
tags question: http://stackoverflow.com/q/23838290

http://stackoverflow.com/a/24406259
accepted answer of: http://stackoverflow.com/q/23803211
answers question: http://stackoverflow.com/q/23803211
has body: After searching for solutions I found that the simplest way to do this was to make my Custom view/Listener/Events and override the methods to detect the behaviours I need.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/23902161
answer count: 1
downvote count: 0
favorite count: 0
has title: Custom look and feel JPogressBar & JSplitPane xml using synth
has answer: http://stackoverflow.com/a/23962534
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23962534
has body: I am trying to make a custom look and feel for my program using an xml file using synth, and it is working well, but I'm not sure how customize the JProgressBar or the JSplitPane. I got a border on the JProgressBar with no issues, but I can't find how to customize the loading animation. The loading bar is set to indeterminate by the way. And as far as the SplitPane the only thing I struggle to get working is the split pane drag divider. The split pane works fine in the program, just when you drag it the division line doesn't show up. Here is my current xml file. Thanks for the help. <?xml version="1.0" encoding="utf-8"?> <synth> <bind style="backingStyle" type="region" key=".*" /> <bind style="frameStyle" type="region" key="Frame" /> <bind style="intputFieldStyle" type="region" key="TextField" /> <bind style="labelStyle" type="region" key="Label" /> <bind style="loadingBarStyle" type="region" key="ProgressBar" /> <bind style="buttonStyle" type="region" key="Button" /> <bind style="userListStyle" type="region" key="List" /> <bind style="panelStyle" type="region" key="Panel" /> <bind style="splitPaneStyle" type="region" key="SplitPane" />
type: Question
tagged with: synth

http://stackoverflow.com/q/23843125
has comment: http://stackoverflow.com/comment/36690252
favorite count: 0
linked to: http://stackoverflow.com/q/240546
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36690272
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23843276
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36690371
has body: I have an XML file, and i want to get the text from one tag, but if that text contain another tag to ignore it. For example : <?xml version="1.0"?> Hello world. Today is Saturday. the output should be : "Hello world. Today is Saturday. What is the best method to do this?
has title: Parse XML in Java and ignore a tag
linked to: http://stackoverflow.com/q/1732348
has answer: http://stackoverflow.com/a/23843219
answer count: 2
tagged with: xml-parsing
downvote count: 0
duplicate of: http://stackoverflow.com/q/240546

http://stackoverflow.com/comment/36859373
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23931884
has text: @Sanjeev yes I know. You can change that by removing +1 from numberOfStudents and in loop for setting i=0 and i<numberOfStudents.
type: AnswerComment

http://stackoverflow.com/comment/36788672
type: Comment
comment on: http://stackoverflow.com/a/23876113
type: AnswerComment
score: 0
has text: I was missing a parenthetical. Change the return statement to return String.format("%" + (Hex.length*4) + "s", toReturn).replace(' ', '0')

http://stackoverflow.com/a/23860596
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23860527
answers question: http://stackoverflow.com/q/23860527
has body: General approach: catch the narrowest exception class possible if the catch block is handling the problem if the caller is to handle the problem, declare throws. You may catch (still narrowest possible) and throw a domain specific exception instead if you can't handle the problem, but there is "no caller" because your code is the top layer in the call stack, catch Exception because your code is the last chance to take action
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6

http://stackoverflow.com/q/23797479
type: Question
has comment: http://stackoverflow.com/comment/36650667
tagged with: database
has comment: http://stackoverflow.com/comment/36604212
has title: Spring Auto-Reconnect Database after Database Connection Loss
has body: How do you auto-reconnect to Oracle when database connection is lost when using BasicDataSource? A possible scenario is a server being bounced every night a midnight. <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/>
downvote count: 0
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3888776
tagged with: jdbc
tagged with: spring
score: 2
tagged with: spring-jdbc
has comment: http://stackoverflow.com/comment/36609223
tagged with: java
has comment: http://stackoverflow.com/comment/36640391

http://stackoverflow.com/q/23821792
has comment: http://stackoverflow.com/comment/36649702
upvote count: 3
tagged with: java
duplicate of: http://stackoverflow.com/q/2806360
has answer: http://stackoverflow.com/a/23822003
has answer: http://stackoverflow.com/a/36946735
has body: I want to create a Date object without a TimeZone (eg : 2007-06-21). Is this possible? When I use the following method it prints like Thu Jun 21 00:00:00 GMT 2007 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); TimeZone timeZone = TimeZone.getTimeZone("GMT"); timeZone.setDefault(timeZone); sdf.setTimeZone(timeZone); Date pickUpDate = sdf.parse("2007-06-21"); System.out.println(pickUpDate);
type: Question
score: 3
tagged with: simpledateformat
has answer: http://stackoverflow.com/a/23821849
tagged with: date
has comment: http://stackoverflow.com/comment/36650523
has answer: http://stackoverflow.com/a/23822042
has comment: http://stackoverflow.com/comment/61456951
has answer: http://stackoverflow.com/a/23821870
has answer: http://stackoverflow.com/a/23823177
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/23821970
favorite count: 0
tagged with: timezone
linked to: http://stackoverflow.com/q/5050170
type: UnansweredQuestion
has title: How do I create the java date object without time stamp
linked to: http://stackoverflow.com/q/2806360
linked to: http://stackoverflow.com/q/4772425

http://stackoverflow.com/comment/36771764
type: Comment
has text: Yea i know, but how does it then react to collisions?
comment on: http://stackoverflow.com/a/23885497
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36654285
type: QuestionComment
has text: Check out AlarmManager... it's better for timing stuff, especially for those long intervals like days.... plus it keeps working when your app is destroyed, which your solution doesn't...
score: 1
comment on: http://stackoverflow.com/q/23824130
type: Comment

gwt-syncproxy
tag name: gwt-syncproxy
tags question: http://stackoverflow.com/q/23890414
type: Tag

http://stackoverflow.com/comment/36791387
type: QuestionComment
comment on: http://stackoverflow.com/q/23875922
score: 0
has text: @PramodPP Thank you. I read the pages you suggested but it seems a little complicated, there is an easier way?
type: Comment

http://stackoverflow.com/comment/36923520
type: Comment
comment on: http://stackoverflow.com/a/23935473
has text: @DavidHarkness Nope, at runtime a `List<SomeObject>` becomes `List<Object>`. The only way to determine the type of the objects in the list would be to read the elements and attempt the cast. All of this is redundant though because the compiler will enforce this. The only reason you'd need this is if you're messing with reflective calls, etc.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23845900
score: 0
has comment: http://stackoverflow.com/comment/36696675
has comment: http://stackoverflow.com/comment/36698204
has comment: http://stackoverflow.com/comment/36698481
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36711946
tagged with: tomcat7
tagged with: spring
tagged with: dependency-injection
has body: I set up a custom spring scope in a web application. The scope handles creation, map-based storage and distribution of datasource-based NamedParameterJdbcTemplate objects. I have a baffling problem with this setup: it works fine on one computer, and not on the other. Both have Tomcat 7.0.52, one has Oracle Java, the other OpenJDK. One is Mac, the other Linux. The relevant setup in applicationContext.xml: <aop:scoped-proxy/> <constructor-arg ref="engineDataSource" /> <aop:scoped-proxy/> The DataSourceScope code is (excerpted to the bare essentials): public class DataSourceScope implements Scope { private volatile Map<String, DataSource> datasources = new HashMap<String, DataSource>(); private volatile Map<String, NamedParameterJdbcTemplate> templates = new HashMap<String, NamedParameterJdbcTemplate>(); private volatile Map<String, ConfigService> services = new HashMap<String, ConfigService>(); public void setDatasources(Map<String, DataSource> sources) { Map<String, ConfigService> services = new HashMap<String, ConfigService>(); for (Entry<String, DataSource> entry : sources.entrySet()) { datasources.put(entry.getKey(), entry.getValue()); NamedParameterJdbcTemplate t = new NamedParameterJdbcTemplate(entry.getValue()); templates.put(entry.getKey(),t); services.put(entry.getKey(), new ConfigService(t)); } this.services = services; } @Override public Object get(String name, @SuppressWarnings("rawtypes") ObjectFactory objectFactory) { if (name.indexOf("configService") > -1) { return this.services.get(databaseName); } else if (name.indexOf("engineDatabase") > -1) { return this.templates.get(databaseName); } else if (name.indexOf("engineDataSource") > -1){ return this.datasources.get(databaseName); } else { throw new NoSuchBeanDefinitionException("DataSourceScope is not configured to wire beans with name " + name); } } The problem is that in those places where I wire 'engineDatabase', the object remains null. No warnings or exceptions with org.springframework logging at de…
tagged with: java
type: Question
has title: @Autowired dependency with custom scope remains null

http://stackoverflow.com/comment/36654747
type: QuestionComment
comment on: http://stackoverflow.com/q/23823794
score: 0
has text: Can I see your example with AbstractTableModel?
type: Comment

http://stackoverflow.com/q/23823252
has comment: http://stackoverflow.com/comment/44796076
downvote count: 0
favorite count: 0
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/47457009
has comment: http://stackoverflow.com/comment/47540128
has body: Is there any request size limit when sending through socket (using HttpClient) in Google Appengine? I am getting following exception when sending more than 1MB of data in GAE. "The request to API call remote_socket.Send() was too large." Our App Engine is Billed one. I am sure that our data doesn't exceed any limit like 113MB per minute in Quotas I searched in Google but couldn't find any solution. Is there any other limit I need to know? Please help me. Thanks
score: 2
answer count: 0
upvote count: 2
type: Question
tagged with: java
has title: Request size limit when sending through HttpClient in Google Appengine?

http://stackoverflow.com/comment/36711772
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23853974
has text: `timer.scheduleAtFixedRate(task, 0, 1000)` gives me an error. it says cannot find symbol

http://stackoverflow.com/q/23932568
type: Question
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/23932668
tagged with: el
score: 0
has body: I'm trying to run JSF on Google AppEngine, it was running smoothly till I need to use some expression languages in the XHTML page. I tried a lot of different configurations. Locally on AppEngine SDK server it works perfectly, but in production the page does not open. Anyone has a project with this environment and characteristics? What is the right maven dependencies to run EL expressions? Appegine target version: 1.9.4 org.apache.myfaces.core myfaces-api 2.2.2 org.apache.myfaces.core myfaces-impl 2.2.2 javax.el el-api 1.1
answer count: 1
tagged with: jsf
tagged with: java
has title: JSF 2 in Appengine - EL Expressions
has answer: http://stackoverflow.com/a/23932668
type: AnsweredQuestion

http://stackoverflow.com/comment/36810263
has text: @Jorge_B: I will ask the sysadmins if it is possible to install another version, but I don't expect that to happen soon. Also, I don't see a comment by an Emilio suggesting anything through jconsole?
comment on: http://stackoverflow.com/q/23860364
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23913348
has comment: http://stackoverflow.com/comment/36824857
downvote count: 0
has comment: http://stackoverflow.com/comment/36890714
has body: Maybe you don't need CreateObject.. This is how I do it: Dim jSession As New JavaSession() Dim jClass As JavaClass() Set jClass = jSession.GetClass("MyClass") If jClass.myMethod(doc) Then Full example added Java class: import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; public class GetFileFromUrl { public static boolean getFileFromUrl(String imageUrl, String filePath) { try { URL url = new URL(imageUrl); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(filePath); byte[] b = new byte[2048]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close(); return true; } catch (Exception e) { e.printStackTrace(); return false; } } } LotusScript: UseLSX "*javacon" Use "GetFileFromUrl" Private Function GetFileFromUrl(url As String, outputPath As String) As Boolean Dim jSession As New JavaSession Dim jClass As JavaClass Set jClass = jSession.GetClass("GetFileFromUrl") If jClass.getFileFromUrl(url, outputPath) Then GetFileFromUrl = True End If End Function
type: Answer
has comment: http://stackoverflow.com/comment/36868263
score: 1
answers question: http://stackoverflow.com/q/23912808
upvote count: 1

http://stackoverflow.com/a/23928325
score: 3
has body: LinkedList is a Deque. Deque API defines methods which exist in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation).
downvote count: 0
upvote count: 3
answers question: http://stackoverflow.com/q/23927887
type: Answer

http://stackoverflow.com/q/23919485
linked to: http://stackoverflow.com/q/194349
tagged with: classpath
type: Question
has body: To load a properties file from classpath, we can simply do: InputStream inputStream = CommonUtils.class.getClassLoader().getResourceAsStream("com/abc/resources/config.properties"); prop.load(inputStream); After above step, all properties are correctly loaded. But how can I change a property and save it back to the same file on the fly? (Below doesn't work) OutputStream outputStream = new FileOutputStream("com/abc/resources/config.properties"); prop.setProperty(key, value); prop.store(outputStream, null);
has comment: http://stackoverflow.com/comment/36836333
tagged with: java
tagged with: properties-file
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36836680
has answer: http://stackoverflow.com/a/23919780
favorite count: 0
has title: How to save Java properties file to classpath?
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36836356
type: UnansweredQuestion

http://stackoverflow.com/comment/36908610
comment on: http://stackoverflow.com/a/23936111
score: 0
type: AnswerComment
has text: @niharika_neo I removed `static` `WebDriver` initialization and `static` modifier of `getBrowser()` , but still am not able to run it in parallel because only one object gets the elements.
type: Comment

http://stackoverflow.com/q/23798211
accepted answer: http://stackoverflow.com/a/23798292
has comment: http://stackoverflow.com/comment/36604935
has body: This is my demo.jsp page. &lt;% String[] stringArray = {"google", "char", "char2", "0", "12", "zoombi", "integer"}; String[] resutlArray; for (int i = 0; i &lt; stringArray.length; i++) { if (stringArray[i].length() &gt; stringArray[i + 1].length()) { } } %&gt; Required output:0 12 char char2 zoombi google integer How can i print like this?
downvote count: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23826257
upvote count: 1
has answer: http://stackoverflow.com/a/23826257
type: Question
has answer: http://stackoverflow.com/a/23798292
has title: Sort the string elements based on lenght without java predefined functions?
score: -1
has comment: http://stackoverflow.com/comment/36604916
answer count: 2
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/36817246
type: Comment
has text: Well i know that isn't the problem because even when I try to run it o a physical device using an AppInstaller it doesn't open at all. I'm sure it's the code :/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23891025

http://stackoverflow.com/q/23835889
has comment: http://stackoverflow.com/comment/36676743
has comment: http://stackoverflow.com/comment/36677114
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36676567
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36676517
answer count: 0
has title: Handling NullPointerException in Lists
type: Question
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/36676456
has body: I have a program where I have to code to get the mode in an array.I have that solved here.I wanted to make the program behave better by dealing with any "null" values without returning any text on the console in "red". Is there a message I can display? I have done the following but it wont work. Thanks in advance public static List&lt;Integer&gt; getMode(int[] values) throws NullPointerException,NoSuchElementException { if(values == null) throw new NullPointerException("The argument cannot be null"); HashMap&lt;Integer,Integer&gt; freqs = new HashMap&lt;Integer,Integer&gt;(); for (int val : values) { Integer freq = freqs.get(val); freqs.put(val, (freq == null ? 1 : freq+1)); } int mode = 0; int maxFreq = 0; for (Map.Entry&lt;Integer,Integer&gt; entry : freqs.entrySet()) { int freq = entry.getValue(); if (freq &gt; maxFreq) { maxFreq = freq; mode = entry.getKey(); } } List&lt;Integer&gt; modes = new LinkedList&lt;Integer&gt;(); for (Map.Entry&lt;Integer,Integer&gt; entry : freqs.entrySet()) { int freq = entry.getValue(); if (freq == maxFreq) { modes.add(entry.getKey()); } } return modes; }
has comment: http://stackoverflow.com/comment/36676623

http://stackoverflow.com/a/23936323
has body: You can use a BufferedReader to read the file. BufferedReader in = new BufferedReader(new FileReader("test.txt")); // Or you can use // File myFile = getFile(); // BufferedReader in = new BufferedReader(new FileReader(myFile)); String line; while ((line = in.readLine()) != null) { // Add the line to the table. } I can't help you with the second part very much because it's really vague, but I'll make some assumptions and give you some pointers. Assuming your file has elements seperated by commas, you can parse it pretty easily: String[] columns = line.split(","); And then you can add the columns to your table.
type: Answer
answers question: http://stackoverflow.com/q/23936165
score: 0

http://stackoverflow.com/q/23822422
has body: I read that the major difference between Class and Abstract Class is , abstract class cannot be instantiated, but i can create object for abstract class public abstract class Earth { abstract void sand(); void land() { } } and using new key word i created the object, for the abstract Earth mEarth = new Earth() { @Override void sand() { } }; I had some questions on it which have not proper answer on Inet, 1) is new keyword is used to instance the class ? 2) is instance is nothing but object ? 3) is mEarth is called object (instance of Earth) ? now i can call any method (as callback or as value return) mEarth.sand(); mEarth.land(); using earth object
downvote count: 0
has comment: http://stackoverflow.com/comment/36651058
linked to: http://stackoverflow.com/q/14457076
has title: Why can abstract class be instantiated like this?
possible better answer: http://stackoverflow.com/a/23822468
has answer: http://stackoverflow.com/a/23822468
tagged with: object
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23822540
accepted answer: http://stackoverflow.com/a/23822540
tagged with: oop
has comment: http://stackoverflow.com/comment/36650906
tagged with: java
has comment: http://stackoverflow.com/comment/36651075
type: Question
has answer: http://stackoverflow.com/a/23822579
has comment: http://stackoverflow.com/comment/36651055
linked to: http://stackoverflow.com/q/22164036
has answer: http://stackoverflow.com/a/23822562
favorite count: 0
upvote count: 3
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/36650988
has comment: http://stackoverflow.com/comment/36651698
answer count: 4
linked to: http://stackoverflow.com/q/13670991

http://stackoverflow.com/q/23837704
type: UnansweredQuestion
has title: Getting an image to show up in Java
tagged with: swing
tagged with: javax.imageio
tagged with: java
has comment: http://stackoverflow.com/comment/36685747
has body: I am trying to display a background image in a JFrame, but the image isn't showing up and I can't find what the error in the code is. public class GraphicsComponent extends JComponent { int xPosition = 200;//initializes and declares the x coordinate int yPosition = 400;//initializes and declares the y coordinate Image i; public GraphicsComponent() { try{ File sky = new File("lib/background.png"); i = ImageIO.read(sky); } catch (Exception e) { e.printStackTrace(); } } public void paintComponent(Graphics g) //overrides paintComponent method in JComponent { if (i == null) return; g.drawImage(i, 0, 0, this); }
tagged with: image
type: Question
tagged with: graphics
answer count: 1
has answer: http://stackoverflow.com/a/23837767
score: 0
has comment: http://stackoverflow.com/comment/36680510
has comment: http://stackoverflow.com/comment/36680169
has comment: http://stackoverflow.com/comment/36683465

http://stackoverflow.com/q/23867836
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/60509867
has answer: http://stackoverflow.com/a/23868077
has title: CodingBat : LoneSum optimization
tagged with: boolean-logic
accepted answer: http://stackoverflow.com/a/23868215
possible better answer: http://stackoverflow.com/a/23868077
has answer: http://stackoverflow.com/a/62568275
has answer: http://stackoverflow.com/a/56245881
favorite count: 0
has answer: http://stackoverflow.com/a/62080176
has answer: http://stackoverflow.com/a/23868215
answer count: 12
has answer: http://stackoverflow.com/a/25373470
has answer: http://stackoverflow.com/a/26647443
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/57527006
has answer: http://stackoverflow.com/a/57977421
has body: I have completed this exercise on codingbat successfully, but I want to know is there a better/faster or more elegant solution? Given 3 int values, a b c, returns their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. loneSum(1, 2, 3) → 6 loneSum(3, 2, 3) → 2 loneSum(3, 3, 3) → 0 public int loneSum(int a, int b, int c) { int sum = a + b + c; if ( a == b) { sum = sum - a - b; } if ( a == c) { sum = sum - a - c; } if( b == c) { sum = sum - b - c; } if (( a == b ) &amp;&amp; (b==c)) { sum = 0; } return sum; }
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/62973328
has answer: http://stackoverflow.com/a/55944757

http://stackoverflow.com/q/23879227
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/36759370
has answer: http://stackoverflow.com/a/23879728
type: Question
has comment: http://stackoverflow.com/comment/36759648
answer count: 2
has comment: http://stackoverflow.com/comment/36759358
has comment: http://stackoverflow.com/comment/36759678
has body: I'm new to Java, I am trying to add a group of elements into a linked list, my interface contains add single, pair, triple. Here is what I have so far for the methods. list is a linked list declared in constructor public void addSingle(E item) { list.add(item); } public void addPair(E first, E second) { E one = first; E two = second; LinkedList&lt;E&gt; pairList; pairList = new LinkedList&lt;E&gt;(); pairList.add(one); pairList.add(two); list.addAll(pairList); } public static void main(String[] args) { Lists&lt;String&gt; linkdList = new ConcreteList&lt;String&gt;(); linkdList.addSingle("allan"); linkdList.addPair("abc","def"); } this adds everything into linkdList but need it to be able to differentiate between single and pair.
has title: Java: Inserting a pair of elements into linked list
has comment: http://stackoverflow.com/comment/36759919
score: 0
tagged with: interface
has answer: http://stackoverflow.com/a/23879323
accepted answer: http://stackoverflow.com/a/23879728
tagged with: generics
tagged with: linked-list
possible better answer: http://stackoverflow.com/a/23879323
has comment: http://stackoverflow.com/comment/36759331
type: AnsweredQuestion

http://stackoverflow.com/q/23825698
score: -3
has comment: http://stackoverflow.com/comment/36656997
has answer: http://stackoverflow.com/a/23840224
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36656907
has body: can any one help me how to reverse every alternate element and append it to end of list for example I/P: a-1-b-2-c-3(Linked list) O/P should be: a-b-c-1-3-2 Logic should reverse every alternate element and append it to end of list.
has comment: http://stackoverflow.com/comment/36656931
has title: can any one help me how to reverse every alternate element and append it to end of list
answer count: 1
favorite count: 0
downvote count: 3
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36786399
has text: @AmitJoki I mean, if my strings also has `//@Table(name = "T_MEM_MEMBER_ADDRESS")` with // comments, I don't want my regexPattern matches this string
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23889762

http://stackoverflow.com/q/23843726
has answer: http://stackoverflow.com/a/23843759
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23843762
has answer: http://stackoverflow.com/a/23843742
favorite count: 0
tagged with: android
has body: I know it's a pretty amateur question , but i am really getting frustrated: I am not getting an error but its just not working.(Ignore the bundle part)package com.example.project1;import android.app.Activity; here's the java file package com.example.project1; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Tictactoe2 extends Activity implements OnClickListener{ EditText et1 , et2; String str1 , str2; Button b1; TextView tv2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.ttt); et1 = (EditText) findViewById (R.id.et1); et2 = (EditText) findViewById (R.id.et2); tv2 = (TextView) findViewById (R.id.tv2); str1 = et1.getText().toString(); str2 = et2.getText().toString(); b1 = (Button) findViewById (R.id.b1); b1.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.b1: tv2.setText(str1); /*Bundle bun = new Bundle(); bun.putString("key", str1); bun.putString("key1", str2);; Intent intent = new Intent(tictactoe2.this , tictactoe.class); intent.putExtras(bun); startActivity(intent);*/ break; }} }
has title: Code not working(android)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36691342
downvote count: 1
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36691366
tagged with: eclipse

http://stackoverflow.com/a/23798833
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36608738
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23798778
has comment: http://stackoverflow.com/comment/36606798
answers question: http://stackoverflow.com/q/23798778
type: Answer
has comment: http://stackoverflow.com/comment/36609090
score: 1
has comment: http://stackoverflow.com/comment/36607510
has comment: http://stackoverflow.com/comment/36609066
upvote count: 1
has comment: http://stackoverflow.com/comment/36608939
has comment: http://stackoverflow.com/comment/36606822
has comment: http://stackoverflow.com/comment/36608682
has comment: http://stackoverflow.com/comment/36607936
has body: You've provided no sizing hints for the scroll pane to determine how big the component should be and thereby determine if it needs to be scrolled. Start by overriding MyPannel's getPreferredSize method and return a value which best represents the size you would like the component to be. This is best calculated ahead of time if possible
has comment: http://stackoverflow.com/comment/36607955

http://stackoverflow.com/comment/36702361
has text: @BrianGoetz side question... When will we have JCIP v2? ;)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23848384

http://stackoverflow.com/a/23960872
has body: Issue was in weblogic and NOT configuration. Solution: The only solution I have found to resolve the issue is to add: &lt;enforce-valid-basic-auth-credentials&gt;false&lt;/enforce-valid-basic-auth-credentials&gt; into the config.xml file: &lt;security-configuration&gt; ... &lt;enforce-valid-basic-auth-credentials&gt;false&lt;/enforce-valid-basic-auth-credentials&gt; &lt;/security-configuration&gt; This configuration will resolve the issue. References Spring Security HTTP Basic Authentication http://yplakosh.blogspot.com/2009/05/how-to-fix-basic-authentication-issue.html
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23914783
score: 3
accepted answer of: http://stackoverflow.com/q/23914783
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23826859
has comment: http://stackoverflow.com/comment/36732427
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23823618
answers question: http://stackoverflow.com/q/23823618
has body: No it's impossible. Your class Document is a domain class (java presentation of your table in db). When you try to create table from domain class so will be created a table with such fields like in your domain class.
has comment: http://stackoverflow.com/comment/36726947
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/23927192
type: Question
has body: I'm writing an application which has a method that will download a text file from my server. This text file will contain ~1,000 proxy IP's. The download will happen every 10 minutes. I need to find the most efficient way of doing this. Currently I have a method in a class called Connection which will return the bytes of whatever I want to retrieve. So if I make a connection to the server for the text file using such method, I will get it returned in bytes. My other method will create a very long string from these bytes. After, I split the long string into an array using System.LineSeparator. Here is the code: public static void fetchProxies(String url) { Connection c = new Connection(); List&lt;Proxy&gt; tempProxy = new ArrayList&lt;Proxy&gt;(); ByteArrayOutputStream baos = c.requestBytes(url); String line = new String(baos.toByteArray()); String[] split = line.split(System.lineSeparator()); //more code to come but the above works fine. } This currently works but I know that it isn't the most efficient way. I My Problem Instead of turning the bytes into a very long string, what is the most efficient way of turning the bytes into my IP's so I can add each individual IP into an arraylist and then return the arraylist full of IP's?
answer count: 2
has comment: http://stackoverflow.com/comment/36850668
tagged with: bytearrayoutputstream
accepted answer: http://stackoverflow.com/a/23927438
score: 0
has title: ByteArrayOutputStream to String Array
tagged with: string
possible better answer: http://stackoverflow.com/a/23927570
has answer: http://stackoverflow.com/a/23927570
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23927438
tagged with: java

http://stackoverflow.com/comment/36594881
comment on: http://stackoverflow.com/q/23791080
score: 0
type: Comment
type: QuestionComment
has text: The "custom adapter" solution is the correct one. What do you mean by "it didn't work"?

http://stackoverflow.com/q/23851535
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23851611
tagged with: jpanel
has title: What Swing component(s) should I use to display a list of songs and song attributes?
type: Question
accepted answer: http://stackoverflow.com/a/23851600
upvote count: 2
tagged with: jtable
answer count: 3
has answer: http://stackoverflow.com/a/23851600
tagged with: jlist
has body: I am writing a music player that can play local mp3 files. I am trying to display a list of songs for the user to select and play from, but I am having trouble figuring out what Swing components to use. What I am trying to do display songs in a list in each horizontal row, a song entry is displayed in each column, an attribute of each song entry is displayed (track name, length, album, artist) above each column is a column header that displays that attribute when users click a song entry, it is highlighted sort entries by each column (track name, length, album, artist) by clicking on the header resizable column widths double click an entry to play it eventually, artist and album labels should be able to behave like hyperlinks Options I have considered JTable: can't highlight an entire row, cells are editable JList: lists are 1 "element" wide so columns and their headers would be hard to set up, not sure about putting a Swing component in the list element Lots of JPanels: putting together lots of JPanels to implement my own display would be very difficult and very messy I am open to other options I have not thought of and any misconceptions I have.
possible better answer: http://stackoverflow.com/a/23851611
favorite count: 0
has answer: http://stackoverflow.com/a/23855813
tagged with: swing

http://stackoverflow.com/comment/36694652
comment on: http://stackoverflow.com/a/23844554
score: 1
has text: Whether you use XML configuration or annotation to define a bean, generally you shouldn't create a bean instance/object manually. In your JSF, it would be same as how you did before; it wouldn't make a difference. You can either use '@ManagedProperty' or even '@Autowired' (try).
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23914666
has answer: http://stackoverflow.com/a/23918794
type: Question
has title: Why list is replacing the old object with new object
tagged with: java
tagged with: jaxb
has body: I am trying to read the object through xml using JAXB and updating some info the saving back. here is the read and update code- dbf = DocumentBuilderFactory.newInstance(); dbuilder = dbf.newDocumentBuilder(); document = dbuilder.parse(file); jc = JAXBContext.newInstance(OutletWisePlanningListContainer.class); Binder<Node> binder = jc.createBinder(); owpLContainer = (OutletWisePlanningListContainer) binder.unmarshal(document); owpLContList = owpLContainer.getOwpList(); then - updating the objects for (OutletWisePlanningList owpl1 : owpLContList) { owpl = owpl1.getOwpList(); owpList = new OutletWisePlanningList(); owpList = owpl1; skuList.add(owpl1.getSkuId()); for (i = 1; i < sku; i++) { if (owpl1.getSkuId().trim().equals(request.getParameter("skuId" + i).trim())) { owpl1.getSkuId(); ArrayList idList = new ArrayList(); int j = 1, cnt = 1; al1.clear(); int perf = Integer.parseInt(request.getParameter("hdnPerf" + i)); for (OutletWisePlanning owps : owpl) { owp = new OutletWisePlanning(); for (j = 1; j < perf; j++) { //used only when Planned outlets is changed if (owp.getMarketIntId().trim().equals(request.getParameter("UID" + i + '-' + j).trim()) && !request.getParameter("txtTARGET_SETvolume" + i + '-' + j).trim().equals("0")) { //some updation in owp object al1.add(owp); } } if (request.getParameter("selPlanUnplanned").equals("0")) { //used when Unplanned in selected al1.add(owp); } } owpList.setOwpList(al1); owpList.setSkuId(owpl1.getSkuId()); } } owpList1.add(owpList); Iterator itr = owpList1.iterator(); while (itr.hasNext()) { OutletWisePlanningList op1 = (OutletWisePlanningList) itr.next(); for (OutletWisePlanning op2 : op1.getOwpList()) { System.out.println("Party id in the owpList1" + op2.getPartyId()); } } } al.addAll(owpList1); And the xml from where i am reading data and updating the same- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OutletWisePlanningListContainer> <OutletWisePlanningList skuId="4214"> 14002 818 Aangan (Indian North) Bhikaji Cama…
upvote count: 0
answer count: 1
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/36826819
downvote count: 3

http://stackoverflow.com/q/23900351
tagged with: buttonclick
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23900449
type: Question
has title: Enter a string and add to a list every time a button is clicked, while displaying all strings entered
tagged with: arraylist
tagged with: arrays
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23900449
favorite count: 0
has body: I am trying to create a Java program where you enter a word into a textfield, and click a button and the string is added to an output box. I got that part, but I am trying to make it so that every time the button is clicked, a word gets added, and then all the words are listed in the output box. I tried using Arrays and Arraylists with loops, but no success. Any help is appreciated. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.ArrayList; import java.util.Arrays; public class test extends JFrame { private JLabel label; private JButton button; private JTextField textfield; private JTextArea result; // private String [] words; private ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); // Contructor public test() { setLayout(new FlowLayout()); label = new JLabel("Word:"); add(label); textfield = new JTextField(15); add(textfield); button = new JButton("Add data to list"); add(button); result = new JTextArea(10, 15); add(result); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { result.setText(textfield.getText()); // int n = list.size(); // for(int i = 0; i &lt; n ; i++) // result.setText(list.get(i)); } }); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub // System.out.println("Hello"); test gui = new test(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); gui.setSize(200, 325); gui.setTitle("Title"); } }

http://stackoverflow.com/q/23886851
has body: I installed java in my system around 6 months. I blindly followed this document's instruction here. I downloaded the jdk, unpacked it, set the paths Java_Home, Path according to the instructions in the doc. Today I wanted to find out, which java is installed in my system and where. So, I looked it up online and ran this command readlink -f $(which java) It says /usr/local/java/jre1.7.0_40/bin/java But when I check Java_Home variable, it says /usr/lib/jvm/jdk1.7.0_40 Here both paths refer to jdk 1.7, but they are different. One is in /usr/lib/jvm and other is in /user/local/java. I think, due to some confusion, I set the java_home incorrectly. I must have unpakced jdk at couple of places. And, while setting up the java_home, I took incorrect path. Either that, or it is some linkage between two locations, which occurred due to some command I ran which I don't know of. Anyway, I can run java programs correctly and run eclipse etc, so everything is fine and because of that I never noticed that. But, I would like to know whether I need to fix the java_home variable to ensure that both of above commands return the same value. And, if it is not necessary, why is this set up working fine when 'readlink -f $(which java)' and java_home return different path.
answer count: 3
tagged with: environment-variables
has answer: http://stackoverflow.com/a/23887190
downvote count: 0
tagged with: unix
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23887034
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23887019
has title: Expanation for the inconsitency regarding java installtion paths in unix?
type: Question

http://stackoverflow.com/q/23885589
has comment: http://stackoverflow.com/comment/36771440
accepted answer: http://stackoverflow.com/a/23885895
has title: Matcher on multiple properties simultaneously on a Collection
tagged with: hamcrest
upvote count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/23885895
favorite count: 0
linked to: http://stackoverflow.com/q/587404
type: AnsweredQuestion
score: 1
tagged with: java
has body: Is possible to test multiple condition on each Matched item in a Collection? I have a collection with given objects: obj1: property1=A1, property2=B1 obj2: property1=A2, property2=B2 obj3: property1=A3, property2=B3 obj4: property1=A4, property2=B4 I want to check that property1 and property2 have simultaneously specified values. Thank you for any advice.
has comment: http://stackoverflow.com/comment/36771482
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23889948
has comment: http://stackoverflow.com/comment/36779471
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/36779681
has answer: http://stackoverflow.com/a/23890194
has body: // \u represent unicode sequence char c = '\u0045'; System.out.println(c); Code is only this much and eclipse is showing following error message "Exception in thread "main" java.lang.Error: Unresolved compilation problem: Invalid unicode Now when I remove \u from comment it is working fine, what is the problem with \u in comment? IS this a bug or there is some relation, as far as think Java should leave the comments as it is.
score: 8
possible better answer: http://stackoverflow.com/a/23890194
accepted answer: http://stackoverflow.com/a/23890126
type: AnsweredQuestion
downvote count: 0
tagged with: unicode
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/36779763
type: Question
linked to: http://stackoverflow.com/q/10363188
has comment: http://stackoverflow.com/comment/36779739
has answer: http://stackoverflow.com/a/23890126
has title: \u in Java comment is leading to error message, why?
has comment: http://stackoverflow.com/comment/36779563

http://stackoverflow.com/q/23789811
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-dateutils
has comment: http://stackoverflow.com/comment/36589444
has comment: http://stackoverflow.com/comment/36588991
answer count: 0
upvote count: 3
type: UnansweredQuestion
has title: DateUtils getRelativeTimeSpanString isn't returning time in "X seconds ago"
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36589125
tagged with: java
has body: I am using the getRelativeTimeSpanString(...) to get time back in X seconds ago X hours ago etc. However, when the difference between the two times is short - minutes or seconds, then it is returning in 10 hours instead of X minutes ago Here is how I'm using it: Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH) .parse("2014-05-21 13:07:11"); Date currentDate = new Date(); CharSequence cs = DateUtils.getRelativeTimeSpanString(date.getTime(), currentDate.getTime(), DateUtils.SECOND_IN_MILLIS);

http://stackoverflow.com/comment/36798356
comment on: http://stackoverflow.com/a/23898233
type: Comment
has text: The question is why do I get the error not why is it builds and fails at runtime. However, I will add something in just because you mentioned it.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23859907
upvote count: 1
has body: You're looking for commons-io, FileUtils is a class from apache's commons-io.jar http://commons.apache.org/proper/commons-io/
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23859876
answers question: http://stackoverflow.com/q/23859876

http://stackoverflow.com/a/23823927
type: Answer
has body: The problem here might be that you declare the id as a primitive instead of a wrapper. So instead of: private int id; You should have: private Integer id; When you create the entity with the id is initialized as 0, instead of NULL. That's why you get duplicate id constraint violation exceptions. Only when the id is NULL the AUTO generation strategy will delegate the id assignment to the database.
answers question: http://stackoverflow.com/q/23818345
has comment: http://stackoverflow.com/comment/36659318
score: 0
has comment: http://stackoverflow.com/comment/36659899
has comment: http://stackoverflow.com/comment/36659969

http://stackoverflow.com/comment/36914015
comment on: http://stackoverflow.com/q/23929229
type: Comment
type: QuestionComment
has text: @user1708189: With `#myBeanStatus.first == true` you are not really iterating values. So maybe you can post a real code or explain what exactly are you trying to achieve.
score: 0

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/23798402
tags question: http://stackoverflow.com/q/23835814
tag name: httpsurlconnection

http://stackoverflow.com/q/23817747
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28498508
has title: Know what methods are in .jar files
has answer: http://stackoverflow.com/a/23817782
accepted answer: http://stackoverflow.com/a/23817948
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23817782
tagged with: imagej
score: 1
tagged with: java
tagged with: medical
answer count: 3
tagged with: jar
downvote count: 0
has body: I know that there is a plugin for ImageJ that handles NIfTI-1 files (http://rsb.info.nih.gov/ij/plugins/nifti.html). But all its instructions on that page is to use ImageJ as a standalone program, however I am using its API. How can I know what methods are available in this jar file without its source? I couldn't find the source code either. For the supported archives in imageJ (such as DICOM) is quite easy : public class ImageJTest { public static void main(){ String path = "res/vaca.dcm"; FileInputStream fis; ImageView image; try { fis = new FileInputStream(path); DICOM d = new DICOM(fis); d.run(path); // Stretches the histogram because the pictures were being // displayed too dark. (new ij.plugin.ContrastEnhancer()).stretchHistogram(d, 0.1); Image picture = SwingFXUtils.toFXImage(d.getBufferedImage(), null); // Makes the size standard for thumbnails image = new ImageView(picture); } catch (FileNotFoundException e) { e.printStackTrace(); } } } How can I load the NIfTI-1 files in imageJ ?
has answer: http://stackoverflow.com/a/23817948
favorite count: 0

http://stackoverflow.com/comment/36644881
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23819196
has text: Animation is also not a simple subject (fun, but not simple). The linked example in the above comment is about as simple as it gets for Swing
type: Comment

http://stackoverflow.com/a/23791235
answers question: http://stackoverflow.com/q/23790887
type: Answer
has body: Its not possible in singular regular expression. i) Logic needs to be implemented to get number of characters before underscores(regular expression should be written to get characters word before underscore). ii) And validate result (number of characters - 1) = number of semicolons followed(regular expression which returns stream of underscores followed by characters).
score: 0

http://stackoverflow.com/comment/36742339
type: Comment
has text: *`final URI uri = new URI("http://www.roseindia.net");`* That should throw a `CrappyCodeSiteException`..
type: QuestionComment
comment on: http://stackoverflow.com/q/23870110
score: 0

http://stackoverflow.com/comment/36737154
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23867539
has text: Can you not use a forEach in the jstl and iterate over the `hello.Values` property and render your jstl accordingly?
score: 0

http://stackoverflow.com/q/23918795
has answer: http://stackoverflow.com/a/23920722
accepted answer: http://stackoverflow.com/a/23920722
type: Question
has comment: http://stackoverflow.com/comment/36836518
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/36835634
favorite count: 0
has comment: http://stackoverflow.com/comment/36834834
has title: Split string with double quotes in java
has comment: http://stackoverflow.com/comment/36834852
upvote count: 2
has comment: http://stackoverflow.com/comment/36837209
downvote count: 1
type: AnsweredQuestion
has body: I have delimited file with records like. val1|"val2"|"val3|val4"|val5 I need to split the record so that if the field contains delimiter in between ,it should be quoted.Otherwise ,if field does not contain delimiter(|) ,quote should be omitted. Output should be like this: col1=val1 col2=val2 col3="val3|val4" col4=val5 I modified answer for similar question to arrive at code below. String testData = "val1|"val2"|"val3|val4"|val5"; char quote = '"'; List&lt;String&gt; csvList = new ArrayList&lt;String&gt;(); boolean inQuote = false; boolean delimInside = false; boolean isPrevQuoted = false; ; int lastStart = 0; for (int i = 0; i &lt; testData.length(); i++) { if ((i + 1) == testData.length()) { if (inQuote &amp;&amp; !delimInside) { csvList.add(testData.substring(lastStart + 1, i)); } else { csvList.add(testData.substring(lastStart, i + 1)); } } if (testData.charAt(i) == quote) { // if the character is quote if (inQuote) { inQuote = false; isPrevQuoted = true; continue; // escape } inQuote = true; continue; } if (testData.charAt(i) == '|') { if (inQuote) { delimInside = true; continue; } if (isPrevQuoted &amp;&amp; !delimInside) { csvList.add(testData.substring(lastStart + 1, i - 1)); } else { csvList.add(testData.substring(lastStart, i)); } delimInside = false; isPrevQuoted = false; lastStart = i + 1; } } I was looking for elegant solution for the same. Thanks in advance.
has comment: http://stackoverflow.com/comment/36837988
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36834801

http://stackoverflow.com/comment/36614609
type: QuestionComment
has text: You can use the `JTextArea(rows, columns)` constructor to set a preferred size for your text area. The list will take up the remaining space
score: 2
comment on: http://stackoverflow.com/q/23803297
type: Comment

http://stackoverflow.com/comment/36835767
has text: Yes of the BufferdInputStream. And no of (data). Reread what I wrote. OMG why did you change that variable name. Now data[] does not have to be filesize. A much smaller buffer would suffice. No need to read the whole file in memory.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23917796

http://stackoverflow.com/a/26919146
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/42877963
has comment: http://stackoverflow.com/comment/42811046
accepted answer of: http://stackoverflow.com/q/23916812
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42823587
answers question: http://stackoverflow.com/q/23916812
has body: It seems Epel now has openjdk 1.8.0_25. So this is no longer an issue. Install sudo yum install java-1.8.0-openjdk-devel if you need the jdk instead of the jre.
type: Answer

http://stackoverflow.com/q/23878251
tagged with: java
tagged with: servlets
type: Question
score: 0
has answer: http://stackoverflow.com/a/23878282
answer count: 2
tagged with: apache
tagged with: tomcat
has title: "Unable to determine the location of Tomcat" cmd message
tagged with: cmd
has answer: http://stackoverflow.com/a/23885103
has body: I'm working on a school project, about web apps with servlets, running on tomcat etc. This morning, without an apparent reason i try to start tomcat from C:\jakarta-tomcat-3.3.2\bin "startup" but the cmd opens up for a millisecond showing Unable to determine the location of Tomcat and closes again. I had set it up and it was working fine up until now!! I have tried to restore the system to a previous point, but it only got worse, the paths were gone and messed up. I googled the cmd message, but shockingly it did not spawned any relevant responses. Any ideas?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36757938

http://stackoverflow.com/comment/36792075
type: Comment
type: QuestionComment
has text: @Squonk - It does not. I think, I have to change something.
comment on: http://stackoverflow.com/q/23882552
score: 0

http://stackoverflow.com/q/23796496
has comment: http://stackoverflow.com/comment/36601882
tagged with: java
has comment: http://stackoverflow.com/comment/36601938
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36601893
has comment: http://stackoverflow.com/comment/36601903
has comment: http://stackoverflow.com/comment/36601860
upvote count: 0
has comment: http://stackoverflow.com/comment/36602246
has title: Unexpected output while comparing strings and printing remaining characters in java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36601875
has comment: http://stackoverflow.com/comment/36601878
has comment: http://stackoverflow.com/comment/36601993
tagged with: string
has comment: http://stackoverflow.com/comment/36602092
favorite count: 0
has answer: http://stackoverflow.com/a/23796633
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36601798
has answer: http://stackoverflow.com/a/23796744
has comment: http://stackoverflow.com/comment/36601953
linked to: http://stackoverflow.com/q/23783710
has comment: http://stackoverflow.com/comment/36601832
has body: Here I have 2 strings String first = "stack overflow"; String second = "java programming"; from that I need output as: stck eflow j prgmming i.e., take character from first string and compare with remaining all character in second string, if present remove it. Here is my code giving some unexpected result: String first = "stack overflow"; String second = "java programming"; for (int i = 0; i &lt; first.length(); i++) { out.println("char position :" + first.charAt(i)); for (int j = 0; j &lt; second.length(); j++) { if (first.charAt(i) == second.charAt(j)) { first = first.substring(0, i) + first.substring(i + 1); second = second.substring(0, j) + second.substring(j + 1); } } } out.println(first+second);

http://stackoverflow.com/comment/36698373
comment on: http://stackoverflow.com/q/23847351
type: Comment
type: QuestionComment
score: 2
has text: score = + 10; does this even compile?

http://stackoverflow.com/q/23908606
has answer: http://stackoverflow.com/a/23908815
upvote count: 18
has answer: http://stackoverflow.com/a/70478255
has answer: http://stackoverflow.com/a/37975218
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23908815
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/37975218
has comment: http://stackoverflow.com/comment/36816100
type: Question
has answer: http://stackoverflow.com/a/77559653
score: 18
has answer: http://stackoverflow.com/a/23908821
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/51360872
has answer: http://stackoverflow.com/a/70527941
has body: I am trying to connect to DB in a servlet using Hibernate.I have read that we can use either hibernate.cfg.xml or hibernate.properties file for configuration of session.For me it worked with xml. Now when I am trying to use properties instead of xml its not working. It is saying that hibernate.cfg.xml not found.But nowhere I mentioned to use xml file and infact I have deleted that xml file. Please Help me. And Please correct me if I am doing anything wrong.
has title: How to use hibernate.properties file instead of hibernate.cfg.xml
tagged with: properties
answer count: 7
tagged with: java
tagged with: hibernate
tagged with: database

http://stackoverflow.com/q/23845341
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23845954
tagged with: java
has answer: http://stackoverflow.com/a/23846597
type: Question
answer count: 2
has body: I have an abstract class in my software as follows: public abstract class Foo { public abstract addAlgo(Object o); } I want to have different implementations of Foo by different people to be saved and run by my software dynamically on run time. I have a main class as follows: public class Main { Foo f; } I want my users to give their implementations of Foo at run time. I am facing following difficulties: How would the User be able to add his implementation class by GUI on run time? How can I instantiate objects of user's implementation at run time in Main class? I want the user's implementation to be a permanent part of my software in the future, not just at the run time... i.e. I want my software to add functionality at run time and permanently store that functionality (i.e change in the Main class) ... actually I want to extend my software by user's day by day... Once the user will add his functionality class at run time then he would be able to view his object instantiation code in the Main class(automatically) as follows: public class Main { Foo f; main(...){ MyAlgo O=new MyAlgo();//MyAlgo implements Foo actually f=O; } } How can I do this?
score: 0
has comment: http://stackoverflow.com/comment/36694915
has title: Adding classes in application at run time

http://stackoverflow.com/comment/97054514
score: 0
type: Comment
has text: That could happen if you've made your own class called `Exception`. Don't do that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23821313

http://stackoverflow.com/q/23876423
tagged with: java
has answer: http://stackoverflow.com/a/23876574
tagged with: dom
score: 0
has title: Read UTF8 and Cp1256 from Xml using DOM Android
answer count: 1
accepted answer: http://stackoverflow.com/a/23876574
tagged with: android
tagged with: utf-8
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
type: Question
has body: I am using DOM object to read an xml that contains arabic data that all lines are written in UTF-8 except one line that is written in CP1256, while parsing it, it's parsed by default as UTF-8 witch giving "weird letters" for the CP1256 line, how I can tell the DOM parser to parse this line as CP1256, Please check the XML: http://alingilalyawmi.org/rss/v2/evangelizo_rss-maa.xml When opening it in notepad++ you will realize that data inside is unreadable until you change the encoding to cp1256.

http://stackoverflow.com/q/23820796
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36648331
has comment: http://stackoverflow.com/comment/36648191
downvote count: 1
has comment: http://stackoverflow.com/comment/36648128
has comment: http://stackoverflow.com/comment/36647958
tagged with: java
type: Question
score: 0
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23821899
favorite count: 0
has title: Count up timer on multiple activities
has comment: http://stackoverflow.com/comment/36648044
tagged with: android
has comment: http://stackoverflow.com/comment/36649274
has body: I have a count up timer in one of my activities and I want to show that timer with elapsed time in my 2nd activity. I tried to Use Fragments for this but the timer keeps restaring on the launch of 2nd activity. My timer code is: startTime = SystemClock.uptimeMillis(); customHandler.postDelayed(updateTimerThread, 0); private Runnable updateTimerThread = new Runnable() { public void run() { timeInMilliseconds = SystemClock.uptimeMillis() - startTime; updatedTime = timeSwapBuff + timeInMilliseconds; int secs = (int) (updatedTime / 1000); int mins = secs / 60; secs = secs % 60; int milliseconds = (int) (updatedTime % 1000); /* Timer.setText("" + mins + ":" + String.format("%02d", secs) + ":" + String.format("%03d", milliseconds));*/ customHandler.postDelayed(this, 0); } };

http://stackoverflow.com/comment/36720689
type: Comment
type: QuestionComment
has text: When you called setContentView you told it to use activity_main.xml. Then any call to findViewById() will look only into activity_main.xml
score: 0
comment on: http://stackoverflow.com/q/23858203

http://stackoverflow.com/a/76440026
answers question: http://stackoverflow.com/q/23829248
score: 0
has body: For those stumbling on this question after searching: Java now has javax.time, which includes among others ZonedDateTime and Instant, that replaces Timestamp and has a lot more nice methods to deal with time. Interval isn't included in the standard, but there's a extension: ThreeTen-Extra that does. So you can write something like: Instant loggedintime=rs.getTimestamp("LOGIN_TIME").toInstant(); Instant loggedouttime=rs.getTimestamp("LOGOUT_TIME").toInstant(); Interval loggedInInterval = Interval.of(loggedintime, loggedouttime); System.out.println("Total time logged in: " + loggedInInterval);
type: Answer

http://stackoverflow.com/q/23861315
score: -3
has comment: http://stackoverflow.com/comment/36726239
tagged with: primes
tagged with: decomposition
has title: How do I show the entire calculation in the output?
has comment: http://stackoverflow.com/comment/36726089
tagged with: java
has body: Good evening, I'm a beginner in java and I was assigned to code a program to decompose prime number. This is what I've got so far. package introductionProgramming; import javax.swing.JOptionPane; public class Primes { public static void main(String[] args) { int primo; primo = Integer.parseInt(JOptionPane.showInputDialog("Inform prime number: ")); while (prime % 2 == 0) { prime = prime / 2; } while (prime % 3 == 0) { prime = prime / 3; } while (prime % 5 == 0) { prime = prime / 5; } JOptionPane.showMessageDialog(null, prime); } } So the decomposition part seems to work but I need the output, if entered the number 180, to look similar to this: 180 2 90 2 45 3 15 3 5 5 1 I have no clue how to do it.
has comment: http://stackoverflow.com/comment/36726069
upvote count: 1
has comment: http://stackoverflow.com/comment/36726027
type: Question
has comment: http://stackoverflow.com/comment/36726257
downvote count: 4
has comment: http://stackoverflow.com/comment/36726375
has answer: http://stackoverflow.com/a/23861516
answer count: 1
has comment: http://stackoverflow.com/comment/36726155
favorite count: 0
has comment: http://stackoverflow.com/comment/36726352
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36726204

http://stackoverflow.com/comment/36821862
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23912035
has text: I don't think this question is *quite* vote to close as "unclear what you're asking", but you're unlikely to get good advice without stating exactly what you need to be able to do with this table. Does each `0..8` value need to have a unique integer index? or two indices (e.g. a two dimensional array?) etc.
score: 0

http://stackoverflow.com/comment/36765253
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23882283
type: Comment
has text: Once you split the string, it will be stored as an array. from the array you can fetch the elements which you want. Please try the below after split the string. String tmpStr = urArray[0]+urArray[1]; this will give you the result which you are expecting.

http://stackoverflow.com/q/23906091
downvote count: 0
has body: I'm having problems defining my own TransactionEventHandler in Neo4j. My goal (for simlicity here) is to bump the version property of a version node in the db each time any transaction is made. In the following code I'm first creating a version node that should hold the current version, then register my transaction event handler, and then I create a node in the db to trigger the execution of beforeCommit(). Then everything hangs and after a while I get this stack trace. I'm using neo4j-2.1.0-M02 and this is my code: public class MyTransactionEventHandlerTest { private static GraphDatabaseService db; private static MyTransactionEventHandler transactionEventHandler; @BeforeClass public static void setup() { db = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node versionNode = null; try (Transaction tx = db.beginTx()) { versionNode = db.createNode(DynamicLabel.label("__TransactionVersion__")); tx.success(); } transactionEventHandler = new MyTransactionEventHandler(versionNode); db.registerTransactionEventHandler(transactionEventHandler); } @AfterClass public static void shutdown() { db.shutdown(); } @Test public void commitSomething() { try (Transaction transaction = db.beginTx()) { db.createNode(DynamicLabel.label("Something")); // trigger beforeCommit() transaction.success(); } } } My transaction event handler class: public class MyTransactionEventHandler implements TransactionEventHandler&lt;Object&gt; { private Node versionNode; public MyTransactionEventHandler(Node versionNode) { this.versionNode = versionNode; } @Override public Object beforeCommit(TransactionData data) throws Exception { incrementTransactionVersion(); return null; } @Override public void afterCommit(TransactionData data, Object state) { } @Override public void afterRollback(TransactionData data, Object state) { } public Node getVersionNode() { return versionNode; } private void incrementTransactionVersion() { versionNode.setProperty("transactionVersion", (Long) versionNode.getProperty…
answer count: 0
tagged with: transactions
tagged with: java
type: Question
has title: How to set property of node inside TransactionEventHandler?
upvote count: 2
tagged with: neo4j
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/23790333
score: 2

http://stackoverflow.com/comment/36933589
type: QuestionComment
comment on: http://stackoverflow.com/q/23886205
score: 0
has text: @JasonPlutext My Question is that how to do it?
type: Comment

http://stackoverflow.com/comment/36765650
comment on: http://stackoverflow.com/q/23882404
has text: That was it. Thanks muchly.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23931485
has comment: http://stackoverflow.com/comment/36858340
type: Answer
has comment: http://stackoverflow.com/comment/36859036
score: 1
has comment: http://stackoverflow.com/comment/36858648
has comment: http://stackoverflow.com/comment/36863515
upvote count: 1
has comment: http://stackoverflow.com/comment/36858669
answers question: http://stackoverflow.com/q/23930650
has comment: http://stackoverflow.com/comment/36859145
has body: As from the Javadoc on the JDBCCategoryDataset: The first column will be the category name and remaining columns values (each column represents a series). Hence if you put the price of your second product in the third column, that should work fine. If, however, you cannot do that because of schema or data restrictions or what not, you have several other options available to you: Use a DefaultCategoryDataset as the closest thing to JDBCCategoryDataset and populate it manually. You seem to be creating a time series graph (values plotted against dates). As such, it is only reasonable to try a TimeSeriesCollection as your dataset. It is a collection of Time Series (surprise!), and each Time Series is a collection of (date, value) points that will be plotted on your graph as a line. A more general approach is to use Abstract Dataset and provide a renderer, but that requires quite a bit of background knowledge and is reserved for when you need something very non trivial. (But is useful to learn JFreeChart) I would use option 2. A snippet of it may look like this: TimeSeriesCollection timeSeries = new TimeSeriesCollection(); TimeSeries product1 = new TimeSeries("product1"); new JDBCTemplate("query", params, new ResultSetExtractor&lt;Void&gt;() { public Void extractData(ResultSet rs) throws SQLException { product1.addOrUpdate(new FixedMillisecond(rs.getLong(1)), rs.getDouble(2)); return null; } } &lt;other products to follow&gt;
has comment: http://stackoverflow.com/comment/36870668
downvote count: 0
has comment: http://stackoverflow.com/comment/36859278
has comment: http://stackoverflow.com/comment/36858414

http://stackoverflow.com/a/23876048
type: Answer
has comment: http://stackoverflow.com/comment/36758098
downvote count: 0
has comment: http://stackoverflow.com/comment/36756722
has comment: http://stackoverflow.com/comment/36758001
has comment: http://stackoverflow.com/comment/36756943
answers question: http://stackoverflow.com/q/23875776
score: 1
has body: Use this method of the Apache commons StringUtils class public String leftPad(String str, int size, char padding); after you've converted your number to 0s and 1s. It might look like String paddedBin = StringUtils.leftPad(bin, 8, '0'); for example. Not sure how many digits you actually want to pad it to.
upvote count: 1
has comment: http://stackoverflow.com/comment/36757956

http://stackoverflow.com/q/23917844
favorite count: 0
has answer: http://stackoverflow.com/a/23918106
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Using Spring, Basic Auth and LDAP, how can I get the supplied username?
tagged with: jersey
has body: I'm authenticating users against LDAP with spring security. My bean config looks like this &lt;security:http use-expressions="true" &gt; &lt;security:intercept-url pattern="/secure/**" access="isAuthenticated()"/&gt; &lt;security:http-basic/&gt; &lt;/security:http&gt; &lt;security:authentication-manager&gt; &lt;security:ldap-authentication-provider user-dn-pattern="cn={0},ou=users"/&gt; &lt;/security:authentication-manager&gt; &lt;security:ldap-server url="${ldap.url}/${ldap.base}" /&gt; This works great, but now I want access to that {0} username in code. I do have Jersey managing the service interface and I found some tutorials on creating a filter and digging through the request. However, I was hoping there would be an easier way to get at it, seeing as how Spring has already done all the work and has the username in plain text and ready to be shipped off to the LDAP server.
tagged with: spring-security
tagged with: ldap
accepted answer: http://stackoverflow.com/a/23918106
upvote count: 1
answer count: 1
tagged with: basic-authentication

http://stackoverflow.com/q/23888835
has comment: http://stackoverflow.com/comment/36781001
favorite count: 0
tagged with: tomcat7
has title: about errors while starting or stopping tomcat
has body: I am getting these warning and errors while I restart my tomcat or I stop my tomcat server. it is not interfering in my project but I guess this is serious problem while no. of user increase. P.S. I have used hibernate for database connection, display tag library for display tables and have used jsp/servlet. INFO: Illegal access: this web application instance has been stopped already. Could not load com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1600) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at com.mchange.v2.resourcepool.BasicResourcePool.checkIdleResources(BasicResourcePool.java:1481) at com.mchange.v2.resourcepool.BasicResourcePool.access$2000(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:1964) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Exception in thread "Timer-0" java.lang.NoClassDefFoundError: com/mchange/v2/resourcepool/BasicResourcePool$AsyncTestIdleResourceTask at com.mchange.v2.resourcepool.BasicResourcePool.checkIdleResources(BasicResourcePool.java:1481) at com.mchange.v2.resourcepool.BasicResourcePool.access$2000(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:1964) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.…
has answer: http://stackoverflow.com/a/23889152
accepted answer: http://stackoverflow.com/a/23889152
has comment: http://stackoverflow.com/comment/36777443
has comment: http://stackoverflow.com/comment/36777561
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36777794
type: Question
has comment: http://stackoverflow.com/comment/36777601
tagged with: jsp
tagged with: displaytag
has comment: http://stackoverflow.com/comment/36777507
upvote count: 1
answer count: 1

http://stackoverflow.com/a/23878533
upvote count: 3
answers question: http://stackoverflow.com/q/23878406
has comment: http://stackoverflow.com/comment/36758218
has comment: http://stackoverflow.com/comment/36758751
has comment: http://stackoverflow.com/comment/36758327
has comment: http://stackoverflow.com/comment/36758640
has comment: http://stackoverflow.com/comment/36758921
type: Answer
downvote count: 1
has body: However, I reality, in the sample program I wrote, I can use super keywords to access any method in superclass. In the real reality you can't ... except in very specific circumstances. You can't use super to call a method that is forbidden by the access rules: Calling a private method is forbidden unless this class is nested within the other or vice versa. Calling a package private method is forbidden unless this class is in the same package as the other. Calling a protected method is allowed. If you have an example that appears to contradict this, please add it to your Question so that we can explain what is actually going on. The question here is: why most people talking online about the use of super, they always talking about the invocation of overridding method? I think you may be talking about this: public class A { public void foo() {...} } public class B extends A { public void foo() { // The overriding method. ... super.foo(); // invoking the overridden method. ... } } The method in the child class invokes the overridden version of itself. The reason that you are seeing it in lots of example is that it is the most common use-case for super. That's all. On the other hand if the method A.foo() is not overridden at all, then it is legal to use super.foo() to call it in B ... but I don't think it is good style. For a start, it would probably break if you then did add an override method in B.
score: 2
has comment: http://stackoverflow.com/comment/36758009
has comment: http://stackoverflow.com/comment/36758828
has comment: http://stackoverflow.com/comment/36757969

http://stackoverflow.com/q/23917629
type: Question
score: -2
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/36833931
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23917684
has title: Why don't I need to statically import launch method?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23917684
has body: I was tinkering with the smallest runnable JavaFX application I could create. I came up with this: import javafx.application.Application; import javafx.stage.Stage; // import static javafx.application.Application.launch; // not needed ! WHY? public class SmallestJavaFXExample extends Application { @Override public void start(Stage primaryStage) { primaryStage.show(); } public static void main(String[] args) { launch(args); } } Apparently this compiles with JDK 8. But to my surprise the static import of the launch method is not needed. But when I test this with Eclipse, its compiler says that it cannot find the launch method. Why don't I need the static import for launch?
downvote count: 3
upvote count: 1
tagged with: java-8

import
type: Tag
tags question: http://stackoverflow.com/q/23849239
tags question: http://stackoverflow.com/q/23889867
tag name: import
tags question: http://stackoverflow.com/q/23778513
tags question: http://stackoverflow.com/q/23926821
tags question: http://stackoverflow.com/q/23874491
tags question: http://stackoverflow.com/q/23840473
tags question: http://stackoverflow.com/q/23866254
tags question: http://stackoverflow.com/q/23859827
tags question: http://stackoverflow.com/q/23830212
tags question: http://stackoverflow.com/q/23852923
tags question: http://stackoverflow.com/q/23888240
tags question: http://stackoverflow.com/q/23936165

http://stackoverflow.com/comment/36752163
score: 1
comment on: http://stackoverflow.com/q/23875793
has text: `matches()` matches the whole string, not a part of it. You would have to either split the string and compare to each element, or use `Pattern ...; Matcher ...;`.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23818843
has body: Hi there question on futures and execution contexts in Play framework (Java). Right now here is how I currently run non blocking operations: public static Promise&lt;Result&gt; doOperation() { Promise&lt;Result&gt; r = Promise.wrap( Patterns.ask(actorTest, "bla", 1000)).map( new Function&lt;Object, Result&gt;() { public Result apply(Object response) { return ok(response.toString() + "\nOh look it returned"); } }); return r; } But this seems to have too much extra code for simple operations such as just running a longer query. Is there a way to do this without creating actors? I read from here that you can but am not sure how to integrate what is written with a play action. Can someone give an example action say doOperation like above that can simply create a callable within the action that is run concurrently (not part of the play default context as this should never be blocked).
tagged with: playframework
has answer: http://stackoverflow.com/a/23824866
answer count: 1
score: 0
tagged with: future
type: UnansweredQuestion
has title: Playframework run concurrently without having to create entire untyped actor class for simple blocking operations (Java)
tagged with: java
type: Question

http://stackoverflow.com/comment/36661860
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23828425
has text: What do you mean by "garbage"?

http://stackoverflow.com/q/23937670
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23937829
tagged with: android-fragments
tagged with: java
possible better answer: http://stackoverflow.com/a/23937892
has answer: http://stackoverflow.com/a/23937892
has answer: http://stackoverflow.com/a/23938412
accepted answer: http://stackoverflow.com/a/23938412
type: Question
has comment: http://stackoverflow.com/comment/36869812
score: 0
has title: how to send intent in two different class at fragment
answer count: 3
tagged with: android
has body: I have a variable that is sent through ntent, and sent to two different classes, how? so my intent like this: case 0: position = new LatLng (-8.447159, 112.651799); args.putParcelable ("place_position", position); a = new Intent (getActivity (), MapsMenu.class); a.putExtra ("lat", args); a.putExtra ("post", "cave"); a.putExtra ("location", "South Beach Goa China in Malang"); break; Key 'post' sent to class A, while the key 'location' and 'lat' sent to class B, I use a fragment of actionsherlock, for variable successfully sent to class B, while for class A does not appear, the following source code: public class A extends SherlockListFragment { ListView list; List&lt;HashMap&lt;String, String&gt;&gt; aList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ImageView imDetail; String pos; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub Intent in = getActivity().getIntent(); pos = (String) in.getStringExtra("post"); return super.onCreateView(inflater, container, savedInstanceState); } and this is B class : public class B extends SherlockMapFragment { String title; private GoogleMap map; LatLng LAT = null; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); map = getMap(); Bundle bundle = getActivity().getIntent().getParcelableExtra("lat"); Intent in = getActivity().getIntent(); title = (String) in.getStringExtra("location"); LAT = bundle.getParcelable("place_position"); LoadMaps(LAT, title); return root; } Am I missing something?
tagged with: android-intent

http://stackoverflow.com/q/23904575
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36808092
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36808205
type: Question
answer count: 2
upvote count: 9
has answer: http://stackoverflow.com/a/23904672
linked to: http://stackoverflow.com/q/2070293
has comment: http://stackoverflow.com/comment/36949511
has body: I am not throwing any exception out of static block. static { try { int number = Integer.parseInt("2a"); } catch (NumberFormatException e) { //log } } Why using try and catch is considered wrong in this case?
has comment: http://stackoverflow.com/comment/36808281
favorite count: 0
has title: use try catch in static initialization block
has comment: http://stackoverflow.com/comment/36808102
possible better answer: http://stackoverflow.com/a/23905300
has comment: http://stackoverflow.com/comment/36808077
accepted answer: http://stackoverflow.com/a/23904672
has answer: http://stackoverflow.com/a/23905300
has comment: http://stackoverflow.com/comment/36808531
score: 6
has comment: http://stackoverflow.com/comment/36808353

http://stackoverflow.com/comment/36581877
score: 1
type: AnswerComment
type: Comment
has text: @Patan before writing your lines you should write char '\ufeff'; but don't forget to set your character coding to UTF-8.
comment on: http://stackoverflow.com/a/23783836

http://stackoverflow.com/q/23929339
type: Question
has answer: http://stackoverflow.com/a/23929538
has title: logging configuration on JBoss
linked to: http://stackoverflow.com/q/21846329
answer count: 1
type: UnansweredQuestion
has body: I'm going to use my log4j appender in JBoss WildFly8 but I don't know how to do that. Actually, I have done researches but have not found any working solution. How could I config my App Server?
tagged with: logging
score: 0
tagged with: java
tagged with: jboss

http://stackoverflow.com/comment/36849046
type: QuestionComment
has text: So you are trying to get the parameter passed in the enum entry or the index of the entry itself? In the latter case, you can count the length of values and subtract 1 for max, and min will always be 0.
score: 0
comment on: http://stackoverflow.com/q/23926329
type: Comment

http://stackoverflow.com/comment/36812645
comment on: http://stackoverflow.com/a/23906941
score: 0
has text: Although I have tried it without changing the directory structure and just putting .....getResourceAsStream("/menu/images/" + filename); and it gets that image from the assets folder without needing to change the directory at all. So it still works.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36588397
type: QuestionComment
comment on: http://stackoverflow.com/q/23786970
has text: I mean display like in a text one message is on the screen in a bubble then if I type another it goes under the previous one and if the person on the other end sends one it is on the other side
score: 0
type: Comment

http://stackoverflow.com/a/23780328
has body: It raises the compiler error because you break one of the core principles of inheritance in Java (and in OOP proper). This principle is the overriding member cannot impose more restrictions to the caller than the overridden member, as declared in the super class, even if we discuss about access type or declared exception types. In your case, ClassNotFoundException is not declared in the super class, nor any of its ancestors.
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23780119
type: Answer

http://stackoverflow.com/comment/36745792
has text: The guy need to convert properties to JSON. Not just read json from file to JsonObject.
type: AnswerComment
comment on: http://stackoverflow.com/a/23871914
type: Comment
score: 2

http://stackoverflow.com/q/23845741
answer count: 1
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/23846137
type: AnsweredQuestion
has title: Collision detection in libgdx for triangles
type: Question
has answer: http://stackoverflow.com/a/23846137
has body: I am making a simple game with libgdx and wanted to add some simple collision detection. I already managed to express my player by using a simple rectangle: boundingBox = new Rectangle(x + 10, y + 10, 13, 21); but my obstacles seem to be much more complicated. They are supposed to be spikes over which the player can jump and have a triangle shape. They pretty much look like this: http://kayin.pyoko.org/iwbtg/forums/Smileys/iwbtg/spikes.gif As far as I noticed there is no triangle shape in libgdx. I already tried using polygons but they seem far too complicated for my purposes. Is there an easy way to implement an accurate hitbox for them? Thanks in advance for reading my post : ) EDIT: Thanks everyone for your responses, everything works fine now, besides drawing my polygons for testing purposes. When I call shapeRenderer.polygon(kid.getVertices()); it only draws my polygon in the top left corner, since it's defined as boundingBox2.setVertices(new float[] { 10, 10, 10, 31, 23, 31, 23, 10 }); But I move it around in the update method of my kid class by using boundingBox2.setPosition(position.x, position.y); Is there a way to use that position change inside shapeRenderer.polygon(kid.getVertices()); ? Anyways I really appreciate your help and after sorting out this problem I will close this thread : )
score: 0
tagged with: java
tagged with: collision-detection

http://stackoverflow.com/comment/36861123
has text: java and javascript are completely unrelated technologies. why would you want to do something like this in javascript?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23933069

http://stackoverflow.com/comment/36641059
type: Comment
comment on: http://stackoverflow.com/q/23816764
score: 0
has text: Using Process Monitor, I believe that \jre\bin\java.dll is responsible for loading the JARs. Is that a known method for making JARs accessible to a Windows application? @biziclop
type: QuestionComment

http://stackoverflow.com/a/40233705
upvote count: 50
downvote count: 0
has body: It seems like your query returns more than one result check the database. In documentation of query.uniqueResult() you can read: Throws: org.hibernate.NonUniqueResultException - if there is more than one matching result If you want to avoid this error and still use unique result request, you can use this kind of workaround query.setMaxResults(1).uniqueResult();
answers question: http://stackoverflow.com/q/23866709
score: 50
type: Answer

http://stackoverflow.com/q/23920425
duplicate of: http://stackoverflow.com/q/12026885
has answer: http://stackoverflow.com/a/33799497
score: 0
tagged with: for-loop
answer count: 3
tagged with: batch-processing
accepted answer: http://stackoverflow.com/a/23920622
has comment: http://stackoverflow.com/comment/36838117
has comment: http://stackoverflow.com/comment/36838139
has answer: http://stackoverflow.com/a/31709019
favorite count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/12026885
type: AnsweredQuestion
has body: I want to iterate through an ArrayList in small batch sizes. For example, if the ArrayList size is 75 and the batch size is 10, I want it to process records 0-10, then 10-20, then 20-30, etc. I tried this, but it did not work: int batchSize = 10; int start = 0; int end = batchSize; for(int counter = start ; counter &lt; end ; counter ++) { if (start &gt; list.size()) { System.out.println("breaking"); break; } System.out.println("counter " + counter); start = start + batchSize; end = end + batchSize; }
has answer: http://stackoverflow.com/a/23920622
type: Question
has comment: http://stackoverflow.com/comment/36838334
has title: Loop arraylist in batches
has comment: http://stackoverflow.com/comment/36838042
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/33799497
downvote count: 5

http://stackoverflow.com/a/23937017
type: Answer
answers question: http://stackoverflow.com/q/23935445
has comment: http://stackoverflow.com/comment/36868769
score: 1
upvote count: 1
has body: You're trying to store manager object on the HttpSession. Be aware that the objects that you store on the session has to be serializable. It looks like SocialAuthManager class isn't really Serializable even though it claims so: SocialAuthConfig isn't serializable A Log implementation object could be non-serializable The values within providersMap could be non-serializable
downvote count: 0

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/23868231
tags question: http://stackoverflow.com/q/23909149
tags question: http://stackoverflow.com/q/23879032
type: Tag
tags question: http://stackoverflow.com/q/23876675
tags question: http://stackoverflow.com/q/23884990
tags question: http://stackoverflow.com/q/23892785
tags question: http://stackoverflow.com/q/23881534
tags question: http://stackoverflow.com/q/23831200
tags question: http://stackoverflow.com/q/23778629

http://stackoverflow.com/comment/37027175
type: Comment
has text: Good point @LuiggiMendoza. I've added a summary to my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/24018910
score: 0

http://stackoverflow.com/comment/36579581
score: 0
type: Comment
type: QuestionComment
has text: They are using HashSets, before LinkHashSet existed or was in use on android (API 11). http://stackoverflow.com/questions/5080612/hashset-vs-linkedhashset What you are doing is **possible**. I just looked closer at your code and saw the issue :)
comment on: http://stackoverflow.com/q/23782636

http://stackoverflow.com/comment/36660091
score: 0
type: Comment
type: QuestionComment
has text: Use getText() to get the text of the text component as a String. There is no reason to use getDocument(). parseInt() wants a String as argument. You can't pass a Document as argument to parseInt(), since a Document is not a String.
comment on: http://stackoverflow.com/q/23827427

http://stackoverflow.com/q/23805082
has answer: http://stackoverflow.com/a/23809110
has comment: http://stackoverflow.com/comment/36618015
answer count: 2
has comment: http://stackoverflow.com/comment/36622425
accepted answer: http://stackoverflow.com/a/23812228
favorite count: 0
has title: Root resource classes found jersey rest
tagged with: rest
has comment: http://stackoverflow.com/comment/36619526
has comment: http://stackoverflow.com/comment/36617832
upvote count: 2
score: 1
tagged with: java
tagged with: web-services
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23812228
tagged with: jersey
possible better answer: http://stackoverflow.com/a/23809110
has body: I am trying to create a simple webservice using jersey rest webservices. So I created a simple class that i called main : @Path("/main") public class main { @GET @Path (value="Stringtest") @Produces(MediaType.APPLICATION_JSON) public String Stringtest() { System.out.println("************"); return ("string"); } } And then I chaged web.xml ( my package's name is "test") <?xml version="1.0" encoding="ASCII"?> rest JAX-RS Tools Generated - Do not modify JAX-RS Servlet com.sun.jersey.spi.container.servlet.ServletContainer 1 com.sun.jersey.config.property.packages test JAX-RS Servlet /rest/* it seems that there is something wrong in the web.xml because i get this error Infos: Scanning for root resource and provider classes in the packages: test AM com.sun.jersey.api.core.ScanningResourceConfig logClasses Infos: Root resource classes found: class test.main com.sun.jersey.api.core.ScanningResourceConfig init Infos: No provider classes found. Are there any suggestions to this issue? Please help!

http://stackoverflow.com/comment/37090883
has text: then I should delete this answer.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24055501

http://stackoverflow.com/comment/36816436
has text: I got to know problem is permission . I must be root user to execute the command. But servlet will run as nobody user
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23909095
type: Comment

http://stackoverflow.com/comment/36665603
has text: Yeah, but even a simple change from `Consumer` to `Predicate` and a conditional `println` based on the result (it will never get executed as the arrays aren’t empty) will change the result to plausible values.
comment on: http://stackoverflow.com/a/23830040
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/112989875
score: 0
type: Comment
has text: yes @Wheezil I guess you mean like in here: https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/client.html#d0e4391
comment on: http://stackoverflow.com/a/23890238
type: AnswerComment

http://stackoverflow.com/a/23834604
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36674064
has comment: http://stackoverflow.com/comment/36673972
has comment: http://stackoverflow.com/comment/36674047
has comment: http://stackoverflow.com/comment/36674004
score: 1
accepted answer of: http://stackoverflow.com/q/23834563
has comment: http://stackoverflow.com/comment/36673934
answers question: http://stackoverflow.com/q/23834563
upvote count: 1
type: AcceptedAnswer
has body: What you're doing is telling itemiconnect to set its value to true. Use the == operator to compare whether an item is true or false, or simply place itemiconnect into the parentheticals and it will check for you. EDIT: Where your code says if (item1connect = true) { indic1.setBackground(getResources().getDrawable(R.drawable.ring_filled_standard)); } you can change this to the comparator if (item1connect == true) { indic1.setBackground(getResources().getDrawable(R.drawable.ring_filled_standard)); } or better yet just use the implied true functionality if (item1connect) { indic1.setBackground(getResources().getDrawable(R.drawable.ring_filled_standard)); } Java allows you to simply call your boolean in an "if" statement as it represents a true or a false value.

http://stackoverflow.com/a/28739014
answers question: http://stackoverflow.com/q/23866709
upvote count: 2
type: Answer
downvote count: 9
has body: First you must test the query list size; here a example: long count; if (query.list().size() &gt; 0) count=(long) criteria.list().get(0); else count=0; return count;
score: -7

http://stackoverflow.com/comment/36860015
type: AnswerComment
score: 0
type: Comment
has text: No, adding **extra** responsibility of exporting itself to a *document* is an attribute of a *poor design*. Both in OOP design as well as in enterpise systems.
comment on: http://stackoverflow.com/a/23856098

http://stackoverflow.com/q/23889455
linked to: http://stackoverflow.com/q/19746668
type: AnsweredQuestion
has body: I try to use a native query in my Dao (extended from JpaRepository), but i get this exception : org.springframework.orm.jpa.JpaSystemException: Could not extract result set metadata; nested exception is org.hibernate.HibernateException: Could not extract result set metadata Here is my native query: @Repository public interface BenchDao extends JpaRepository&lt;Bench, Long&gt; { @Query(nativeQuery=true,value="UPDATE TF_BENCH SET ISDELETED = 1, SEQ = (select CASE WHEN (min(BENCH.SEQ) &lt; 1) THEN (min(BENCH.SEQ)-1) ELSE -1 END from TF_BENCH BENCH WHERE BENCH.STAGE = (select BENCH.STAGE from TF_BENCH BENCH WHERE id =29302)) WHERE id =29302") void deleteBench(); When i try this request on Oracle SQL developper it works, but through spring and hibernate it doesn't. In the stack trace exeception I have also this message : Caused by: java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement I've tried to google exception messages, but I found nothing...
has comment: http://stackoverflow.com/comment/36780589
has comment: http://stackoverflow.com/comment/36778830
has comment: http://stackoverflow.com/comment/36779096
possible better answer: http://stackoverflow.com/a/25036952
type: Question
accepted answer: http://stackoverflow.com/a/23905851
has answer: http://stackoverflow.com/a/25036952
tagged with: java
has comment: http://stackoverflow.com/comment/36779601
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36779120
score: 0
has comment: http://stackoverflow.com/comment/36779192
answer count: 2
tagged with: sql
tagged with: jpa
has title: Spring hibernate : Could not extract result set metadata
has comment: http://stackoverflow.com/comment/36778787
has answer: http://stackoverflow.com/a/23905851
tagged with: spring

http://stackoverflow.com/a/23900559
has comment: http://stackoverflow.com/comment/36979138
accepted answer of: http://stackoverflow.com/q/23897798
has comment: http://stackoverflow.com/comment/36827698
has comment: http://stackoverflow.com/comment/36829855
upvote count: 1
answers question: http://stackoverflow.com/q/23897798
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36827836
has comment: http://stackoverflow.com/comment/36827806
has body: You don't need a Converter. Converter is used to for advanced type conversion like converting an incoming string 'yyyy-mm-dd zone' to java.util.Date and vice versa. Spring provides JSTL tags library to attach modelAttribute to a &lt;form&gt; and its field. You can also attach a list of IngredientQuantity to the &lt;form&gt; and there are many tutorials on how to use list inside &lt;form&gt;. One such example is here UPDATE: In your case, you will add Dish and an empty list of IngredientQuantity to the model in your controller setup method as below class IngredientFormModel{ //It is important to use AutoPopulatingList as your list is dynamic AutoPopulatingList&lt;IngredientQuantity&gt; ingredientQuantityList = new AutoPopulatingList&lt;IngredientQuantity&gt;(IngredientQuantity.class); } @RequestMapping(method=RequestMethod.GET) public String setupForm(Model model) { model.addAttribute("dish", dish); IngredientFormModel ingredientFormModel = new IngredientFormModel(); model.addAttribute("ingredientFormModel", ingredientFormModel) return "viewName"; } Attach your ingredientFormModel to the &lt;form&gt; and use . operator to access nested fields (Note: You can access dish in JSP as a regular attribute in requestScope) &lt;form:form modelAttribute="ingredientFormModel"&gt; Dish Name: ${dish.name} &lt;br&gt; &lt;c:forEach var="ingredient" items="${dish.ingredients}" varStatus="count"&gt; Ingredient Name: ${ingredient.name} &lt;br&gt; &lt;input type="hidden" name="ingredientFormModel.ingredientQuantityList[${count.index}].name" value="${ingredient.name}" /&gt; Quantity: &lt;input name="ingredientFormModel.ingredientQuantityList[${count.index}].quantity.quantity" type="text" /&gt; &lt;/br&gt; Unit: &lt;input name="ingredientFormModel.ingredientQuantityList[${count.index}].quantity.unit" type="text"/&gt; &lt;/br&gt; &lt;/c:forEach&gt; &lt;/form:form&gt; In your controller class, you can retrieve the object as below @ModelAttribute("ingredientFormModel") IngredientFormModel i…
type: Answer
has comment: http://stackoverflow.com/comment/36828021
has comment: http://stackoverflow.com/comment/36932799
has comment: http://stackoverflow.com/comment/36980594
has comment: http://stackoverflow.com/comment/36979816
has comment: http://stackoverflow.com/comment/36932815
has comment: http://stackoverflow.com/comment/36842585
has comment: http://stackoverflow.com/comment/36827749
has comment: http://stackoverflow.com/comment/36827410
has comment: http://stackoverflow.com/comment/36827764
has comment: http://stackoverflow.com/comment/36825627
has comment: http://stackoverflow.com/comment/36828093
score: 1
has comment: http://stackoverflow.com/comment/36980220
has comment: http://stackoverflow.com/comment/36942514

http://stackoverflow.com/q/23812761
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36632752
possible better answer: http://stackoverflow.com/a/35039569
linked to: http://stackoverflow.com/q/541920
has answer: http://stackoverflow.com/a/27495912
type: AnsweredQuestion
tagged with: escaping
has comment: http://stackoverflow.com/comment/36635757
linked to: http://stackoverflow.com/q/2290757
has comment: http://stackoverflow.com/comment/36632938
score: 10
has comment: http://stackoverflow.com/comment/36633050
tagged with: javadoc
has title: Trying to escape the "@" symbol in a {@code} block within a javadoc comment with Netbeans 8.0
type: Question
has answer: http://stackoverflow.com/a/23812832
accepted answer: http://stackoverflow.com/a/23812832
has comment: http://stackoverflow.com/comment/36632651
has comment: http://stackoverflow.com/comment/36654036
favorite count: 0
has answer: http://stackoverflow.com/a/46332643
upvote count: 10
tagged with: java-8
answer count: 4
has comment: http://stackoverflow.com/comment/36632880
has answer: http://stackoverflow.com/a/35039569
tagged with: netbeans
has body: I'm trying to insert a {@code } annotation in a Javadoc comment using Netbeans 8.0 and it's not working properly. I've seen other questions on this from before (i.e., How can you escape the @ character in javadoc?) but the html escape &amp;#64; and {@literal @} both don't seem to work. My comment looks like this (using both methods for sake of the example): /** * blah blah blah * &lt;p&gt; * For example: * &lt;pre&gt; * {@code * {@literal @}begin_specification * ... * &amp;#64;end_specification * } * &lt;/pre&gt; */ I can hit Run -&gt; Generate Javadoc and everything runs fine with no errors but I see this when I look at the resulting output in a browser: {@literal @}begin_specification ... &amp;#64;end_specification Which isn't the desired result... Any suggestions/ideas? I'm fairly new to Java but have used things like Doxygen in C/C++ in the past. Am I doing something wrong here? I'm using NetBeans 8.0 (Build 201403101706) with Java 1.8.0_05 x64.

http://stackoverflow.com/a/23934242
has body: No, this is what happens when you make a call such as. new Num2() ; 1) All variables are initialised with default values (0, null, false, '\u0000') including those inherited from superclasses. 2) The implicit or explicit superclass constructor is called until the Object class (It is not allowed to pass any local variables or method returns as arguments to the superclass constructor invocation). Note that at this point although the implicit or explicit constructors are called they do not execute any code inside. (if u have an empty constructor, the compiler will place an implicit call to the no-args superclass constructor, so it doesn't get to execute anything inside the method until top most superclass constructor is reached, since the first line of code in every constructor will be super() ; whether you put it or not. If the superclass does not have a no-args constructor available then u must explicitly provide one as the first line of code in your subclass constructor e.g. super("a string argument") ;) 3) When top level superclass constructor is reached, variables declared at that level are assigned with their initialisers (values assign explicitly e.g. int i = 23;), block statements execute before constructors no matter where they are declared in the class and constructors are executed after all non-static blocks execute. Point 3 will then execute down the inheritance tree until Num2() Example 1 This first example will not compile. class Animal{ Animal(int){ } } class Dog extends Animal { Dog(){ // right here compiler will place an implicit call to super() ; not seen, at compile time. // since there is no no-args constructor available in class Animal compiler will issue a warning and stop compiling. Remember that a no-args constructor is provided by default ONLY if no other constructor was provided by the programmer. In this example we have a constructor in our superclass that takes an int as argument and so we must explicitly tell the compiler to call super(24);…
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36865613
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23934079
has comment: http://stackoverflow.com/comment/36865645
score: 4
answers question: http://stackoverflow.com/q/23934079
has comment: http://stackoverflow.com/comment/36863347
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36863850

regex
tags question: http://stackoverflow.com/q/23822375
tags question: http://stackoverflow.com/q/23856148
tags question: http://stackoverflow.com/q/23827302
tags question: http://stackoverflow.com/q/23884235
tags question: http://stackoverflow.com/q/23879863
tags question: http://stackoverflow.com/q/23800148
tags question: http://stackoverflow.com/q/23807492
tags question: http://stackoverflow.com/q/23919042
tags question: http://stackoverflow.com/q/23878708
tags question: http://stackoverflow.com/q/23839826
tags question: http://stackoverflow.com/q/23865546
tags question: http://stackoverflow.com/q/23868083
tags question: http://stackoverflow.com/q/23898066
tag name: regex
tags question: http://stackoverflow.com/q/23884885
tags question: http://stackoverflow.com/q/23883545
tags question: http://stackoverflow.com/q/23924920
tags question: http://stackoverflow.com/q/23921697
tags question: http://stackoverflow.com/q/23798262
tags question: http://stackoverflow.com/q/23874241
tags question: http://stackoverflow.com/q/23832593
tags question: http://stackoverflow.com/q/23898464
tags question: http://stackoverflow.com/q/23790887
tags question: http://stackoverflow.com/q/23859475
tags question: http://stackoverflow.com/q/23879154
tags question: http://stackoverflow.com/q/23803319
tags question: http://stackoverflow.com/q/23822624
tags question: http://stackoverflow.com/q/23931572
tags question: http://stackoverflow.com/q/23916595
tags question: http://stackoverflow.com/q/23812731
tags question: http://stackoverflow.com/q/23838481
tags question: http://stackoverflow.com/q/23936110
tags question: http://stackoverflow.com/q/23787722
tags question: http://stackoverflow.com/q/23826792
tags question: http://stackoverflow.com/q/23889675
tags question: http://stackoverflow.com/q/23924344
tags question: http://stackoverflow.com/q/23832535
tags question: http://stackoverflow.com/q/23930012
tags question: http://stackoverflow.com/q/23823453
tags question: http://stackoverflow.com/q/23931002
tags question: http://stackoverflow.com/q/23934069
tags question: http://stackoverflow.com/q/23789049
tags question: http://stackoverflow.com/q/23828593
tags question: http://stackoverflow.com/q/23781142
tags question: http://stackoverflow.com/q/23848454
tags question: http://stackoverflow.com/q/23827121
tags question: http://stackoverflow.com/q/23880817
tags question: http://stackoverflow.com/q/23921658
tags question: http://stackoverflow.com/q/23869613
tags question: http://stackoverflow.com/q/23787534
tags question: http://stackoverflow.com/q/23936280
tags question: http://stackoverflow.com/q/23842945
tags question: http://stackoverflow.com/q/23830972
tags question: http://stackoverflow.com/q/23858065
tags question: http://stackoverflow.com/q/23857701
tags question: http://stackoverflow.com/q/23847882
tags question: http://stackoverflow.com/q/23807830
tags question: http://stackoverflow.com/q/23875793
tags question: http://stackoverflow.com/q/23903494
tags question: http://stackoverflow.com/q/23909689
tags question: http://stackoverflow.com/q/23786064
tags question: http://stackoverflow.com/q/23798655
tags question: http://stackoverflow.com/q/23872586
tags question: http://stackoverflow.com/q/23824930
type: Tag
tags question: http://stackoverflow.com/q/23935303

http://stackoverflow.com/comment/36793438
type: QuestionComment
has text: @Andreas, the reflection Idea may be the one for this problem. Since I can't edit the parent classes and make them implement any interfaces, this may be the best solution. Thanks!
score: 0
comment on: http://stackoverflow.com/q/23895478
type: Comment

http://stackoverflow.com/q/23935796
type: UnansweredQuestion
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/23935950
has answer: http://stackoverflow.com/a/23935912
type: Question
has title: Declaring ArrayLists: difference in Functionality?
linked to: http://stackoverflow.com/q/4166966
has comment: http://stackoverflow.com/comment/36866308
has comment: http://stackoverflow.com/comment/36866271
has body: I'm curious, When declaring ArrayLists, What is the difference in doing this: List&lt;String&gt; arrayList1= new ArrayList&lt;String&gt;(); and this: List&lt;String&gt; arrayList2= new ArrayList&lt;&gt;(); i.e. not declaring the &lt;String&gt; twice?
duplicate of: http://stackoverflow.com/q/4166966
tagged with: arraylist
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/20604137

http://stackoverflow.com/q/23826923
tagged with: date-format
type: AnsweredQuestion
tagged with: parseexception
accepted answer: http://stackoverflow.com/a/23827001
score: 1
tagged with: simpledateformat
tagged with: java
has body: I'm having this awkward problem with simple date format. I'm parsing some strings from a file and want to convert them in Date object. Strings are like "2012-04-19 18:33:10" so my code is: SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD hh:mm:ss"); sdf.setLenient(false); Date d1 = sdf.parse("2012-04-19 18:33:10"); which gives me java.text.ParseException: Unparseable date: "2012-04-19 18:33:10" Without the setLenient(false) the output date is Sun Jan 01 18:33:10 CET 2012 which is very incorrect. I really don't understand why. Any help would be appreciated. Thanks in advance
upvote count: 1
tagged with: date
type: Question
has title: Java SimpleDateFormat Unparseable date
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23827001
favorite count: 0

http://stackoverflow.com/a/23834963
answers question: http://stackoverflow.com/q/23834347
type: Answer
downvote count: 1
upvote count: 0
score: -1
has body: Your command is producing output that you want to read, but you refuse to read any of it until the command has finished producing it all and has exited (not calling getInputStream() until after waitFor()). If your command doesn't produce much output, this is OK, Java can buffer it. But if your command produces a lot of output, Java can't buffer it all, and the command gets blocked. The operating system won't let the command write any more output because Java's buffer is full and you haven't instructed Java to empty it. So the program is blocked, and Java's waitFor() will never come back. To solve your problem, you should call getInputStream() immediately after getting the Process object back from exec(), and you should create a new Thread that is responsible for reading the command output into your StringBuffer. You should then waitFor() the process to finish, to see if it exited successfully, and then you can wait for the thread to get to the end of the inputstream and finish - at that point, it is safe to read through the StringBuffer with the full output from your command.

http://stackoverflow.com/a/23821224
answers question: http://stackoverflow.com/q/23803104
score: 1
has comment: http://stackoverflow.com/comment/36695703
type: Answer
upvote count: 1
has body: The Azure Storage team has a Java client library which provides a simple yet powerful programming model allowing you to work with Azure Storage's blobs, tables and queues. More information can be found at Microsoft Azure Storage Client Library and Tooling Updates @ TechEd 2014. We have tried hard to follow established Java conventions so we hope Java developers will really enjoy using this library. Please let us know what you think! Jason
downvote count: 0

http://stackoverflow.com/q/23803856
type: UnansweredQuestion
tagged with: android
tagged with: calendar
has comment: http://stackoverflow.com/comment/36658003
tagged with: java
tagged with: date
type: Question
has title: Disable past dates from current date aspect
has comment: http://stackoverflow.com/comment/36617684
score: 0
has body: I have some piece of code here : Calendar nowCalendar = Calendar.getInstance(); Calendar minCalendar = new GregorianCalendar(nowCalendar.get(Calendar.YEAR), nowCalendar.get(Calendar.MONTH), nowCalendar.get(Calendar.DAY_OF_MONTH - 1)); orderCalendarView.setMinDate(minCalendar.getTimeInMillis()); But this dont work... my year is = 1. Does anyone know here how to disable past dates in android calendar control? Thanks
answer count: 0

http://stackoverflow.com/q/23860779
linked to: http://stackoverflow.com/q/60174
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23860857
tagged with: java
has answer: http://stackoverflow.com/a/23860857
type: Question
upvote count: 1
favorite count: 0
tagged with: sql-server
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23860794
tagged with: sql
accepted answer: http://stackoverflow.com/a/23860794
downvote count: 1
has body: I am trying to use some values taken from the user in an SQL query and trying to search on basis of that input. I did a little research and found this on web. st.executeQuery("SELECT * FROM Users WHERE UserName LIKE 'userName%'"); I then tried changing it to st.executeQuery("SELECT * FROM Users WHERE UserName='userName%'"); But that didn't work. Also I've tried using '@userName' but that doesn't work either. So Now I am here since clearly I am making some obvious mistake or none of the above methods are correct. Now if I hardcode the values st.executeQuery("SELECT * FROM Users WHERE UserName='Anwer'"); it works fine. So I think I am making mistake on how to use the program's values. I am using SQL Management Studio 2012 Programming Language Java.
has title: How to Use Program Values To Search In SQL SERVER
has answer: http://stackoverflow.com/a/23860973

http://stackoverflow.com/comment/36875988
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23940400
score: 2
has text: And if you started reading the Oracle Tutorials, you should continue reading [How to use GridBagLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html) There you'll find a nice example how to use the GBC. You have to change your GridBagConstraints, up to now you add every new `JTextPane` with the same Constraints.

http://stackoverflow.com/q/23796951
answer count: 3
has comment: http://stackoverflow.com/comment/36602845
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/36602776
favorite count: 0
has comment: http://stackoverflow.com/comment/36602616
has title: Why do I have NullPointerException in my sort implementation?
has comment: http://stackoverflow.com/comment/36602799
has comment: http://stackoverflow.com/comment/36602863
has answer: http://stackoverflow.com/a/75388923
has comment: http://stackoverflow.com/comment/36602750
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36602900
has answer: http://stackoverflow.com/a/23797172
has comment: http://stackoverflow.com/comment/36602644
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23797247
accepted answer: http://stackoverflow.com/a/23797247
has body: I'm working on my assignment and I am suppose to create a sort method for my array. However, I'm getting a null pointer error in my sort method and I'm not sure why. This is my code below. public Object[] sorted() { getSetArray(); Arrays.sort(setArray); return setArray; } these are my line of error java.lang.NullPointerException at java.util.ComparableTimSort.binarySort(ComparableTimSort.java:232) at java.util.ComparableTimSort.sort(ComparableTimSort.java:176) at java.util.ComparableTimSort.sort(ComparableTimSort.java:146) at java.util.Arrays.sort(Arrays.java:472) at setadt.SetADT.sorted(SetADT.java:280) at setadt.SetADTDriver_sol.main(SetADTDriver_sol.java:233) package setadt; import java.util.*; public class SetADT { private static Random rand = new Random(); private final int DEFAULT_CAPACITY = 100; private final int NOT_FOUND = -1; private int size; private Object[] setArray; public SetADT() { size = 0; setArray = new Object[DEFAULT_CAPACITY]; } public SetADT(int capacity) { size = 0; setArray = new Object[capacity]; } public void add(Object newElement) { if (size() == setArray.length) { resize(); } if(!contains(newElement) == true){ setArray[size] = newElement; size++; } //System.out.println(newElement +"\t" + size); } public void addAll(SetADT set) { Object[] temp = set.getSetArray(); for (int i = 0; i &lt; set.size(); i++) { if (!this.containsValue(temp[i])) { add(temp[i]); } } } public boolean contains(Object element) { for (int i = 0; i &lt; size; i++) { if (setArray[i].equals(element)) { return true; } } return false; } public boolean containsValue(Object element) { for (int i = 0; i &lt; size; i++) { if (setArray[i].toString().equals(element.toString())) { return true; } } return false; } public boolean equals(SetADT set) { boolean result = false; Object element; if (size() == set.size()) { result = true; for (int i = 0; i &lt; size(); i++) { element = setArray[i]; if (!set.contains(element)) { return false; } } } return result; } public boolean isEmpty()…
score: -1
possible better answer: http://stackoverflow.com/a/75388923
downvote count: 2

http://stackoverflow.com/q/23826649
favorite count: 0
has body: Our application was deployed in Multiple Schema based on the Locations. Now we are going to merge the data of different databases to single database of MySql As I am new to Database Migration , I really likes to take advice of experts. 1) Any good tools can be used for this process. 2) What are the precautions to be done for this. The application is in Spring,Hibernate, Java Database is MySql
has title: Integration Of Multischema to Single Schema
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
type: Question
tagged with: java
tagged with: hibernate
tagged with: database
tagged with: mysql
downvote count: 0
score: 1

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/23872307
tags question: http://stackoverflow.com/q/23782406
tag name: session-timeout

http://stackoverflow.com/q/23911293
type: UnansweredQuestion
has body: Code for posting photos and some data to server. HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(Constants.STORIES_URL); httpPost.addHeader("Authorization", "Token token=" + s); MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("uuid", "1234567890")); nameValuePairs.add(new BasicNameValuePair("title", "Title")); nameValuePairs.add(new BasicNameValuePair("subtitle", "Subtitle")); nameValuePairs.add(new BasicNameValuePair("private", "true")); nameValuePairs.add(new BasicNameValuePair("photo", Environment.getExternalStorageDirectory() + "/DCIM/0.jpg")); nameValuePairs.add(new BasicNameValuePair("bytes[uuid]", "1234567890")); nameValuePairs.add(new BasicNameValuePair("bytes[timelineDate]", "1970-01-01T00:00:00.000+00:00")); nameValuePairs.add(new BasicNameValuePair("bytes[caption]", "Byte 1")); nameValuePairs.add(new BasicNameValuePair("bytes[photo]", Environment.getExternalStorageDirectory() + "/DCIM/0.jpg")); for (NameValuePair nameValuePair : nameValuePairs) { if (nameValuePair.getName().equalsIgnoreCase("photo") || nameValuePair.getName().equalsIgnoreCase("bytes[photo]")) { File imgFile = new File(nameValuePair.getValue()); FileBody fileBody = new FileBody(imgFile, "image/jpeg"); multipartEntity.addPart("story[photo]", fileBody); } else { multipartEntity.addPart("story[" + nameValuePair.getName() + "]", new StringBody(nameValuePair.getValue())); } } httpPost.setEntity(multipartEntity); response = httpClient.execute(httpPost); And in response I got error Completed 500 Internal Server Error: "argumenterror invalid byte sequence in utf-8" How to resolve this error?
tagged with: utf-8
score: 1
favorite count: 0
tagged with: ruby
type: Question
upvote count: 2
tagged with: android
tagged with: ruby-on-rails
has answer: http://stackoverflow.com/a/23913978
has title: argumenterror invalid byte sequence in utf-8 error on Ruby server when uploading images from Android
tagged with: java
answer count: 1
downvote count: 1

http://stackoverflow.com/q/23928279
has title: Pulling data from the web with Android Java
tagged with: data-mining
answer count: 1
linked to: http://stackoverflow.com/q/6343166
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23928674
type: AnsweredQuestion
has body: So I'm fairly new to Java and programming with android in particular. I'm trying to create an app that pulls data from a financial website (perhaps one with an API if it makes it easier). The first step I tried was to just pull any text off a site. I'm currently practicing with a .txt URL and this is my code thus far: package com.example.datatesting; import java.io.IOException; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import org.apache.http.util.ByteArrayBuffer; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv = (TextView) findViewById(R.id.textView1); String myString = null; try{ URL myURL = new URL("http://www.something.com/readme.txt"); URLConnection connect= myURL.openConnection(); InputStream ins = connect.getInputStream(); BufferedInputStream buff = new BufferedInputStream(ins); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while( (current=buff.read()) !=-1){ baf.append( (byte) current); } myString = new String(baf.toByteArray()); tv.setText("hello1"); } catch(Exception e){ myString = e.getMessage(); tv.setText("hello2"); } } } The code prints "hello2". I'm not quite sure whats wrong or how to fix the issue so the try block works. I also added this into my manifest: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; I didn't get prompted for the app to allow internet access, is it automatic? Thanks for any help and guidance. ************Edit update: I added comments to indicate the areas of confusion public class MainActivity extends Activity { private TextView tv; private String myString = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activit…
linked to: http://stackoverflow.com/q/5150637
tagged with: web-scraping
accepted answer: http://stackoverflow.com/a/23928674
duplicate of: http://stackoverflow.com/q/5150637
type: Question
tagged with: java

http://stackoverflow.com/q/23865287
tagged with: xsl-fo
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am trying to use the font "Frankling Gothic Medium" in my pdf generation. But I seem not to be able to get it into java/FOP factory. I've tried without setting autoconfig. But Right now my config looks like this: "Error": 2014-05-26 09:39:53.577 WARN 7048 --- [nio-8080-exec-1] org.apache.fop.apps.FOUserAgent : Font "Franklin Gothic Medium,normal,400" not found. Substituting with "any,normal,400". 2014-05-26 09:39:53.623 WARN 7048 --- [nio-8080-exec-1] org.apache.fop.apps.FOUserAgent : Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400". 2014-05-26 09:39:53.623 WARN 7048 --- [nio-8080-exec-1] org.apache.fop.apps.FOUserAgent : Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400". 2014-05-26 09:39:53.625 WARN 7048 --- [nio-8080-exec-1] org.apache.fop.apps.FOUserAgent : Font "Franklin Gothic Medium,normal,700" not found. Substituting with "any,normal,700". XML: <auto-detect /> C:\workspace\pathToTTF JAVA: DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); URL dir_url = ClassLoader.getSystemResource("dk/print/services/mycfg.xml"); Configuration cfg = cfgBuilder.buildFromFile(new File(dir_url.toURI())); FopFactory fopFactory = FopFactory.newInstance(); FopFactoryConfigurator fopFacConf = new FopFactoryConfigurator(fopFactory); fopFacConf.setUserConfig(cfg); User user = userRepository.getUser(); String quoteXML = new PrintQuote(quote, user).asXML(); try { Fop fop = fopFactory.newFop("application/pdf", out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslt = new StreamSource(getClass().getResourceAsStream("quote.xsl")); Transformer transformer = factory.newTransformer(xslt); Source src = new StreamSource(IOUtils.toInputStream(quoteXML)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); } finally { // Clean-up IOUtils.closeQuietly(out); } XML suggested(translated to my font): <font-triplet name="Franklin Gothic Medium" style="normal…
tagged with: xslt
score: 4
has answer: http://stackoverflow.com/a/23865343
has title: XSL-FO fails to add font in java
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25252069
accepted answer: http://stackoverflow.com/a/23865343
tagged with: spring
possible better answer: http://stackoverflow.com/a/25252069

http://stackoverflow.com/comment/36633474
score: 0
type: Comment
has text: @LuiggiMendoza I figured the error was at `five.reverse()`. `five` is of type String
type: QuestionComment
comment on: http://stackoverflow.com/q/23813352

http://stackoverflow.com/q/23832934
has answer: http://stackoverflow.com/a/23833144
score: 1
tagged with: java
has title: How to download an xml layout file from a server and show the view at runtime in Android
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has body: I have an activity which i need to have dynamic content as its view. so i thought in downloading dynamic xml layout file from my server and assign it at runtime. consider the following idea: public class DynamicContentActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); donloadTheXmlFile(new dataListener() { @Override public void onSuccess(String data) { parseIntoXmlLayout(data, new xmlListener() { @Override public void onConvertedIntoView(View v) { setContentView(v); } }); } }); }; } is this possible? and how can i achieve this if possible?
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23833144
downvote count: 0
has comment: http://stackoverflow.com/comment/36670732
type: Question

http://stackoverflow.com/q/23875084
type: Question
tagged with: apache
has answer: http://stackoverflow.com/a/25690944
has comment: http://stackoverflow.com/comment/36751463
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/40153819
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36750796
type: UnansweredQuestion
has body: I followed this guide http://www.vogella.com/tutorials/REST/article.html but i'm stopped at the point 5.4 because when i start my application i'have this error: mag 26, 2014 7:11:09 PM org.apache.catalina.core.AprLifecycleListener init Informazioni: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/server;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Java\jre7\bin;C:\Program Files (x86)\Windows Live\Shared;%CATALINA_HOME%\bin;C:\Program Files\eclipse;;. mag 26, 2014 7:11:09 PM org.apache.tomcat.util.digester.SetPropertiesRule begin Avvertenza: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:de.vogella.jersey.first' did not find a matching property. mag 26, 2014 7:11:09 PM org.apache.coyote.AbstractProtocol init Informazioni: Initializing ProtocolHandler ["http-bio-8080"] mag 26, 2014 7:11:09 PM org.apache.coyote.AbstractProtocol init Informazioni: Initializing ProtocolHandler ["ajp-bio-8009"] mag 26, 2014 7:11:09 PM org.apache.catalina.startup.Catalina load Informazioni: Initialization processed in 1421 ms mag 26, 2014 7:11:10 PM org.apache.catalina.core.StandardService startInternal Informazioni: Starting service Catalina mag 26, 2014 7:11:10 PM org.apache.catalina.core.StandardEngine startInternal Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.54 mag 26, 2014 7:11:11 PM org.apache.catalina.loader.WebappClassLoader validateJarFile Informazioni: validateJarFile(C:\Users\p3pp0n5\Desktop\Programmazione\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\de.vogella.jersey.first\WEB-INF\lib\javax.servlet-api-3.0.1.jar…
has title: Tomcat 7 + Jersey + Eclipse
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/23803257
has comment: http://stackoverflow.com/comment/36622309
has comment: http://stackoverflow.com/comment/36615100
type: Answer
accepted answer of: http://stackoverflow.com/q/23802871
has comment: http://stackoverflow.com/comment/36629879
has comment: http://stackoverflow.com/comment/36619837
answers question: http://stackoverflow.com/q/23802871
upvote count: 1
has comment: http://stackoverflow.com/comment/36621284
has comment: http://stackoverflow.com/comment/36619875
has comment: http://stackoverflow.com/comment/36619210
score: 1
has comment: http://stackoverflow.com/comment/36620942
has comment: http://stackoverflow.com/comment/36615242
has comment: http://stackoverflow.com/comment/36621129
has body: You can save the Throwable used to create a thread in a thread local variable. public enum Throwables { ; private static final InheritableThreadLocal&lt;Throwable&gt; STARTING_THREAD = new InheritableThreadLocal&lt;&gt;(); public static void set(Throwable t) { STARTING_THREAD.set(t); } public static Throwable get() { return STARTING_THREAD.get(); } public static void printStartingThrowable() { Throwable throwable = get(); if (throwable == null) return; throwable.printStackTrace(); } public static Thread start(Runnable run, String name, boolean daemon) { Throwable tmp = new Throwable("Started here"); Thread t = new Thread(new Runnable() { @Override public void run() { set(tmp); run.run(); } }, name); t.setDaemon(daemon); t.start(); return t; } public static void main(String... ignored) { try { method(); } catch (Throwable t) { System.err.println("\nThrown in " + Thread.currentThread()); t.printStackTrace(); printStartingThrowable(); } start(new Runnable() { @Override public void run() { try { method(); } catch (Throwable t) { System.err.println("\nThrown in " + Thread.currentThread()); t.printStackTrace(); printStartingThrowable(); } } }, "Test thread", false); } private static void method() { throw new UnsupportedOperationException(); } } prints Thrown in Thread[main,5,main] java.lang.UnsupportedOperationException at Throwables.method(Throwables.java:59) at Throwables.main(Throwables.java:36) Thrown in Thread[Test thread,5,main] java.lang.UnsupportedOperationException at Throwables.method(Throwables.java:59) at Throwables.access$000(Throwables.java:1) at Throwables$2.run(Throwables.java:47) at Throwables$1.run(Throwables.java:26) at java.lang.Thread.run(Thread.java:744) java.lang.Throwable: Started here at Throwables.start(Throwables.java:21) at Throwables.main(Throwables.java:43)
has comment: http://stackoverflow.com/comment/36620571
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36623506
downvote count: 0
has comment: http://stackoverflow.com/comment/36619799

http://stackoverflow.com/comment/36797721
score: 0
has text: that's why it's converted to your timezone. Isn't it? What do you need? do you want to extract the timezone info from the input string as well.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23898855

http://stackoverflow.com/q/23788751
favorite count: 0
tagged with: fancybox
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36587124
has answer: http://stackoverflow.com/a/23791203
tagged with: java
has comment: http://stackoverflow.com/comment/36586860
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36587256
tagged with: javascript
score: -1
has comment: http://stackoverflow.com/comment/36587299
accepted answer: http://stackoverflow.com/a/23791203
upvote count: 0
has title: How to maintain Pause Button in fancybox
answer count: 1
has body: I would like to maintain pause button active when I click on autoplay button You can see it in JSfiddle: http://jsfiddle.net/v6hha $(document).ready(function () { $(".fancybox").fancybox({ openEffect: "elastic", openSpeed: 100, closeEffect: "elastic", closeSpeed: 100, prevEffect: "none", prevSpeed: 100, nextEffect: "none", nextSpeed: 100, minWidth: "130px", padding: 5, closeBtn: false, helpers: { title: { type: "inside", position: "top" }, overlay: { locked: false } }, afterLoad: function () { if (this.group.length > 1) { this.title = ' Рисунок ' + (this.index + 1) + " из " + this.group.length + (this.title ? " - " + this.title : "") } if (this.group.length Рисунок ' + (this.index + 1) + " из " + this.group.length + (this.title ? " - " + this.title : "") } }, afterShow: function () { $(".fancybox-wrap").easydrag(); var e; e = $("#fancybox-buttons").find(".btnPlay").removeClass("btnPlayOn"); if ($.fancybox.player.isActive) { e.addClass("btnPlayOn") } var t; t = $("#fancybox-buttons").find(".btnToggle").removeClass("btnDisabled btnToggleOn"); if (this.canShrink) { t.addClass("btnToggleOn") } else if (!this.canExpand) { t.addClass("btnDisabled") } }, onPlayStart: function () { $("#fancybox-buttons").find(".btnPlay").addClass("btnPlayOn") }, onPlayEnd: function () { $("#fancybox-buttons").find(".btnPlay").removeClass("btnPlayOn") }, onUpdate: function () { var e; e = $("#fancybox-buttons").find(".btnToggle").removeClass("btnDisabled btnToggleOn"); if (this.canShrink) { e.addClass("btnToggleOn") } else if (!this.canExpand) { e.addClass("btnDisabled") } } }) });
has comment: http://stackoverflow.com/comment/36588356
tagged with: jquery

http://stackoverflow.com/comment/36684114
type: Comment
type: QuestionComment
has text: More of the log would be helpful. CertFreeCTLContext was called by someone, somewhere, who may have passed in an invalid CTL_CONTEXT structure. I am not sure what you can do, if anything. If you have the source code for whats calling CertFreeCTLContext, that would be a good place to start. If not, file a bug report upstream.
score: 0
comment on: http://stackoverflow.com/q/23779451

http://stackoverflow.com/q/23820057
has comment: http://stackoverflow.com/comment/36646576
tagged with: java
has body: So, I want to have a scrollview on my layout. I did this and got a scroll view can only have one child : <?xml version="1.0" encoding="utf-8"?> <requestFocus /> Then, following the answer to this question java.lang.IllegalStateException: ScrollView can host only one direct child I did this: <?xml version="1.0" encoding="utf-8"?> <requestFocus /> but still no luck. Any ideas? Thanks.
tagged with: layout
has answer: http://stackoverflow.com/a/23820078
answer count: 1
downvote count: 0
score: 6
favorite count: 0
has title: A scroll view can have only one child Android XML file
tagged with: android
upvote count: 6
linked to: http://stackoverflow.com/q/20081217
tagged with: scrollview
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23820078
type: Question

synchronization
tags question: http://stackoverflow.com/q/23794084
tags question: http://stackoverflow.com/q/23791142
tags question: http://stackoverflow.com/q/23883684
tag name: synchronization
tags question: http://stackoverflow.com/q/23841232
type: Tag
tags question: http://stackoverflow.com/q/23800926
tags question: http://stackoverflow.com/q/23802924
tags question: http://stackoverflow.com/q/23885093
tags question: http://stackoverflow.com/q/23888166
tags question: http://stackoverflow.com/q/23782914
tags question: http://stackoverflow.com/q/23890294

http://stackoverflow.com/q/23850872
has answer: http://stackoverflow.com/a/23850920
tagged with: jpa
answer count: 2
tagged with: eclipselink
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23850920
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36705672
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36706272
has body: I am working on a basic JPA Setup with eclipselink. I have an entity which manages the amount in stock of an item. I want to keep track of the stock history of these items, so I want every update to the amount to also create a new history entry. The problem is when I add a new History entity to the history List in a @PreUpdate method it will not be persisted with the Wine entity. Adding the History entity manually before calling merge() or in a @PrePersist method works as expected. Following is my code: Wine.java @Entity public class Wine implements Serializable { @Id @GeneratedValue private long id; @Transient private int oldAmount; @Column private int amount; @OneToMany(mappedBy = "wine", cascade = CascadeType.ALL) private List&lt;AmountHistory&gt; history; //getters &amp; setters @PostLoad @PostUpdate @PostPersist private void onLoad() { oldAmount = amount; } @PrePersist private void onPersist() { final History history = new History(); history.setOldAmount(0); history.setNewAmount(amount); history.setWine(this); this.history = new ArrayList&lt;&gt;(); this.history.add(history); } @PreUpdate private void onUpdate() { if (oldAmount != amount) { final History history = new History(); history.setOldAmount(oldAmount); history.setNewAmount(amount); history.setWine(this); this.history.add(history); } } } History.java @Entity public class History implements Serializable { @Id @GeneratedValue private long id; @Column private int oldAmount; @Column private int newAmount; @ManyToOne(cascade = CascadeType.ALL) private Wine wine; //getters &amp; setters } I currently have a workaround by adding the History entry in the setter method for the amount, but I am not conviced by this solution because it also creates History entities when merge() is not called. What do i need to do to fix this problem? Or can somebody explain why this is happening?
type: Question
has title: EntityManager.merge() not persisting related entities
has answer: http://stackoverflow.com/a/23873672
accepted answer: http://stackoverflow.com/a/23873672

http://stackoverflow.com/comment/36666107
score: 0
type: QuestionComment
type: Comment
has text: and then:Exception in thread "main" java.lang.NullPointerException at IntakeSystem.collectSystem(IntakeSystem.java:37) at IntakeSystem.<init>(IntakeSystem.java:21) at IntakeSystem.main(IntakeSystem.java:70)
comment on: http://stackoverflow.com/q/23830434

http://stackoverflow.com/q/23839001
type: Question
answer count: 1
downvote count: 0
tagged with: pom.xml
tagged with: dependencies
favorite count: 0
has title: Maven ignoring provided scope for javax.mail
has body: I have a EAR with a number of EJB dependencies. 1 of these have a provided scope dependency: javax.mail mail 1.4 provided but inside the jar there is the jar mail-1.4.3.jar (I dependency i previously deleted) I've tried with: mvn eclipse:clean mvn dependency:tree mvn dependency:analyze-only but there is no way to get rid if this jar, that cause me a `java.lang.ClassCastException: javax.mail.Session cannot be cast to javax.mail.Session in the server Here the full pom.xml: <!-- ~ Copyright 2010-2012, CloudBees Inc. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> 4.0.0 localdomain.localhost myApp war 1.0.2-SNAPSHOT conFloorApp junit junit 4.8.1 test org.mockito mockito-all 1.8.4 org.springframework spring-test 3.2.8.RELEASE jar test javax.servlet javax.servlet-api 3.0.1 provided javax.servlet.jsp javax.servlet.jsp-api 2.2.1 provided javax.servlet.jsp.jstl javax.servlet.jsp.jstl-api 1.2.1 org.glassfish.web javax.servlet.jsp.jstl 1.2.2 javax.servlet.jsp.jstl jstl-api mysql mysql-connector-java 5.1.27 provided org.springframework spring-context 3.2.8.RELEASE org.springframework spring-core 3.2.8.RELEASE org.springframework spring-web 3.2.8.RELEASE org.springframework spring-webmvc 3.2.8.RELEASE org.springframework spring-orm 3.2.8.RELEASE com.oracle ojdbc6 11.2.0 org.hibernate hibernate-core 3.6.3.Final org.springframework spring-jdbc 3.2.8.RELEASE javassist javassist 3.12.1.GA c3p0 c3p0 0.8.4.5 cglib cglib 2.2 org.springframework.security spring-security-web 3.2.3.RELEASE org.spring…
tagged with: maven
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23840609
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23840609

http://stackoverflow.com/comment/36664317
type: QuestionComment
has text: Yep, inputField.getText() as the input works. So I'll ask a new question for the linebreaks.
type: Comment
comment on: http://stackoverflow.com/q/23816019
score: 0

http://stackoverflow.com/q/23828600
has answer: http://stackoverflow.com/a/52499717
has answer: http://stackoverflow.com/a/25865555
answer count: 3
score: 2
possible better answer: http://stackoverflow.com/a/25865933
downvote count: 0
has answer: http://stackoverflow.com/a/25865933
favorite count: 0
accepted answer: http://stackoverflow.com/a/25865555
has body: For a project that I working on, I am getting information in the form of GraphML format(I can change the graphML file as well) and I want to create the desired graph from that information, I am able to get the correct layout, with appropriate edges and nodes by using the mxGraphMlCodec.decode(doc, graph) method, but the generated graph lacks the additional information of edge labels as provided with the graphML file. I could not find any example of a graphML file which is converted in this way to a graph. I have just followed the guidelines for a graphML file as stated in the GraphML primer to create the graphML file. Here is the GraphML code: <?xml version="1.0" encoding="UTF-8"?> <key id="d1" for="edge" attr.name="edgeData" attr.type="double"/> <node id="0"/> 0.5 0.5 <node id="1"/> 0.5 0.5 <node id="2"/> 0.5 0.5 <node id="3"/> 0.5 0.5 <node id="4"/> 0.5 0.5 <node id="5"/> 0.5 0.5 <node id="6"/> 0.5 0.5 <node id="7"/> 1.0 <node id="8"/> 1.0 <node id="9"/> 1.0 <node id="10"/> 1.0 <node id="11"/> 1.0 <node id="12"/> 1.0 I am just modifying the ClickHandle.java file from the JGraphX examples folder in order to visualize the graph.
has title: Importing GraphML to create graph in JGraphX
tagged with: graphml
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: jgraphx
type: Question
tagged with: graph

http://stackoverflow.com/q/23865102
tagged with: mysql
upvote count: 1
has title: Resultset relative skips last record in Java/Access
answer count: 1
has answer: http://stackoverflow.com/a/23865368
has comment: http://stackoverflow.com/comment/36732928
has body: My Database : +---------+-----------+---------------+-------------------+---------------+-----------------+--------------------+ | KlantId | KlantNaam | KlantVoornaam | KlantAdres | KlantPostcode | KlantWoonplaats | KlantGeboorteDatum | +---------+-----------+---------------+-------------------+---------------+-----------------+--------------------+ | 1 | Vervoort | Dieter | Grootstraat 1 | 3500 | Hasselt | 1/01/1991 | | 2 | Droogmans | Jos | Kleine Laan 2 | 3500 | Hasselt | 5/05/1999 | | 3 | Severijns | Sarah | Brede Weg 3 | 3570 | Alken | 28/02/1972 | | 4 | Peeters | Piet | Rondplein 4 | 3600 | Genk | 6/08/1973 | | 5 | Vreemans | Veerle | Lange Boulevard 5 | 3500 | Hasselt | 4/04/1980 | +---------+-----------+---------------+-------------------+---------------+-----------------+--------------------+ My code where I read it : try { System.out.println("De klanten zijn:"); if (!rs.relative(1)) { rs.first(); } System.out.println("Naam en voornaam: " + rs.getString("KlantVoornaam") + " " + rs.getString("KlantNaam")); ShowMenu(); con.close(); } catch (SQLException e) { System.out.println(e.getMessage()); System.exit(0); } For some odd reason rs.relative(1) returns false on the 4th record ("Peeters Piet") while there is still one left ("Vreemans Veerle") and so it returns to the first record. Is this a mistake in rs.relative() or in my code? I know that I could do this with if (!rs.next()) { rs.first(); } But I'm wondering why rs.relative(1) doesn't do the same job.
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23865368
favorite count: 0
tagged with: resultset
type: Question
has comment: http://stackoverflow.com/comment/36732884
tagged with: java

http://stackoverflow.com/comment/76195658
type: AnswerComment
has text: With this example, it should be noted that using `ieq()` for case-insensitive comparison is probably the better approach than `like()` when comparing values like email or (user) names.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23803045

http://stackoverflow.com/comment/36782420
type: Comment
comment on: http://stackoverflow.com/a/23891390
score: 1
has text: @Nepoxx Although not my answer - yes, you need it. The only thing you can do is make all constructors no-argument, then you do not need to declare any of it at all (if they do nothing, of course).
type: AnswerComment

http://stackoverflow.com/comment/36634121
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23811133
type: Comment
has text: i have tried what you said. stored the value of id number into another new array and then inserted it in treemap. but the problem is still there. maybe what i did was wrong in prior to what you said. if u could just edit my program and send it to me id appreciate it much. thanks :D

http://stackoverflow.com/a/23892899
answers question: http://stackoverflow.com/q/23866385
score: 1
upvote count: 1
type: Answer
has body: A workaround for the explained problem is using _JAVA_OPTIONS as environment variable within jenkins as it is presented in the question. It will affect all Java processes started by jenkins which might lead to other problems. Hopefully the next Java or Hosteurope VPS update solves the issue completly.
downvote count: 0

http://stackoverflow.com/comment/36889375
type: Comment
comment on: http://stackoverflow.com/a/23932508
has text: looks like what i'm already doing, unless you mean to put the resource in a different path within the archive to distinguish it from the other archive's resource...
type: AnswerComment
score: 0

http://stackoverflow.com/q/23904731
possible better answer: http://stackoverflow.com/a/23908988
upvote count: 3
tagged with: java
has body: I want to make a round rectangle JTextField. I write a sub class of AbstractBorder to realize it.But I run into some problems. My requirement is: What I get is: My code is : import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.Graphics; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.AbstractBorder; import javax.swing.border.EmptyBorder; public class JTextFieldTest { JTextField textField; boolean activate = false; public void createUI(){ JFrame frame = new JFrame("Test JTextField"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(true); MainPanel mainPanel = new MainPanel(); frame.add(mainPanel,BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { JTextFieldTest jTextFieldTest = new JTextFieldTest(); jTextFieldTest.createUI(); } @SuppressWarnings("serial") class MainPanel extends JPanel{ public MainPanel(){ textField = new JTextField("Please input:"); Font fieldFont = new Font("Arial", Font.PLAIN, 20); textField.setFont(fieldFont); textField.setBackground(Color.white); textField.setForeground(Color.gray.brighter()); textField.setColumns(30); textField.setBorder(BorderFactory.createCompoundBorder(new CustomeBorder(), new EmptyBorder(new Insets(10, 20, 10, 20)))); textField.addActionListener(new FieldListener()); textField.addMouseListener(new FieldMouseListener()); add(textField,BorderLayout.CENTER); setBackground(Color.blue); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); } } @SuppressWarnings("serial") class CustomeBorder extends AbstractBorder{ @Override public void paintBorder(Component c, Graphics g, int x, int y, int …
tagged with: jtextfield
has title: How to make a Round Rectangle JTextField?
type: Question
has comment: http://stackoverflow.com/comment/36808622
tagged with: awt
accepted answer: http://stackoverflow.com/a/23904845
answer count: 3
has comment: http://stackoverflow.com/comment/36808399
downvote count: 0
has answer: http://stackoverflow.com/a/23905408
favorite count: 0
has answer: http://stackoverflow.com/a/23908988
tagged with: swing
has comment: http://stackoverflow.com/comment/36808559
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23904845

http://stackoverflow.com/a/23842227
accepted answer of: http://stackoverflow.com/q/23842156
answers question: http://stackoverflow.com/q/23842156
has comment: http://stackoverflow.com/comment/36688919
type: AcceptedAnswer
score: 0
type: Answer
has body: Try this Leg first = journey.iterator().next(); If you need other legs then Iterator&lt;Leg&gt; i = journey.iterator(); Leg first = i.next(); Leg second = i.next(); ...

http://stackoverflow.com/comment/36709145
has text: @minipif Yes, launchFrames was indeed null and I now know why. Refer to my comment above. Thank you very much.
comment on: http://stackoverflow.com/q/23846723
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23875709
has comment: http://stackoverflow.com/comment/36753621
score: 3
has comment: http://stackoverflow.com/comment/36752152
has body: Instead of explicitly opening the transaction you could allow the framework to handle the transaction (like in spring you can use the @transactional). But if not it looks like the code has a begin and a commit in case it is successful, try adding a tr.rollback() in the persist method using a finally (or you could even check whether the transaction is still active using the tr.isActive() method.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36753769
type: Answer
has comment: http://stackoverflow.com/comment/36753079
accepted answer of: http://stackoverflow.com/q/23875206
answers question: http://stackoverflow.com/q/23875206
upvote count: 3
has comment: http://stackoverflow.com/comment/36760487

http://stackoverflow.com/comment/36757974
type: AnswerComment
type: Comment
has text: @djechlin I think TeoTN made the point. If I inherited methodTwo() from the parent. I don't need to use super. use super.methodTwo is the same as using methodTwo.
comment on: http://stackoverflow.com/a/23878513
score: 0

http://stackoverflow.com/comment/36588325
has text: I'm using netbeans, so I think I don't need this?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23789485
type: Comment

http://stackoverflow.com/comment/36742352
has text: @AmitPrajapati I need html source code in my string object. you can hit the url in browser and check that it is working fine on browser but on code it is giving an error
comment on: http://stackoverflow.com/q/23870408
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36681695
comment on: http://stackoverflow.com/a/23838281
score: 0
type: Comment
has text: @Braj If you have to ask questions about this stuff you shouldn't be answering them as well. Ask your own question.
type: AnswerComment

http://stackoverflow.com/q/23862147
answer count: 1
downvote count: 1
tagged with: events
tagged with: action
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36727521
upvote count: 0
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/23862193
tagged with: awt
has comment: http://stackoverflow.com/comment/36727496
has title: Action listener and action event
has body: Can any one explain for me why do we pass item1, 2, 3 and passwordField to another class (the handler) through an object? And what is getsource? And get command? And why do we create a string here? thehandler handler =new thehandler(); item1.addActionListener(handler); item2.addActionListener(handler); item3.addActionListener(handler); passwordField.addActionListener(handler); thehandler private class thehandler implements ActionListener{ public void actionPerformed(ActionEvent event){ String string=""; if(event.getSource()==item1) string=String.format("field 1: %s",event.getActionCommand()); else if(event.getSource()==item2) string=String.format("field 2: %s",event.getActionCommand()); else if(event.getSource()==item3) string=String.format("field 3: %s",event.getActionCommand()); else if (event.getSource()==passwordField) string=String.format("passwordField: %s",event.getActionCommand()); JOptionPane.showMessageDialog(null,string); } }

http://stackoverflow.com/q/23871694
has answer: http://stackoverflow.com/a/35939290
has answer: http://stackoverflow.com/a/23871854
has answer: http://stackoverflow.com/a/54949744
linked to: http://stackoverflow.com/q/18507067
type: Question
upvote count: 41
has comment: http://stackoverflow.com/comment/36746193
has comment: http://stackoverflow.com/comment/36744733
has title: java properties to json
has answer: http://stackoverflow.com/a/45544016
has comment: http://stackoverflow.com/comment/36746068
has answer: http://stackoverflow.com/a/25178183
has answer: http://stackoverflow.com/a/23871914
has comment: http://stackoverflow.com/comment/56882349
has answer: http://stackoverflow.com/a/23872438
answer count: 10
has answer: http://stackoverflow.com/a/53566146
favorite count: 0
type: UnansweredQuestion
has body: Is there an easy way to convert properties with dot notation to json I.E server.host=foo.bar server.port=1234 TO { "server": { "host": "foo.bar", "port": 1234 } }
has comment: http://stackoverflow.com/comment/36746070
has answer: http://stackoverflow.com/a/38751431
has comment: http://stackoverflow.com/comment/36746245
tagged with: properties
score: 41
downvote count: 0
has answer: http://stackoverflow.com/a/63347902
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23785359
accepted answer: http://stackoverflow.com/a/23800112
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23800112
tagged with: java
type: Question
tagged with: jasper-reports
has body: I have a textField and an image field side by side on a sub-report I want to shift the contents of text field horizontally if there is no image. I want to shift textField in place of image if there is no image.
has comment: http://stackoverflow.com/comment/36605440
has comment: http://stackoverflow.com/comment/36590846
has title: Remove horizontal empty space
score: 0
answer count: 1

http://stackoverflow.com/a/23881675
has body: A objectA=new B(); is not dependency injection. Spring must create B and inject it, e.g. ... @Autowired A a; ...
score: 0
answers question: http://stackoverflow.com/q/23881592
type: Answer

http://stackoverflow.com/comment/36767607
score: 0
has text: facility button is not functioning
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23883683

http://stackoverflow.com/q/23825482
favorite count: 0
tagged with: combinatorics
has body: Is there a java api which I can use for a permutation of numbers to find out canonical form of its equivalence classes ? It is required for all possible guesses for Mastermind. As per the document . EDIT :Let me explain by example what I am looking for Example : In order to solve the game of in minimum steps we have to give our guesses and based on the response decide the next guess . Lets say for 4 pegs and 6 colors ( total combination = 1296 , repeat allowed ) . For the initial try we only need to consider one possible guess lets say 0011 and the response we get is 1 Black and 0 White.(1,0). Now, We check 0011 against all the 1296 numbers and keep all those which return (1,0). Thus, our solution is somewhere inside this reduced sample set. Now for the second query using equivalence transformations as mentioned in the document possible codes are reduced for second try. Now, I want to know if there an any existing java api which I can use for a given set of permutations ( reduced set after (0,1) on 1296 ) and get equivalence transformations on my inputs ? Thanks In Advance.
has comment: http://stackoverflow.com/comment/36662729
has comment: http://stackoverflow.com/comment/36662530
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23831859
has comment: http://stackoverflow.com/comment/36658521
tagged with: java
has title: Is there a java api which I can use for a permutation of numbers to find out canonical form of its equivalence classes?
tagged with: equivalence-classes
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36668426
upvote count: 1
answer count: 1
downvote count: 1
tagged with: permutation

http://stackoverflow.com/comment/36604162
comment on: http://stackoverflow.com/q/23797794
score: 1
has text: @MadProgrammer You think right. But then, only a *sub-set* of the HTML 3.2 elements (e.g. no applet or JS support). While a simple web browser could well do without applet support, 'no JS' is a killer..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36755607
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23877330
score: 0
has text: after some research i understand that "exif unique id" is unique for every photo (timestamp + camera serial encrypted) so i don't think it's a great start if you need to know if it's taken by this device. You could start to work on camera serial and timestamp and maybe a way to read it and decrypt it. What a great question which could let you search around internet for hours... My experience with Android Camera API is limited so i don't know if you can read serial number (if any?)

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/23869267
type: Tag
tags question: http://stackoverflow.com/q/23897736
tags question: http://stackoverflow.com/q/23857505
tags question: http://stackoverflow.com/q/23842896

http://stackoverflow.com/comment/36661944
type: AnswerComment
comment on: http://stackoverflow.com/a/23818017
type: Comment
has text: You can't use a pure wildcard type for a variable (i.e. something like `CanQuack & CanWalk duckLike;` is invalid), you can only use them in type parameters. Thus this allows us to emulate the type alias, i.e. using different object fitting the type restrictions.
score: 0

http://stackoverflow.com/comment/36745442
has text: You can use Apache CXF implementation of JAX-RS which supports Spring. There probably will not be any code changes.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23792749
type: QuestionComment

http://stackoverflow.com/q/23817619
has comment: http://stackoverflow.com/comment/36655668
favorite count: 0
accepted answer: http://stackoverflow.com/a/23826892
possible better answer: http://stackoverflow.com/a/23817678
has comment: http://stackoverflow.com/comment/36656786
tagged with: resultset
has answer: http://stackoverflow.com/a/23817678
tagged with: jdbc
downvote count: 1
has title: MySQL ResultSet scrollable/updatable not working as expected
has comment: http://stackoverflow.com/comment/36655786
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: scroll
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36786195
has answer: http://stackoverflow.com/a/23826892
upvote count: 5
has comment: http://stackoverflow.com/comment/36786031
has body: I have a test JDBC program that tries to alter the Scrollability and Updatability features of a ResultSet. Unfortunately, all the combinations of TYPE_ and CONCUR_ seem to produce the same result (TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY). Even with the default (TYPE_FORWARD_ONLY) it's possible to scroll through the ResultSet. Can anyone explain why this is? I am using MySQL 5.6 and JDK7. Here is the code: public class ResultSetTest3 { public static void main(String[] args) { Connection conn; try { conn = DriverManager.getConnection("jdbc:mysql://localhost/bd", "user", "password"); Statement sta = conn.createStatement(); sta.execute("DELETE FROM test"); sta.close(); PreparedStatement ps = conn.prepareStatement("INSERT INTO test VALUES(?, ?)"); for(int i=1; i&lt;=100; i++) { ps.setInt(1, i); ps.setString(2, "Teste " + i); ps.addBatch(); } ps.executeBatch(); ps.close(); System.out.println("TYPE_FORWARD_ONLY CONCUR_READ_ONLY"); result(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); System.out.println("==================================="); System.out.println("TYPE_SCROLL_INSENSITIVE CONCUR_READ_ONLY"); result(conn, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); System.out.println("==================================="); System.out.println("TYPE_SCROLL_SENSITIVE CONCUR_READ_ONLY"); result(conn, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); System.out.println("==================================="); System.out.println("TYPE_FORWARD_ONLY CONCUR_UPDATABLE"); result(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); System.out.println("==================================="); System.out.println("TYPE_SCROLL_INSENSITIVE CONCUR_UPDATABLE"); result(conn, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); System.out.println("==================================="); System.out.println("TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE"); result(conn, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); System…

http://stackoverflow.com/a/23892377
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23891170
has body: You have to use MDC(Mapped Diagnostic Context) for doing such things. I believe you have a web application; You can configure a servlet filter which reads the IP address and user id from the servlet request and dumps it in MDC. Then your logger automatically picks this value and prints it in all the logged lines. You can refer http://www.javacodegeeks.com/2013/01/effective-logging-in-javajee-mapped-diagnostic-context.html and http://logback.qos.ch/manual/mdc.html to get an understanding of MDC
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36815007
upvote count: 1
has comment: http://stackoverflow.com/comment/36822407
has comment: http://stackoverflow.com/comment/37019134
answers question: http://stackoverflow.com/q/23891170

http://stackoverflow.com/a/23832605
answers question: http://stackoverflow.com/q/23823470
has body: I am almost positive that your problem is that you put your controlling code in the Runner instead of your Bug's act method. When GridWorld steps all it does is call each Actor's act method, so if your Actor has an unpopulated method it will just call the parent, or do nothing. Your runner, since it is not an 'Actor' has no act method, and after the first run is never looked at again. Try this in your MazeBug: public void act() { java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new java.awt.KeyEventDispatcher() { public boolean dispatchKeyEvent(java.awt.event.KeyEvent event) { String key = javax.swing.KeyStroke.getKeyStrokeForEvent(event).toString(); if (key.equals("w")) forward(); if (key.equals("d")) turnRight(); if (key.equals("a")) turnLeft(); return true; } }); } Note: I have never used EventListeners so can't help with that code.
score: 0
type: Answer

nexus
type: Tag
tags question: http://stackoverflow.com/q/23894887
tag name: nexus

http://stackoverflow.com/q/23908993
has body: I know this has been asked many times but i really can't get a working solution. Many keyboards and mouses have been trown thanks to this problem... >:( I have a @ManyToOne / @OneToMany Relation: One "Service" has one and only "ServiceType", one "ServiceType" can be associated to many "Service". problem 1): In the form where i can insert a new Service (created with thymeleaf) i have a "select" which allows me to select its "ServiceType" (each "option" has as a value the ServiceType.id). When i submit the form , i get the conversion error: Failed to convert property value of type java.lang.String to required type com.lethal.ServiceType for property serviceType; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.lethal.ServiceType] for property serviceType: no matching editors or conversion strategy found Ok,i read on StackOverflow that i need a converter. I did this: package com.lethal.converter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; import com.lethal.model.ServiceType; import com.lethal.service.ServiceTypeService; //the second "Service" word refers to the interface with all add/edit/delete/get.. methods.. @Component final class StringToServiceType implements Converter&lt;String, ServiceType&gt; { /** * dependancy injection of the service */ @Autowired private ServiceTypeService ServiceTypeService; @Override public ServiceType convert(String id) { /** * check integer type */ try { Integer.parseInt(id); /** * creation of the object to return */ ServiceType service_type = ServiceTypeService.getServiceType(Integer.valueOf(id)); return service_type; } catch(NumberFormatException e) { System.out.println(e); return null; } } } problem 2) everywhere i try to import StringToServiceType, i get the error the type com.lethal.converter.StringToServiceType is not visible ok...…
type: Question
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23915662
score: 0
has comment: http://stackoverflow.com/comment/36821005
answer count: 1
has comment: http://stackoverflow.com/comment/36816981
linked to: http://stackoverflow.com/q/11273443
has title: Add conversion service String to MyObject using java notation (Spring + Hibernate)
tagged with: spring
has answer: http://stackoverflow.com/a/23915662
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36816228

http://stackoverflow.com/q/23852838
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36760028
has comment: http://stackoverflow.com/comment/36709336
has comment: http://stackoverflow.com/comment/36734541
type: UnansweredQuestion
tagged with: javasound
has title: Clip Play + volumeControl = a Pop
has answer: http://stackoverflow.com/a/23876358
score: 1
tagged with: java
has body: I have searched and searched, and have not found the cause of my problem. Setting: I am trying to play a list of clips in sequence indefinitely till the GUI of the program tells to stop. Also, the user can adjust the volume while the clips are being played. Let's say I have clips A, B and C. The sequence of play will be ABCABCABCABC..... Problem: The problem is that the first time clips A, B and C start - there are POPs - after that for the GUI tells to stop, there are no POPs. Code: In the run() method of the thread, get all filenames of the clips, create all clips and save them in a LinkedHashSet. Next, play these clips in loop, creating the volume control object for each. My Observation: The offending lines are commented (with // TODO: UNCOMMENT ME!!!!!) With the commented lines, there are no POPs, but the volume control is disabled. When these lines are uncommented, the POPs return. Question: Where am I going wrong? I don't have any hair on the head to pull out! :) private LinkedHashSet&lt;Clip&gt; clips = new LinkedHashSet&lt;Clip&gt;(); private FloatControl volControl = null; . . . . @Override public void run() { List&lt;String&gt; fileNames = smd.getFiles(); if ( !(numFiles.isEmpty()) ) { try { // Create all clips and save in LinkedHashSet // for (String s: fileNames) { clips.add(CreateClip(s)); } // Play each clip till GUI says to stop // while (smd.getStopPlayStatus()) { for (Clip c: clips) { // Calculate and set the clip volume to what GUI says // float dB = (float) (Math.log(smd.getSwarMVolume()/100f) / Math.log(10.0) * 80.0); System.out.println(" vol = " + volumeLevel/100f + " || dB = " + dB); Control[ ] ctls = c.getControls(); for (Control ctl : ctls) { if (ctl.toString().toLowerCase().contains("master gain")) { volControl = (FloatControl) ctl; break; } } // volControl.setValue(dB); // TODO: UNCOMMENT ME!!!!!!!! // Play the clip // loop(c, 0); } } } catch (ConcurrentModificationException ex) { } } } void loop(Clip clip, int times){ if (times == -1) { cl…
has comment: http://stackoverflow.com/comment/36709266
upvote count: 1

http://stackoverflow.com/q/23856248
downvote count: 0
has comment: http://stackoverflow.com/comment/36715927
has comment: http://stackoverflow.com/comment/36715693
has title: error: cannot find symbol resultset
type: Question
has comment: http://stackoverflow.com/comment/36715834
has comment: http://stackoverflow.com/comment/36715702
tagged with: jena
has comment: http://stackoverflow.com/comment/36718673
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23856633
accepted answer: http://stackoverflow.com/a/23856633
has body: I am really stuck at this...I am trying to convert Result Set into string and this is my code : QueryExecution qExec = QueryExecutionFactory.create(s, ds) ; ResultSet rs = qExec.execSelect() ; //String x=rs.toString(); String[] arr = null; while (rs.next()) { String em = (String)rs.getString(0); arr = em.split("\n"); for (int i =0; i &lt; arr.length; i++){ subjectoutput.setText(arr[i]); } } and it gives error: JavaApplication2.java:137: error: incompatible types while (rs.next()) { ^ required: boolean found: QuerySolution JavaApplication2.java:138: error: cannot find symbol String em = (String)rs.getString(0); ^ symbol: method getString(int) location: variable rs of type ResultSet 2 errors my query result is this: ---------------------------- | x ================================================ | &lt;&lt;SEMA-CR-3-4MHV9RJ@bounce.oracle-mail.com&gt;&gt; | ------------------------------------------------
upvote count: 1
has comment: http://stackoverflow.com/comment/36715779
answer count: 1
favorite count: 0
tagged with: sparql
type: AnsweredQuestion

http://stackoverflow.com/q/23832759
has body: I have added @Enableauditng as an annotation but @version is not incrementing the version on its own. I have @LastModifiedDate, which is being updated but not the @version. Am i doing somehting wrong. I am calling mongoTemplate.save(object) to againg and again. Please advice
tagged with: java
has title: @Version is not being incremented in Spring mongo
upvote count: 4
answer count: 2
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/35468430
tagged with: spring-mongo
favorite count: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/23837841
accepted answer: http://stackoverflow.com/a/23837841
type: AnsweredQuestion
tagged with: spring
possible better answer: http://stackoverflow.com/a/35468430
type: Question
has comment: http://stackoverflow.com/comment/36716178

http://stackoverflow.com/comment/36692616
has text: @user3649116 Did you not copy and paste your code directly into your question? In any event, double-check the spacing in the connection string that your Java code is using.
comment on: http://stackoverflow.com/a/23844303
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23834496
has comment: http://stackoverflow.com/comment/36673817
type: AnsweredQuestion
score: -5
tagged with: java
has answer: http://stackoverflow.com/a/23834573
has comment: http://stackoverflow.com/comment/36674333
type: Question
upvote count: 0
tagged with: arrays
answer count: 1
downvote count: 5
has body: I need to define specific numbers out of an array of 52 numbers so I can assign them an image (yes I am creating an applet). I don't think that code is necessary for any of you to answer this question. Any help would be fantastic.
favorite count: 0
accepted answer: http://stackoverflow.com/a/23834573
has title: How to access a specific array element in java
has comment: http://stackoverflow.com/comment/36673754
linked to: http://stackoverflow.com/q/9060170

http://stackoverflow.com/comment/36786559
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23867415
has text: In preferences "Google" is not available. How to get that.
type: AnswerComment

http://stackoverflow.com/a/23829226
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23828902
has comment: http://stackoverflow.com/comment/133399725
upvote count: 1
has body: Think of an Object as an object, like an apple or a toothbrush. class Circle is a defintion of an Object; it's a description that attempts to match reality. The predefined Java Object is like anything you might find in reality, you can't call eat() on an Object (in the real world) because it might be an apple, but it might be a toothbrush (or a circle). Therefore, place the code where it makes sense as if it were a real world object. You want to retrieve user input. Does a circle know how to read user input? No! You call your other class CircleTest. But what it really is, is CircleCreationApplication; that might be a better name for it. In an application that creates circles, you would receive user input. So that is where the code can go. Once you have your user input, you can use that to create the circle. package circle; public class CircleCreationApplication { public static void main(String[] args) { Circle myCircle; Scanner userInput = new Scanner(System.in); System.out.println("Please enter radius"); int radius = userInput.nextInt(); myCircle = new Circle(radius, 3.14159); System.out.println("Circle radius is " + myCircle.getRadius()); System.out.println("Circle diameter is " + myCircle.calculateDiameter()); System.out.println("Circle circumference is " + myCircle.calculateCircumference()); System.out.println("Circle area is " + myCircle.calculateArea()); userInput.close(); } } Note: @ratchetfreak's answer has some other good things. Please read that as well

http://stackoverflow.com/a/23933691
has comment: http://stackoverflow.com/comment/36862235
has body: Use split method String string = "Julie Resnekov#212#32#90#63.2#62.5"; String[] parts = string.split("#"); for(String part : parts){ System.out.println(part); }
score: 0
has comment: http://stackoverflow.com/comment/36862419
type: Answer
answers question: http://stackoverflow.com/q/23933643

http://stackoverflow.com/q/23815982
tagged with: google-app-engine
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/23816335
has body: I'm trying to make a Client for my restlet server deployed on Google App Engine. By following this tutorial : http://www.tutos-android.com/webservice-rest-android-appengine-restlet-objectify I was able to do an Android client. Can I port it to a "Fat Client" ? (I just copyed/pasted the code but it seems not working) What is the difference between an Android Client and "Fat Client" (I hope this is the good term in english) ? It seems like I'm sending a Null object (server side : nullpointerexception while parsing). PS : I'm using Objectify 4 Framework on the restlet server. Thank's for your responses ! :) ERRATUM : I didn't mean "Fat client", with @Baalthasarr 's answer I can understand that I said something wrong. Both of Swing client i'm trying to make and Android client are "THIN client", they only communicate with the server to get some datas.. The question is : Is there a difference to make those clients to communication with the server ? (the android client works perfectly)
has title: Difference Android client / Thin client
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23816099
tagged with: restlet
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23816099
has answer: http://stackoverflow.com/a/23816335
tagged with: objectify
type: Question

http://stackoverflow.com/q/23828708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36662786
has comment: http://stackoverflow.com/comment/36662996
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/36663184
has comment: http://stackoverflow.com/comment/36662956
type: Question
has title: Checking if file two directories up and two directories down exists
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36663235
has body: So consider this code: public boolean exists(String path) { return new File(path).exists(); } Now let's say the jar executing this code is \home\program1\jars\checker.jar Now let's suppose there is a text file \home\program2\texts\test.txt How can I check if that text file exists using my checker.jar in the other directory without knowing the absolute path? Would exists("\\..\\..\\program2\\texts\\text.txt") work? Help would be really appreciated (:
tagged with: exists
has comment: http://stackoverflow.com/comment/36662723
has comment: http://stackoverflow.com/comment/36663058
has answer: http://stackoverflow.com/a/23829239
accepted answer: http://stackoverflow.com/a/23829239

http://stackoverflow.com/comment/36692939
has text: yes indeed that's silly but in the confusion of getting errors no matter what I did, I "tried" that. cyph3r and your comment got me back on the simple solution.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23842969

http://stackoverflow.com/comment/36780079
type: Comment
type: QuestionComment
score: 1
has text: Try `java -cp "/path/to/commons-math.jar" Test`
comment on: http://stackoverflow.com/q/23890212

http://stackoverflow.com/a/23863116
type: Answer
upvote count: 1
has body: To enforce memory safety, Java ensures that a variable of reference type actually contains a reference to an object of that type (or a subtype thereof). A cast instruction could violate this invariant, i.e. we can write: Object o = new Integer(42); String s = (String) o; // compiles, but throws ClassCastException at runtime To prevent this, a cast instruction will check the type of the object referred to, and throw a ClassCastException if it is not. Prior to the introduction of generics into the Java language, the above held for all casts. However, generics being implemented with type erasure, the runtime does not know which class a type parameter stands for, and therefore can not perform this check if a type parameter is involved. And that's why the spec distinguishes between a checked cast (which will only succeed at runtime if it is type correct), and an unchecked cast (which might succeed even if not type correct, resulting in heap pollution, and likely a type error at a later time). For instance: class C&lt;T&gt; { final T field; C(Object o) { this.field = (T) o; // unchecked. Will never throw a ClassCastException. } } boolean test() { C&lt;String&gt; c = new C&lt;String&gt;(42); return c.field.startsWith("hello"); // throws ClassCastException, even though there is no cast in the source code at this line! } That is, unchecked casts can be unsafe, and should be avoided. With that background, it is easy to see that a reflective cast (the Class.cast() method) is checked, because they actually implement the check in the method itself: public T cast(Object obj) { if (obj != null &amp;&amp; !isInstance(obj)) throw new ClassCastException(cannotCastMsg(obj)); return (T) obj; } And that safety net is why a reflective cast is preferred to an ordinary cast when the cast involves a type parameter.
has comment: http://stackoverflow.com/comment/36729436
has comment: http://stackoverflow.com/comment/36744626
has comment: http://stackoverflow.com/comment/36747897
score: 1
has comment: http://stackoverflow.com/comment/36729956
has comment: http://stackoverflow.com/comment/36747397
answers question: http://stackoverflow.com/q/23862790
downvote count: 0
has comment: http://stackoverflow.com/comment/36747959

http://stackoverflow.com/comment/40046598
type: Comment
has text: It looks like closing the `S3Object` is the same as closing the stream returned by `getObjectContent()`. Setting `ClientConfiguration` is an excellent idea. Often, though, I get other errors like "cannot find host s3.amazonaws.com," even when running on EC2. O.o
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25629886

http://stackoverflow.com/comment/42685749
type: Comment
has text: SuperCSVParser is set up to also handle TSV files. It worked perfectly once I had the number of columns correct.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27086925

http://stackoverflow.com/a/23843998
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23843921
has comment: http://stackoverflow.com/comment/36692076
answers question: http://stackoverflow.com/q/23843921
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: The whole idea is to make sure that the number of each letter that's in s is equal to the number of each letter that's in t. You do this by counting up how many of each letter is in s, then counting down again, for each time each letter occurs in t. The letters array does this - each entry in the array represents one character that might occur, any number of times, in each of s and t. For example, if s is "AABC" and t is "BCAA", then after the first for loop, the letters array will contain 2 for element A, 1 for element B and 1 for element C. After the second for loop, these have all been decremented back down to 0. Since you've already checked that s and t have the same length, if they're not made up of exactly the same letters, there will be SOME letter that occurs more times in t than in s. When you get to that letter, decrementing the corresponding value in letters will result in a negative count, so you return false. Conversely, if s and t have exactly the same letters, there is no letter that occurs more times in t than in s, so you never get to the line that says return false; - so you end up returning true.
score: 2

http://stackoverflow.com/a/23907349
answers question: http://stackoverflow.com/q/23906609
has body: The answer is: yes there are many different ways to pull data from websites. There are essentially 2 alternatives no matter the programming language (Java, .NET, Perl...): the website has an API: in this case it will be a REST or SOAP API or perhaps a custom one (REST and SOAP probably account for the vast majority). Check out that website's API documentation if any. Also check out Programmable Web for references. the website doesn't have an API. You then need to do what you call here as screen-scraping. Essentially you will send a series of HTTP GET or HTTP POST requests as your browser would. The server replies with a response which contains HTML code. From there on, you need to "parse" the HTML to extract the information you need. This will require heavy duty XPath (if the content is XML) or regular expressions (if the content is HTML or text). Look at Apache HTTP Components to get you started. If all you want is Finance information, Google has a JSON/REST API for that and there's a question on SO that will help you: How can I get stock quotes using Google Finance API?. Yahoo also has one and there is also already an question on it in SO: Yahoo Finance All Currencies quote API Documentation
type: Answer
has comment: http://stackoverflow.com/comment/78718281
accepted answer of: http://stackoverflow.com/q/23906609
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36668725
score: 0
type: Comment
type: AnswerComment
has text: @PM77-1 I didn't mean to call you out, I could tell by your q. that it isn't prod, but I usually have a disclaimer like that in my answers as SOP on S.F. because some people...
comment on: http://stackoverflow.com/a/23831698

http://stackoverflow.com/a/23857743
has comment: http://stackoverflow.com/comment/36718872
has comment: http://stackoverflow.com/comment/36718903
has comment: http://stackoverflow.com/comment/36718734
type: Answer
has comment: http://stackoverflow.com/comment/36718665
has comment: http://stackoverflow.com/comment/36718955
has comment: http://stackoverflow.com/comment/36718723
has body: You simply forgot to escape the (). s.matches("\\s*\\w*\\(\"\\w*\"\\)\\s*"); Un-escaped, they were acting as a capturing group.
score: 3
has comment: http://stackoverflow.com/comment/36719121
has comment: http://stackoverflow.com/comment/36719001
has comment: http://stackoverflow.com/comment/36718977
upvote count: 3
answers question: http://stackoverflow.com/q/23857701
has comment: http://stackoverflow.com/comment/36718929
accepted answer of: http://stackoverflow.com/q/23857701
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23859883
upvote count: 1
has comment: http://stackoverflow.com/comment/36723101
accepted answer of: http://stackoverflow.com/q/23859803
score: 1
answers question: http://stackoverflow.com/q/23859803
has comment: http://stackoverflow.com/comment/36723062
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36722985
has body: The gc() method javadoc states Calling this method suggests that the Java virtual machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. There is no guarantee that it will run the GC in either case.
has comment: http://stackoverflow.com/comment/36722979

http://stackoverflow.com/comment/36758634
comment on: http://stackoverflow.com/q/23878823
score: 0
type: Comment
type: QuestionComment
has text: keep in mind when writing web applets that this kind of application is "invented" to run on many computers via internet. With this said, code, written by you, can run in any computer on this planet. That means that if you include some malicious I/O commands in your code (delete file commands for example), they would run in a computer just by "seeing" the html that embeds your applet, and do some damage. So, java designers, to ensure that this thing won't happen almost disabled I/O from applets. You can perfectly use I/O with swing or awt applications but not applets...

http://stackoverflow.com/q/23904560
has title: Could not connect to SMTP host: 10.0.1.9, port: 80, response: -1 when sending email through java
has comment: http://stackoverflow.com/comment/36808337
has comment: http://stackoverflow.com/comment/36809196
has body: i am trying to send email through java code.. but exception raises.. i dont know where i am going wrong.. sending it through my company network.. public class SendingMail{ public static void main(String[] args) { final String username = "xyz@company.com"; final String password = "********"; Properties props = new Properties(); props.put("mail.smtp.user", "xyz@company.com"); props.put("mail.smtp.password", "********"); props.put("mail.smtp.protocol", "smtp"); props.put("mail.smtp.host", "10.0.1.9"); props.put("mail.smtp.port", "80"); props.put("mail.smtp.starttls.enable","false"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.socketFactory.port", "80"); props.put("mail.smtp.socketFactory.class", ""); props.put("mail.smtp.socketFactory.fallback", "false"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("dpaleti@avineonindia.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("abc@company.com")); message.setSubject("Testing Subject"); message.setText("Dear Mail Crawler," + "\n\n No spam to my email, please!"); Transport.send(message); System.out.println("Done"); } catch (MessagingException mex) { mex.printStackTrace(); } } } Exception Stack Trace is: javax.mail.MessagingException: Could not connect to SMTP host: 10.0.1.9, port: 80, response: -1 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156) at javax.mail.Service.connect(Service.java:105) at javax.mail.Transport.send0(Transport.java:168) at javax.mail.Transport.send(Transport.java:98) at com.ex.mails.SendingMail.main(SendingMail.java:48) i checked in teln…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23905010
has comment: http://stackoverflow.com/comment/36808132
has comment: http://stackoverflow.com/comment/36808167
has comment: http://stackoverflow.com/comment/36808137
type: Question
answer count: 1
tagged with: smtp
has comment: http://stackoverflow.com/comment/36808072
score: 0
has comment: http://stackoverflow.com/comment/36808513
tagged with: email
has comment: http://stackoverflow.com/comment/36808634
has comment: http://stackoverflow.com/comment/36809216
has answer: http://stackoverflow.com/a/23905010
linked to: http://stackoverflow.com/q/18764088

http://stackoverflow.com/comment/36605124
type: Comment
comment on: http://stackoverflow.com/q/23798274
score: 0
has text: @DavidWallace forget it.
type: QuestionComment

http://stackoverflow.com/q/23911911
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/23912317
has body: Given the following query: CREATE (versionNode:Version {previousVersions: [4,3,2,1]}) RETURN versionNode.previousVersions AS versions how can I end up with a Collection&lt;Long&gt; from an ExecutionResult? AFAIK, the Node#getProperty() method can only return primitive types, so I cannot use that. Is it possible?
accepted answer: http://stackoverflow.com/a/23912317
has title: How do I extract a Collection from an ExecutionResult in Java?
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
tagged with: cypher

http://stackoverflow.com/a/23802256
answers question: http://stackoverflow.com/q/23802043
score: 0
type: Answer
has body: You can use string in java 1.7 only as Der Golem specified. You can use enum, char, int types. You can refer http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html for more info. From the above link Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer (discussed in Numbers and Strings).

http://stackoverflow.com/a/23795037
has body: In C here is one way to do it: // use an array, not a bunch of separate variables int the_numbers[NUM_NUMBERS]; // here we assume you have filled in the numbers and validated // that they are all in the range 0-9 bool duplicate_found = false; bool seen[10] = { 0 }; for (int ii = 0; ii &lt; NUM_NUMBERS; ++ii) if ( seen[ the_numbers[ii] ]++ ) { duplicate_found = true; break; } The postfix-++ is a shortcut way of writing that we want to break out if it is already set; and we want to increment it if it is not already set (and we don't care if we also increment it when it was already set.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23794575
answers question: http://stackoverflow.com/q/23794575
score: 0
type: Answer

http://stackoverflow.com/a/23839153
has body: How are you searching for this object? For example: FindElement(By.Id(""); I ran into an issue that sounded identical to this, and a workaround was using an alternate "By." to find the element on the page. It sounds silly, and really doesn't explain the cause of the issue, but that fixed this for me. Alternatively, have you tried using an explicit wait for a moment after the control visually appears, to make sure the code is not trying to grab the element before it actually is visible?
answers question: http://stackoverflow.com/q/23833592
has comment: http://stackoverflow.com/comment/36975641
type: Answer
has comment: http://stackoverflow.com/comment/36966754
score: 0

http://stackoverflow.com/q/23851320
score: 1
tagged with: java
tagged with: lwjgl
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23851414
answer count: 1
has body: I am wondering if I can make my piece of work smarter. I have 2 classes: Enemy class(the superclass of any enemy): package com.joetannoury.game.entity.enemy; /** * Enemy's superclass! * * @author Joe Tannoury */ public abstract class Enemy { public Enemy(int EnemyID, float x, float y) { } public abstract void update(int delta); public abstract void render(); } An enemy class(a subclass of enemy): package com.joetannoury.game.entity.enemy; import java.util.ArrayList; /** * This is an subclass of Enemy! * * @author Joe Tannoury */ public class E0 extends Enemy { private ArrayList&lt;Float&gt; x = new ArrayList&lt;&gt;(); private ArrayList&lt;Float&gt; y = new ArrayList&lt;&gt;(); private ArrayList&lt;Float&gt; rotation = new ArrayList&lt;&gt;(); private boolean firstEnemy = false; public E0(float x, float y) { super(0, x, y); this.x.add(x); this.y.add(y); this.rotation.add(0.0f); } @Override public void update(int delta) { if(firstEnemy) { for(int i = 0; i &gt; x.size(); i++) { } } } @Override public void render() { if(firstEnemy) { for(int i = 0; i &gt; x.size(); i++) { } } } } So, my question is, can I do something in the superclass so I dont need to setup the for() loop again and again in the subclasses? I dont really understand the meaning of an abstract class so if you think it shouldnt be can you be so nice and tell me why? :D Anyway, thank you.
favorite count: 0
has title: Making an superclass with methods in it
accepted answer: http://stackoverflow.com/a/23851414
tagged with: subclass
tagged with: superclass
type: AnsweredQuestion

http://stackoverflow.com/comment/36768684
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23884180
has text: And where is the GUI retrace?
score: 0

http://stackoverflow.com/q/23921449
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23921567
score: 1
has title: Some SQL functions don't work in HQL
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/36842718
answer count: 1
downvote count: 0
has body: The following sql is valid when I run it directly on PostgreSql as well as in HQL in Hibernate: sql = "update Address set city = upper(city)" HQL: session.createQuery(sql).executeUpdate() However, when I try to use sql function left(String, number) as follows: sql = "update Address set city = left(city,7)" It runs fine directly on PostgreSql, but throw this exception in Hibernate: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: left near line 1 I have the dialect set correctly as: props.put("hibernate.dialect", PostgreSQLDialect.class.getName()); How can I get HQL to behave the same as SQL? Why does the "upper" function work, but not the "left" function?
accepted answer: http://stackoverflow.com/a/23921567
tagged with: sql-server
tagged with: postgresql
tagged with: sql
favorite count: 0
upvote count: 1

http://stackoverflow.com/a/23938933
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23936870
answers question: http://stackoverflow.com/q/23936870
type: AcceptedAnswer
downvote count: 0
has body: The mapping for the page element is probably on an @XmlElementDecl annotation on the generated ObjectFactory class. You could change your JAXBContext creation to the following to pick that up: JAXBContext context = JAXBContext.newInstance(org.xwiki.rest.model.jaxb.ObjectFactory.class); Or you could just create the JAXBContext on the package name of the generated model: JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb"); UPDATE Thanks, that helped a little. Now i get Exception in thread "main" java.lang.ClassCastException: javax.xml.bind.JAXBElement cannot be cast to org.xwiki.rest.model.jaxb.Page. The result you get when the root is annotated with @XmlElementDecl instead of @XmlRootElement is an instance of JAXBElement that contains an instance of the domain class. You can do the following: JAXBElement&lt;Page&gt; jaxbElement = (JAXBElement&lt;Page&gt;) unmarshaller.unmarshal(is); Page page = jaxbElement.getValue(); Or: Page page = (Page) JAXBIntrospector.getValue(unmarshaller.unmarshal(is)); For More Information I have written more about this particular use case on my blog: http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html
has comment: http://stackoverflow.com/comment/36876287
type: Answer

http://stackoverflow.com/comment/36587471
type: AnswerComment
score: 0
type: Comment
has text: yes, your are right man, i created second thread wishing to execute the run method of the first thread. Thanks.
comment on: http://stackoverflow.com/a/23789046

http://stackoverflow.com/comment/36650617
score: 2
has text: You'd have to ask the designers, I assume they didn't feel the need for it ;)
type: Comment
comment on: http://stackoverflow.com/q/23822206
type: QuestionComment

http://stackoverflow.com/a/23924028
type: Answer
has comment: http://stackoverflow.com/comment/36851696
score: 0
has body: How about following change? Channel channel = sesConnection.openChannel("exec"); ((ChannelExec) channel).setCommand(command); InputStream commandOutput = channel.getInputStream();//tr channel.connect(); //InputStream commandOutput = channel.getInputStream();//tr int readByte = commandOutput.read();
answers question: http://stackoverflow.com/q/23913234

http://stackoverflow.com/comment/36800007
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23899006
has text: It sems I even cant create the animation.. i tried just to create it but not starting it but no luck.. if comment out the create I will se the layout etc..

http://stackoverflow.com/comment/36857325
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23930870
type: Comment
has text: mam here controller means application name to which i am submitting

http://stackoverflow.com/a/23878644
downvote count: 0
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23878620
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23878620
type: Answer
has body: The boolean parameter of the 3-arg version of LayoutInflater.inflate() determines whether the LayoutInflater will add the inflated view to the specified container. For fragments, you should specify false because the Fragment itself will add the returned View to the container. If you pass true or use the 2-arg method, the LayoutInflater will add the view to the container, then the Fragment will try to do so again later, which results in the IllegalStateException.

http://stackoverflow.com/a/23782045
answers question: http://stackoverflow.com/q/23780135
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23780135
type: Answer
has comment: http://stackoverflow.com/comment/36582314
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36589319
has body: You can model the association as a separate Association entity. The temporal data can be modelled as regular Date attributes (as @Temporal(TemporalType.TIMESTAMP)). You can model the PK of an association as the composition of the foreign keys of Entity_1 and Entity_2 - this would make the association a dependent entity. Or you can assign it an own id and connect to Entity_1 and Entity_2 via ManyToOne relationships. EDIT: The bulk of my example implementation is shamelessly stolen from @Vlad's answer, since the main difference is that an entity has an id and is queryable while an embeddable is not. I have removed @Column(updatable=false) from the Date columns, because I am not sure that this is required and added @Temporal(TemporalType.TIMESTAMP) because it is required by the JPA spec and thus increases portability. Since this is a bidirectional mapping, I use mappedBy on the inverse side (the entities) instead of JoinColumn on the owning side (the association). @Entity public class Association { @Id @GeneratedValue(...) private Long id; @Column @Temporal(TemporalType.TIMESTAMP) private Date affectation; @Column @Temporal(TemporalType.TIMESTAMP) private Date expiration; @ManyToOne(fetch=FetchType.LAZY) private Entity1 entity1; @ManyToOne(fetch=FetchType.LAZY) private Entity2 entity2; } Entity1 and Entity2 look the same, just replace the digit. I am not sure about the added value of using the Set interface, so I replaced it with List, but perhaps I am missing something. public class Entity1 { @OneToMany(mappedBy="entity1") private List&lt;Association&gt; associations = new ArrayList&lt;Association&gt;(); ... }
upvote count: 1
has comment: http://stackoverflow.com/comment/36586527

http://stackoverflow.com/comment/36701510
type: Comment
type: QuestionComment
score: 0
has text: I hadn't even thought of using anything else. I'm still just trying to learn my way around Swing. I though with it being such a simple grid game, it should work. And now that I've started it, I really want to figure out what is wrong so I can avoid the problem next time I use Swing for anything.
comment on: http://stackoverflow.com/q/23848756

http://stackoverflow.com/comment/36813881
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23907758
has text: Why not use JPasswordField ?

http://stackoverflow.com/q/23931718
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23936400
score: 2
upvote count: 2
tagged with: artifactory
has comment: http://stackoverflow.com/comment/37019370
tagged with: maven
type: Question
has title: Deploying Maven artifacts from Artifactory to WebLogic12c
tagged with: weblogic12c
tagged with: java
has comment: http://stackoverflow.com/comment/36860541
has body: I am trying to deploy Maven artifacts from Artifactory to WebLogic12c, I did deploy to Artifactory, but not sure how they are getting deployed to the appserver. I tried to use Weblogic Maven Plugin for that, without success. What I am trying to achieve is automatic deployment, i.e. when a new artifact is deployed to Artifactory, it should be deployed to WebLogic too.
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23937334
favorite count: 0
has comment: http://stackoverflow.com/comment/37086751
has comment: http://stackoverflow.com/comment/36864794

twitter
tags question: http://stackoverflow.com/q/23826716
tags question: http://stackoverflow.com/q/23827690
tags question: http://stackoverflow.com/q/23864958
type: Tag
tag name: twitter
tags question: http://stackoverflow.com/q/23828051

http://stackoverflow.com/q/23837339
score: 2
tagged with: glassfish-3
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23838015
type: Question
has title: getResourceAsStream in a static block sometimes returns null
tagged with: glassfish
has comment: http://stackoverflow.com/comment/36679517
downvote count: 0
answer count: 1
has body: I have some code that does this at the top of a class: static { ... mapper.addMappingConfig(ModelRestMapper.class.getResourceAsStream("/com/mycompany/myapp/rest/dozer/mapping/mapping.xml")); ... } This code sometimes fails with this exception: [#|2014-05-23T12:21:33.111-0700|SEVERE|glassfish3.1.2|org.dozer.loader.xml.MappingStreamReader|_ThreadID=305;_ThreadName=Thread-2;|Error while loading dozer mapping InputStream: [null] java.lang.IllegalArgumentException: InputStream cannot be null at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117) at org.dozer.loader.xml.MappingStreamReader.read(MappingStreamReader.java:50) at org.dozer.DozerBeanMapper.addMapping(DozerBeanMapper.java:247) at com.mycompany.commons.objectmapping.Mapper.addMappingConfig(Mapper.java:62) at com.mycompany.myapp.rest.dozer.mapping.ModelRestMapper.&lt;clinit&gt;(ModelRestMapper.java:30) //the line I showed you at sun.misc.Unsafe.ensureClassInitialized(Native Method) at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43) at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140) at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1057) at java.lang.reflect.Field.getFieldAccessor(Field.java:1038) at java.lang.reflect.Field.set(Field.java:741) at org.glassfish.web.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1836) at org.glassfish.web.loader.WebappClassLoader.stop(WebappClassLoader.java:1662) at org.glassfish.web.loader.WebappClassLoader.preDestroy(WebappClassLoader.java:1631) at org.glassfish.javaee.full.deployment.EarClassLoader.preDestroy(EarClassLoader.java:91) at org.glassfish.deployment.common.DeploymentContextImpl.preDestroy(DeploymentContextImpl.java:151) at com.sun.enterprise.v3.server.ApplicationLifecycle$1.actOn(ApplicationLifecycle.java:281) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:465) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(A…
favorite count: 0
tagged with: classloader
type: UnansweredQuestion

http://stackoverflow.com/comment/36708854
comment on: http://stackoverflow.com/q/23835559
score: 0
type: Comment
type: QuestionComment
has text: BTW - one hack/work-around is `label.setBorder(new EmptyBorder(8, 0, 0, 0));`..

http://stackoverflow.com/comment/36860541
type: Comment
has text: Not sure what you meant by "migrate". Do you want to deploy Artifactory in WebLogic or use WebLogic instead of Artifactory?
score: 0
comment on: http://stackoverflow.com/q/23931718
type: QuestionComment

http://stackoverflow.com/q/23875435
tagged with: swing
has body: I dont know much about java. I wrote this code in JTree but when I run the program JTree just shows the last fList. Is there anything tha I can add to the code so that JTree display all of them? JTreeCode is another class in the same package. File fList[] = File.listRoots(); for(int i = 0; i &lt; fList.length; i++) { jTree1.setModel(new JTreeCode(fList[i])); }
tagged with: defaulttreemodel
score: 0
tagged with: java
type: Question
tagged with: jtree
has title: JTree display issue
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23875584

http://stackoverflow.com/q/23868148
upvote count: 1
has answer: http://stackoverflow.com/a/23925808
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36887187
has body: This is my piece of code to create java calendar object in Node.js using node-java module. var java = require("java"); java.classpath.push("commons-lang3-3.1.jar"); java.classpath.push("commons-io.jar"); java.classpath.push("common-util.jar"); var vehId = java.newInstanceSync("java.lang.Integer", 922); var lattitude = java.newInstanceSync("java.lang.Double", 8.6717136); var longitude = java.newInstanceSync("java.lang.Double", 76.8168311); var time= ''; var Calendar = java.newInstance("java.util.Calendar", function(err, result) { if(err) { console.log('Error: '+err); return; } else { console.log("Result: "+result); time = Calendar.getInstance(); } }); var args = { vehicleId : vehId, lat : lattitude, lan : longitude, packetTime : time }; console.log(args); This is the error got when tried to execute the program. Error: Could not find method "java.util.Calendar()" on class "class java.util.Calendar". No methods with that name. Couldn't create calendar object using java.newInstance() or java.newInstanceSync() functions.
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23925808
score: 1
tagged with: node-java
has comment: http://stackoverflow.com/comment/36762784
has title: Not able to create java calendar object in Node.js using java utilities in node.js
tagged with: node.js
favorite count: 0

http://stackoverflow.com/comment/36710861
type: Comment
has text: Nevermind, you said you were doing it interactively. I'm not sure how you'd mimic the EOF behavior then... does typing Alt-0 produce ^D? Is that a Windows thing? Just curious.
comment on: http://stackoverflow.com/a/23853367
score: 0
type: AnswerComment

http://stackoverflow.com/q/23879766
has comment: http://stackoverflow.com/comment/36760299
accepted answer: http://stackoverflow.com/a/23879889
type: AnsweredQuestion
tagged with: java
tagged with: quartz-scheduler
type: Question
has title: Unable to execute Quartz Simple Trigger Tutorial
has answer: http://stackoverflow.com/a/33677519
has body: Hi i have tried for two days to run this code example from Quartz Scheduler simple trigger. This example show a code to run a schedule job for every two days but my compiler return error Tutorial site http://quartz-scheduler.org/documentation/quartz-2.2.x/cookbook/BiDailyTrigger Trigger trigger = TriggerBuilder //error: non-static method withIdentity(String,String) cannot be referenced from a static .withIdentity("trigger3", "group1") .startAt(tomorrowAt(15, 0, 0) .withSchedule(simpleSchedule() //error:cannot find symbol: method withSchedule(SimpleScheduleBuilder) .withIntervalInHours(2 * 24) // interval is actually set at 48 hours' worth of milliseconds .repeatForever()) .build()); is there any of good folk here can help me point out what is my mistake. Really appreciate your help.
score: 0
possible better answer: http://stackoverflow.com/a/33677519
answer count: 2
has comment: http://stackoverflow.com/comment/36760547
has answer: http://stackoverflow.com/a/23879889

http://stackoverflow.com/a/23829980
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36666569
accepted answer of: http://stackoverflow.com/q/23829935
has comment: http://stackoverflow.com/comment/36665862
has comment: http://stackoverflow.com/comment/36679316
answers question: http://stackoverflow.com/q/23829935
type: Answer
has comment: http://stackoverflow.com/comment/36667255
upvote count: 3
has body: public Scene onLoadScene(float PosX,float PosY) {//PosX,PosY is float you can take as per your choice this.mScene = new Scene(); spritePic1.setPosition((int)PosX- textRegPic1.getWidth()/2,(int) PosY- textRegPic1.getHeight()/2); return this.mScene; } For calling function onLoadScene(PosX,PosY)
score: 3

http://stackoverflow.com/comment/36760199
comment on: http://stackoverflow.com/a/23879457
type: AnswerComment
has text: It is not working and coming up with compiling error `; expected` ?
score: 0
type: Comment

http://stackoverflow.com/comment/36999801
type: QuestionComment
has text: In local it wont try to connect to localhost. May be you are trying in pseudo distributed mode. Try running with bsp.master.address set to local rather than localhost in hama-site.xml
score: 1
comment on: http://stackoverflow.com/q/23912772
type: Comment

http://stackoverflow.com/q/23829520
answer count: 0
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36667946
tagged with: digital-signature
has comment: http://stackoverflow.com/comment/36748879
has body: I'm building a digital signature module that must conform to EU digital signature directives. I'm starting from an old but well-working Java module to sign documents in CAdES format. Also, the application is made by a client (desktop JAR executable) and a server part. The client has been developed only to interact with smart card that is connected to a USB reader, the rest happens on the web server. Current signing clients support two ways of signing and timestamping a file: I can use "Sign and timestamp" function or I can first sign a document and then timestamp it. From the legal point of view, both produce the same result. My question is: from the techincal point of view, is it correct to state that when I sign a document with CAdES (RFC 5126, 140 pages I haven't been able to read all) the output file is the same both when I use a combined "sign and timestamp" function or use the two functions in sequence? Let me rephrase: is it not possible according to the standard to have an enclosure that both represents a digital signature and a timestamp? Does the standard require to timestamp the signed document or vice versa? What I want to achieve is to sign the document on client side (using smartcard) and then timestamping the file on server (without touching old client code) and producing the same exact result as if I was signing and timestamping a file on the client.
upvote count: 2
tagged with: trusted-timestamp
has title: Signing and timestamping at the same time VS signing and timestamping later
tagged with: java
has comment: http://stackoverflow.com/comment/36668068
tagged with: pkcs#11
has comment: http://stackoverflow.com/comment/36752808
score: 2

http://stackoverflow.com/comment/36873027
comment on: http://stackoverflow.com/q/23939330
type: Comment
type: QuestionComment
has text: Infinite loop/NoLoop+Semicolon missing.
score: 0

http://stackoverflow.com/a/34654115
has body: Same problem here. Changing return type of my reader to the real implementation and adding to the reader implements ItemStream Did the trick for me
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23847661

http://stackoverflow.com/comment/36760260
comment on: http://stackoverflow.com/q/23879732
score: 5
has text: I would personally go for a `switch`
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36593657
score: 0
has text: I've added code, sorry guys, thought that it's not necessary for this question.
comment on: http://stackoverflow.com/q/23779340
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23827282
tagged with: bufferedreader
has title: Buffredreader read next line
favorite count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23827333
upvote count: 1
type: Question
tagged with: java
has body: how would i go about reading the next line using a buffered reader. I am currently reader each line, but would like to read the next line whilst reading the current line. this is my code while ((line = br.readLine()) != null) { } Thanks
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23911606
has comment: http://stackoverflow.com/comment/36821434
has comment: http://stackoverflow.com/comment/36838962
has body: Try this query: select u from Utilisateur u left join u.projets p where p is null or p.statut like 'Completed'" See this, you need to join before use a attribute. The difference between join and left join is that left join get all Utilisateur, include the ones that dont have a project. Change is empty for is null, now, in my local test works well!, see this gist for a complete example!.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23910328
has comment: http://stackoverflow.com/comment/36837272
answers question: http://stackoverflow.com/q/23910328
type: Answer

http://stackoverflow.com/comment/36853775
type: QuestionComment
type: Comment
has text: I'm using jna.jar and jvlc-core.jar and here is snippet String[] arg = new String[4]; arg[0] = "--intf=dummy"; arg[1] = "--ignore-config"; arg[2] = "--no-plugins-cache"; arg[3] = "--plugin-path=plugins"; this.jvlc = new JVLC(arg);
score: 0
comment on: http://stackoverflow.com/q/23928774

http://stackoverflow.com/comment/36609531
has text: Any specific versions of the JDK which goes with tomcat 6.0.35
comment on: http://stackoverflow.com/a/23799813
score: 0
type: AnswerComment
type: Comment

memory-management
tags question: http://stackoverflow.com/q/23819452
tags question: http://stackoverflow.com/q/23860364
tags question: http://stackoverflow.com/q/23858623
tags question: http://stackoverflow.com/q/23795071
tags question: http://stackoverflow.com/q/23917326
type: Tag
tags question: http://stackoverflow.com/q/23812429
tag name: memory-management
tags question: http://stackoverflow.com/q/23939270
tags question: http://stackoverflow.com/q/23809553

http://stackoverflow.com/comment/36767285
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23823463
has text: @Duncan : Can you kindly respond to my edits? :)
score: 0

http://stackoverflow.com/q/23910858
tagged with: java
has body: Let's say I have a Camel route that looks like this : from("direct:myRoute") .setHeader("someHeader", simple("some header value")) .beanRef("myBean", "beanMethod"); And I have a bean that I cannot change that looks like this : public class MyBean { public void beanMethod(String headerExpected) { // do something with the value here. } } Basically, I want to pass the value of someHeader from myRoute to beanMethod within MyBean. Knowing that beanMethod can accept a String, how can I pass the value of the header someHeader from the route so that it is accepted as a String within beanMethod?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/68629077
tagged with: apache-camel
has title: Camel - Passing specific parameters from routes to a generic bean method
tagged with: spring-bean
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23911871
possible better answer: http://stackoverflow.com/a/68629077
tagged with: spring
score: 14
has answer: http://stackoverflow.com/a/23911871
tagged with: parameters
type: AnsweredQuestion
upvote count: 14

http://stackoverflow.com/comment/36691699
comment on: http://stackoverflow.com/q/23843934
type: Comment
type: QuestionComment
score: 1
has text: If you added a `private Foo() {}` to your first example they would be equivalent.

http://stackoverflow.com/comment/36794041
type: AnswerComment
comment on: http://stackoverflow.com/a/23896834
type: Comment
has text: @Scott Updated, check if it helps you
score: 0

http://stackoverflow.com/comment/36828870
comment on: http://stackoverflow.com/a/23915520
type: Comment
has text: NO, another error: Exit Value = 2 syntax error The source line is 1. The error context is {print >>> \ <<< "1\" $0} awk: The statement cannot be correctly parsed. The source line is 1.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23919568
type: Question
downvote count: 0
tagged with: jackson
tagged with: rest
has title: JAX-RS JsonIngore multiple endpoints
tagged with: jax-rs
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: How can I achieve to suppress certain fields based on endpoints? @JsonIngore a field suppresses totally. For instance: Class A () { int id; String name; List list; } @Path("endpoint1") public class Resource1 { private A a; ... } @Path("endpoint2") public class Resource2 { private A a; ... } Now, in endpoint1, I want to show list of B, but not in endpoint2. Since I couldn't answer my question due to the reputation, I just post the solution here, using @JsonView. public interface View { public interface Public {}; public interface Endpoint1 extends Public {}; } Class A () { int id; String name; @JsonView(View.Endpoint1.class) List list; } @Path("endpoint1") public class Resource1 { private A a; ... @GET @JsonView(View.Endpoint1.class) @Produces({"application/json"}) public A generate() { ... } } @Path("endpoint2") public class Resource2 { private A a; ... } For more information, check http://wiki.fasterxml.com/JacksonJsonViews

http://stackoverflow.com/a/23823412
type: Answer
answers question: http://stackoverflow.com/q/23823172
has comment: http://stackoverflow.com/comment/36659568
has body: Try c.add(Calendar.DAY_OF_MONTH, -(c.get(Calendar.DAY_OF_MONTH)));
has comment: http://stackoverflow.com/comment/36660105
has comment: http://stackoverflow.com/comment/36659005
score: 0
has comment: http://stackoverflow.com/comment/36659116
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36659661
has comment: http://stackoverflow.com/comment/36659683
accepted answer of: http://stackoverflow.com/q/23823172

http://stackoverflow.com/comment/36745624
type: Comment
comment on: http://stackoverflow.com/q/23871498
score: 1
has text: You can use list as a model attribute
type: QuestionComment

http://stackoverflow.com/comment/36731999
comment on: http://stackoverflow.com/q/23851845
type: Comment
type: QuestionComment
has text: Itachi meant: you CANNOT covert MenuItem to Node ....
score: 0

char
tags question: http://stackoverflow.com/q/23923730
type: Tag
tags question: http://stackoverflow.com/q/23856703
tags question: http://stackoverflow.com/q/23846028
tags question: http://stackoverflow.com/q/23827140
tag name: char
tags question: http://stackoverflow.com/q/23869606

http://stackoverflow.com/q/23851143
favorite count: 0
has answer: http://stackoverflow.com/a/23853344
downvote count: 0
has title: How to write a custom tag to read and print arraylist?
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
upvote count: 2
answer count: 1
tagged with: jsp
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23853344
has body: I am new to jsp custom tags. What I wanted is print ArrayList in my jsp page by using a custom tag. My custom tag's .tld file is below, HotelDetails it.testproject.custom.HotelDetails JSP id true true java.lang.String hotelArray true true java.util.ArrayList Here I have used attribute to get arraylist. and I can access it in the jsp page. My tag handler class is looks like, package it.testproject.custom; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.BodyTagSupport; public class HotelDetails extends BodyTagSupport { private static final long serialVersionUID = 1141701851233089895L; private Hotel hotel; private ArrayList<Hotel> hotelArray; City regionCity; Iterator<Hotel> it; public ArrayList<Hotel> getHotelArray() { return hotelArray; } public void setHotelArray( ArrayList<Hotel> hotelArray ) { this.hotelArray = hotelArray; it=hotelArray.iterator(); System.out.println( "[HotelDetails] Hotels : " + hotelArray.size() ); } @Override public int doStartTag() throws JspException { hotel=it.next(); pageContext.setAttribute( "hotelName", hotel.getName() ); pageContext.setAttribute( "hotelDesc", hotel.getDescription() ); pageContext.setAttribute( "hotelRating", hotel.getStarRating() ); pageContext.setAttribute( "defaultPrice", hotel.getTotalPriceWithTax() ); System.out.println(hotel.getName()+" "+hotel.getStarRating()); // pageContext.setAttribute( "hotelDesc", hotel.getDescription() ); // pageContext.setAttribute( "hotelRating", hotel.getStarRating() ); // pageContext.setAttribute( "hotelMainImage", hotelImageBase + hotel.getMainImage().getImageURL() ); return EVAL_BODY_INCLUDE; } } I have returned EVAL_BODY_INCLUDE and it gets only one result. I saw in some posts about EVAL_PAGE to call doStartTag() automatically. I tried, but no results. Please help.

http://stackoverflow.com/q/23903842
favorite count: 0
has title: Unable to import certificate to cacerts
score: 35
has body: My requirement is to import a certificate for maven repositories into the global keystore. The certificate file is named maven-cacert.cer . I am using following command from C:\Program Files\Java\jdk1.6.0_20\bin\ from cmd keytool -importcert -trustcacerts -alias c:\maven-cacert.cer -file c:\maven-cacert.cer.der -keystore $JAVA_HOME\jre\lib\security\cacerts as maven-cacert.cer file is in C directory after pressing enter it asked to put password and after giving password it is saying like keytool error: java.io.FileNotFoundException: $JAVA_HOME\jre\lib\security\cacerts (The system cannot find the path specified I also tried keytool -importcert -trustcacerts -alias c:\maven-cacert.cer -file c:\maven- cacert.cer.der -keystore \usr\java/jdk1.6.0_20/bin/java\jre\lib\security\cacerts but getting same output Please help what is going wrong with my command while cacerts file is inside $JAVA_HOME\jre\lib\security\ directory.
has comment: http://stackoverflow.com/comment/36806830
has answer: http://stackoverflow.com/a/69192349
answer count: 7
has answer: http://stackoverflow.com/a/37087141
possible better answer: http://stackoverflow.com/a/61123205
has answer: http://stackoverflow.com/a/61123205
accepted answer: http://stackoverflow.com/a/23903907
has answer: http://stackoverflow.com/a/33885953
tagged with: authentication
downvote count: 1
has answer: http://stackoverflow.com/a/23904100
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23904111
has comment: http://stackoverflow.com/comment/36806790
upvote count: 36
has comment: http://stackoverflow.com/comment/36806732
has answer: http://stackoverflow.com/a/23903907
tagged with: keytool

http://stackoverflow.com/q/23871234
favorite count: 0
has body: I have an audio file with all id3 tags as null. I want to extract the acoustic fingerprint and with an online service to get the id3 tags. How can I do that in Java? Is there an online service who I can pass the audio fingerprint and it return the tags?
possible better answer: http://stackoverflow.com/a/23877104
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has title: How to get audio tags using audio fingerprint
type: Question
has answer: http://stackoverflow.com/a/23877104
tagged with: audio-fingerprinting
has answer: http://stackoverflow.com/a/23887332
answer count: 2
accepted answer: http://stackoverflow.com/a/23887332
downvote count: 0

http://stackoverflow.com/a/23830303
has body: If there are not only two subtypes, then the visitor pattern would be suitable. Consider: interface Result { // resut of the implementation public &lt;T&gt; T accept(Visitor&lt;T&gt; visitor); } class Success implements Result { @Override public &lt;T&gt; T accept(Visitor&lt;T&gt; visitor) { return visitor.visit(this); } } class Failure implements Result { @Override public &lt;T&gt; T accept(Visitor&lt;T&gt; visitor) { return visitor.visit(this); } } Then create a visitor class: interface Visitor&lt;T&gt; { T visit(Failure failure); T visit(Success success); } Then where you would use instanceof: Result result = ...; // this could be something else, with a different template parameter. String visitorResult = result.accept(new Visitor&lt;String&gt;() { @Override public String visit(Failure failure) { return "Failure visited"; } @Override public String visit(Success success) { return "Success visited"; } }); This is only my idea of implementation, with generics you can add more customizable features. If you want to read more about this: http://en.wikipedia.org/wiki/Visitor_pattern
answers question: http://stackoverflow.com/q/23829926
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23883355
score: 0
has comment: http://stackoverflow.com/comment/36767103
answers question: http://stackoverflow.com/q/23883106
type: Answer
has comment: http://stackoverflow.com/comment/36767484
has body: The library was provided during the compile, but it's not present at runtime. Your application is trying to invoke a method from library which is not present.

http://stackoverflow.com/q/23917084
has title: How to expand or pass in variables to persistence.xml
type: Question
tagged with: jpa
answer count: 1
tagged with: glassfish
score: 0
type: UnansweredQuestion
has body: I have two Glassfish servers each running an instance of my app. I want to enable cache coordination between them. In order to do this I need to configuration cache coordination in my persistence.xml file. The trouble is that value for the eclipselink.cache.coordination.rmi.url property needs to reference the box on which the app is running i.e., rmi://myserver1:8686/ I thought perhaps that persistence.xml could expand system properties but it seems that it can’t. My JVM options contain: -DCOORDINATION_RMI_URL=rmi://myserver1:8686 My persistence.xml file contains the following: &lt;property name="eclipselink.cache.coordination.rmi.url" value="${COORDINATION_RMI_URL}" /&gt; &lt;property name="eclipselink.session.customizer" value="com.foobar.conf.CacheCoordinationSessionCustomizer"/&gt; Then the logs complain with the following error: [#|2014-05-28T16:40:59.688+0100|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=136;_ThreadName=Thread-2;|[EL Warning]: 2014-05-28 16:40:59.685--ServerSession(1341405133)--Thread(Thread[Thread-60,5,grizzly-kernel])--Local Exception Stack: Exception [EclipseLink-22102] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.RemoteCommandManagerException Exception Description: Could not post connection in local naming service under name ${COORDINATION_RMI_URL}/01fa1eea-7ab2-4351-ab0b-4cf7b7f942f2 Internal Exception: java.net.MalformedURLException: invalid URL String: ${COORDINATION_RMI_URL}/01fa1eea-7ab2-4351-ab0b-4cf7b7f942f2 at org.eclipse.persistence.exceptions.RemoteCommandManagerException.errorBindingConnection(RemoteCommandManagerException.java:89) I’ve all tried setting a SessionCustomizer but it doesn’t seem to be able to change/set any properties, at least it doesn’t change the behaviour of the app. import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import org.eclipse.persistence.config.PersistenceUnitPropert…
has answer: http://stackoverflow.com/a/23917695
tagged with: rmi
tagged with: java

http://stackoverflow.com/q/23810146
tagged with: playframework-2.0
answer count: 0
tagged with: scala
has comment: http://stackoverflow.com/comment/36634174
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36666459
score: 0
has comment: http://stackoverflow.com/comment/36666779
has body: I am new to Java, Playframework and Scala. I am trying to create a route to my action using an array, but am getting an error. I know the error says to use a custom query binder, but I also found spots that refer to this being supported in play 2.1. I am using 2.2.1. Is there something that I am missing, or do I need to create a custom QueryStringBinder? Is there a better way to do this? Route - GET /someAction controllers.MyController.someAction(employees:Array[Int]) Controller Action - public static Result someAction(Array&lt;int&gt; employees) { ... } Error : No QueryString binder found for type Array[Int]. Try to implement an implicit QueryStringBindable for this type.
has comment: http://stackoverflow.com/comment/36672253
type: UnansweredQuestion
has title: How to define a play route to pass an int[] param to the action

http://stackoverflow.com/a/23805064
accepted answer of: http://stackoverflow.com/q/23805024
score: 5
has body: In section 15.21.3 (Reference Equality Operators == and !=): It is a compile-time error if it is impossible to convert the type of either operand to the type of the other by a casting conversion (§5.5). The run-time values of the two operands would necessarily be unequal.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36617660
has comment: http://stackoverflow.com/comment/36617327
has comment: http://stackoverflow.com/comment/36617263
type: Answer
has comment: http://stackoverflow.com/comment/36617977
has comment: http://stackoverflow.com/comment/36617201
has comment: http://stackoverflow.com/comment/36617360
answers question: http://stackoverflow.com/q/23805024
upvote count: 5
has comment: http://stackoverflow.com/comment/36618132
has comment: http://stackoverflow.com/comment/36617761
has comment: http://stackoverflow.com/comment/36618043

http://stackoverflow.com/q/23940346
type: Question
score: 10
possible better answer: http://stackoverflow.com/a/68556745
answer count: 2
has comment: http://stackoverflow.com/comment/36875027
has answer: http://stackoverflow.com/a/68556745
downvote count: 0
accepted answer: http://stackoverflow.com/a/23941394
has title: Log4j2 not logging to console
favorite count: 0
has comment: http://stackoverflow.com/comment/36890141
has answer: http://stackoverflow.com/a/23941394
tagged with: logging
has body: I cannot get Log4j 2 to log to the console. Nothing is showing up when running with gradle. log4j2.xml in the projects root directory: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> <AppenderRef ref="Console"/> Usage in my classes: public class ABCHandler { private final Logger logger = LogManager.getLogger(); public ABC(String serialPortName) { logger.info("Opening serial port {}", serialPortName); } }
type: AnsweredQuestion
tagged with: java
upvote count: 10
tagged with: log4j2

http://stackoverflow.com/comment/36694377
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23844874
has text: @kdgregory I didn't know that, thanks. Will try use the native `equals()` method.
score: 0

http://stackoverflow.com/a/23834463
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23833109
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23833109
has body: It is an issue with old browsers where they do not fire any events when they autofill the forms. See also: How to bind to browser change of input field? (jQuery) There are some workarounds mentioned here: http://avernet.blogspot.com/2010/11/autocomplete-and-javascript-change.html See which one suits you better maybe turning off autocomplete on that specific input that needs a change event.
upvote count: 1

http://stackoverflow.com/comment/36601878
type: Comment
type: QuestionComment
has text: @user3580294 same homework assignment
score: 0
comment on: http://stackoverflow.com/q/23796496

hornetq
tags question: http://stackoverflow.com/q/23808386
tag name: hornetq
type: Tag
tags question: http://stackoverflow.com/q/23810835

http://stackoverflow.com/comment/36674836
type: Comment
type: QuestionComment
score: 0
has text: Btw what is actually the error/exception?
comment on: http://stackoverflow.com/q/23834884

http://stackoverflow.com/q/23801346
tagged with: java
tagged with: equality
has answer: http://stackoverflow.com/a/23801427
type: Question
linked to: http://stackoverflow.com/q/7520432
has comment: http://stackoverflow.com/comment/36610863
tagged with: arrays
downvote count: 0
has title: Is there difference between arr.equals(anotherArr) and arr == anotherArr?
has comment: http://stackoverflow.com/comment/36610623
has answer: http://stackoverflow.com/a/23801448
has comment: http://stackoverflow.com/comment/36610650
answer count: 3
favorite count: 0
tagged with: equals
upvote count: 2
has body: Any array in java is Object. hence it has equals method. But I cannot watch realization of this method(or maybe is it possible ?) I wrote several examples and always == and equals returns similar results. Is there way when == and equals return different results ?
possible better answer: http://stackoverflow.com/a/23801389
accepted answer: http://stackoverflow.com/a/23801448
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23801389
score: 2
has comment: http://stackoverflow.com/comment/36610559
linked to: http://stackoverflow.com/q/8777257

http://stackoverflow.com/q/23916756
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36835720
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36835336
has comment: http://stackoverflow.com/comment/36831180
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36830952
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/69477621
has body: Having an odd issue attempting to query a MySQL database; I'm getting a "too many connections" error on my first call to getConnection. Surely I must be doing something idiotic? For reference, I know the basics of closing connection, and not only am I only making one call, its failing on the very first attempt. So I must be doing something extremely stupid? Two classes, one to call for a query, and the other to execute it: import java.sql.*; public class Main { public static void main(String[] args) { CollectorDb.findEvents(); } } public class CollectorDb { private static String username = "foo"; private static String password = "bar"; private static String connectionString = "jdbc:mysql://awsdb/dbName" + "?characterEncoding=UTF-8"; public static void findEvents() { Connection conn = null; Statement stmt = null; ResultSet rset = null; try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { // Next line throws Exception conn = DriverManager.getConnection(connectionString, username, password); // ** NEVER GET HERE ** // single query, then close all connections in a finally block ... } } First lines of the stacktrace: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ... Exception in thread "main" java.lang.RuntimeException: Too many connections at com.lifesize.CollectorDb.findEvents(CollectorDb.java:64) at com.lifesize.Main.main(Main.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg…
has comment: http://stackoverflow.com/comment/36835893
has comment: http://stackoverflow.com/comment/36831423
linked to: http://stackoverflow.com/q/23564585
has title: "Too many Connections" when obtaining connection to MySQL using JDBC
has comment: http://stackoverflow.com/comment/36835476
downvote count: 0
possible better answer: http://stackoverflow.com/a/69477621
has comment: http://stackoverflow.com/comment/36831332
has comment: http://stackoverflow.com/comment/36836569
has answer: http://stackoverflow.com/a/23935869
accepted answer: http://stackoverflow.com/a/23935869

http://stackoverflow.com/comment/36805745
has text: I want to ignore my one url from lastAccessTime of session. refer my another question : http://stackoverflow.com/questions/23649578/define-custom-events-actions-requests-for-resetting-timer-for-session-timeout-in
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23903180

http://stackoverflow.com/q/23841361
favorite count: 0
type: AnsweredQuestion
has body: i got the following java code Icon icoR = new ImageIcon("src/resources/Republica.png"); Icon icoI = new ImageIcon("src/resources/Imperio.png"); JButton botRep = new JButton("Jedi", icoR); JButton botImp = new JButton("Sith", icoI); Object[] options = {botRep, botImp}; //Object[] options = {"Jedi","Sith"}; int i = JOptionPane.showOptionDialog( null, "Question","Title", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null,options,options[0]); System.out.println(i); and im trying to retrieve the selected value from the optionDialog with icon buttons. Problem is, that althought dialog and buttons themselves are properly shown, whenever the buttons are clicked.. nothign happens, and the println statement isnt executed... until i click on the X to close the dialog, and regardless of what i have clicked before.. an 1 is printed as result. Oddly enough, if i change the options array to the regular (text only) one that appears commented in the code, the dialog behaves as one would expect returning the 0-based index of the chosen option. Any hints on what could be wrong here? thanks in advance
has answer: http://stackoverflow.com/a/23841400
upvote count: 1
tagged with: swing
type: Question
has title: JOptionPane.showOptionDialog returning wrong value?
has comment: http://stackoverflow.com/comment/36687445
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36687368
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23841400

http://stackoverflow.com/comment/36815635
score: 0
type: Comment
type: QuestionComment
has text: Glad the indication helped. Please post that answer as a real answer (and accept it) so the system doesn't show this question as unanswered anymore.
comment on: http://stackoverflow.com/q/23889852

http://stackoverflow.com/comment/36844859
score: 1
has text: Yes. Yes you should. Here's a good reference: http://stackoverflow.com/questions/27581/overriding-equals-and-hashcode-in-java
comment on: http://stackoverflow.com/q/23924003
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23936165
tagged with: import
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23936323
tagged with: jtable
score: 0
has title: Search a .txt file on my computer and read it for print the result in a talble
has body: I'm doing a project. I want to give two options for all users. The first one is the button create for create the item and the other is the "import button". With this button I want that when the user press on it they can serch in his computer files .txt and import to the project and then read the content and insert on a table. So, I've two questions; The first one is how to import a computer file to the project? and the second one is how I read the information and put in one table? Thank you so much,
has answer: http://stackoverflow.com/a/23936343
tagged with: netbeans
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36867122

http://stackoverflow.com/a/23853206
downvote count: 0
answers question: http://stackoverflow.com/q/23852286
score: 33
upvote count: 33
type: Answer
has body: The method forEach only iterates through the elements of the list without changing them, If you want to change the elements, you can use the method replaceAll: List&lt;Integer&gt; l = Arrays.asList(2,3,6,1,9); l.replaceAll(p-&gt;p*2);

http://stackoverflow.com/comment/36623361
score: 0
type: Comment
type: QuestionComment
has text: Just tried, it doesn't work.
comment on: http://stackoverflow.com/q/23805576

http://stackoverflow.com/comment/36842223
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23887095
has text: It should look like this: https://i.sstatic.net/kX1RR.png I want to basically have a delete button next to each row, so that I can delete the row from the table and then at the bottom to have one row filled with "<new>" for each fields and next to this row I want to have an add button so that I can add this row to the list.
type: AnswerComment

http://stackoverflow.com/comment/36841806
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23922240
has text: This looks like its going in the right direction. This fails to match if the word appears as the first thing on the line though. In your example, 'but wait, automatic' is not a match (which is correct) but 'automatic' matches.

http://stackoverflow.com/a/23936827
upvote count: 3
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/23935276
answers question: http://stackoverflow.com/q/23935276
has body: The Java BluePrints 4.4.1 Structuring the Web Tier specifically warn against this interpretation: The literature on Web-tier technology in the J2EE platform frequently uses the terms "Model 1" and "Model 2" without explanation. This terminology stems from early drafts of the JSP specification, which described two basic usage patterns for JSP pages. While the terms have disappeared from the specification document, they remain in common use. Model 1 and Model 2 simply refer to the absence or presence (respectively) of a controller servlet that dispatches requests from the client tier and selects views. Moreover, if we consider that the Model–view–controller (MVC) architectural pattern goal is to divide the application into three interconnected parts (Model, View and Controller) and that the Model 1 has no separation between Controller and View, I don't know if Model 1 can be considered a subcategory of the MVC. Model 2, instead, is usually associated with the Model–view–controller (MVC) paradigm, as it drives a separation between logic and display.
downvote count: 0
type: AcceptedAnswer

initialization
tags question: http://stackoverflow.com/q/23898973
tag name: initialization
type: Tag
tags question: http://stackoverflow.com/q/23813418

http://stackoverflow.com/comment/36593021
has text: Are you using old emulator? Please check this: http://stackoverflow.com/questions/9566305/orientation-is-not-working-in-2-3-3
score: 1
comment on: http://stackoverflow.com/q/23789605
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23891562
has comment: http://stackoverflow.com/comment/36782675
tagged with: java
accepted answer: http://stackoverflow.com/a/23891677
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23891766
downvote count: 0
score: 4
answer count: 3
tagged with: keystore
has title: Do you need to explicity close a Java KeyStore input stream?
has answer: http://stackoverflow.com/a/23891748
favorite count: 0
has answer: http://stackoverflow.com/a/23891677
possible better answer: http://stackoverflow.com/a/23891748
tagged with: jks
has body: When reading in a KeyStore using a FileInputStream as follows, does one need to explicitly close the input-steam to stop system resources being wasted ? FileInputStream fin = new FileInputStream("keystore.jks"); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(fin, password); // Is this line needed ?? fin.close(); Is this FileInputStream closed automatically by the load() method or is explicit manually intervention required?
type: AnsweredQuestion

http://stackoverflow.com/q/23938667
possible better answer: http://stackoverflow.com/a/23939297
linked to: http://stackoverflow.com/q/14376807
has answer: http://stackoverflow.com/a/23939400
has comment: http://stackoverflow.com/comment/36872617
has comment: http://stackoverflow.com/comment/36872740
type: AnsweredQuestion
tagged with: java
has title: Save/Read File in android
tagged with: android-file
type: Question
accepted answer: http://stackoverflow.com/a/23939400
answer count: 2
has answer: http://stackoverflow.com/a/23939297
has body: I want to save to a file in android , Some of my arrayList that will be deleted after that.I already have two methods to write/read from android file here but the problem is I want the two methods do that: the first method must save the element of arraylist then if I call it again it will not write the new element in the same line but write it in another line The second must read a line (for example I give to the method which line and it returns what the lines contains) The file looks like that : firstelem secondelem thridelem anotherelem another .. is this possible to do in android java? PS: I don't need database. Update This is My methods : private void writeToFile(String data) { try { OutputStreamWriter outputStreamWriter = new OutputStreamWriter(openFileOutput("config.txt", Context.MODE_PRIVATE)); outputStreamWriter.write(data); outputStreamWriter.close(); } catch (IOException e) { Log.e("Exception", "File write failed: " + e.toString()); } } private String readFromFile() { String ret = ""; try { InputStream inputStream = openFileInput("config.txt"); if ( inputStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String receiveString = ""; StringBuilder stringBuilder = new StringBuilder(); while ( (receiveString = bufferedReader.readLine()) != null ) { stringBuilder.append(receiveString); // stringBuilder.append("\\n"); } inputStream.close(); ret = stringBuilder.toString(); } } catch (FileNotFoundException e) { Log.e("login activity", "File not found: " + e.toString()); } catch (IOException e) { Log.e("login activity", "Can not read file: " + e.toString()); } return ret; }
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36872318
tagged with: android

http://stackoverflow.com/comment/36846971
comment on: http://stackoverflow.com/a/23924806
type: Comment
has text: @Stickerbomby: Could you please provide us with the new LogCat of the crash?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36804577
has text: Hi @raffian, what I'm hoping to find is something like this, which exists in C, Python and PHP: http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23901184

http://stackoverflow.com/comment/36757409
comment on: http://stackoverflow.com/q/23878220
has text: @AnubianNoob: You'd need to make it non-static, and override it in each derived class.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36825786
comment on: http://stackoverflow.com/q/23914034
has text: you never call `setCanPlay(boolean)` . Can you add the code which calls this method? This is the only way it seems the `canPlay` attribute would be changed from the code you have here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27065972
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23893556
accepted answer of: http://stackoverflow.com/q/23893556
type: Answer
score: 2
downvote count: 0
has body: As said here support for websockets on Jboss starts from EAP 6.3. However I tested the .war you linked on Tomcat 8.0.15 and it works like a charm, so I think you can easily find another WS/AS that supports web sockets. Hope this helped.

http://stackoverflow.com/q/23862586
linked to: http://stackoverflow.com/q/20444596
tagged with: overflow
score: 0
tagged with: android-actionbar
has body: My problem is that when you open the app is not shown the overflow menu in the actionbar. If you see en the MainActivity class I have a onOptionsItemSelected for the navigationdrawer, so when I create on the bottom a onCreatedOptionMenu with their respective onOptionsItemSelected fails. and I dont know how to fix it. This is what I want Image But nothing appears in the actionbar when I open application This is my menu.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Theme.Sherlock"&gt; &lt;item android:id="@+id/more" android:icon="@drawable/ic_action_overflow" android:title="@string/more" android:showAsAction="always"/&gt; &lt;menu &gt; &lt;item android:id="@+id/contacto" android:title="@string/contacto" android:showAsAction="always|withText"/&gt; &lt;item android:id="@+id/recomenda" android:title="@string/recomenda" android:showAsAction="always|withText"/&gt; &lt;item android:id="@+id/salir" android:title="@string/salir" android:showAsAction="always|withText"/&gt; &lt;/menu&gt; MainActivity.java: public class MainActivity extends SherlockFragmentActivity { // Declare Variables DrawerLayout mDrawerLayout; ListView mDrawerList; ActionBarDrawerToggle mDrawerToggle; MenuListAdapter mMenuAdapter; String[] title; Fragment fragment0 = new Fragment0(); //20 more private CharSequence mDrawerTitle; private CharSequence mTitle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from drawer_main.xml setContentView(R.layout.drawer_main); // Get the Title mTitle = mDrawerTitle = "¿Qué buscás?"; // Generate title title = new String[] { " ASD ", "CORTE LÁSER", "CORTE METALES", "CORTE POR CHORRO DE AGUA", "CURSOS", "EQUIPOS DE VIDEO", "FICHAS TÉCNICAS", "FOTÓGRAFOS", "GRÁFICAS", "IMPRESIÓN 3D", "LIBRERÍAS Y PAPELERAS", "MAQUETAS Y PROTOTIPOS", "MODELADO 3D", "MODELOS", "PLÁSTICOS", "ROUTER", "SUBLIMACIÓN", "TELGOPOR", "TERMOFORMADO", "TORNE…
answer count: 1
tagged with: actionbarsherlock
has title: ActionBarSherlock menu ForceOverflow not showing
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23862801
type: Question
tagged with: android

http://stackoverflow.com/comment/36722984
type: QuestionComment
comment on: http://stackoverflow.com/q/23859876
score: 0
has text: This is off-topic. Stack Overflow is not a search engine.
type: Comment

http://stackoverflow.com/comment/36865545
type: Comment
comment on: http://stackoverflow.com/q/23935248
score: 2
has text: I think its problem caused coz of object fetched by query is of another type and code is trying to set in wrong class type? can you post your DadosDeCobrancaBO,ClienteBO and AbstractBO classes?
type: QuestionComment

http://stackoverflow.com/a/23842459
downvote count: 0
has comment: http://stackoverflow.com/comment/36689252
score: 1
has body: // Try this way,hope this will help you to solve your problem... StringBuilder buffer = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), HTTP.UTF_8)); String line = null; try { while ((line = reader.readLine()) != null) { buffer.append(line); } } finally { instream.close(); reader.close(); } System.out.println("Buffer : " + buffer.toString());
has comment: http://stackoverflow.com/comment/36689634
answers question: http://stackoverflow.com/q/23842357
upvote count: 1
type: Answer

http://stackoverflow.com/comment/36833005
type: Comment
type: QuestionComment
has text: What does your code look like where the error occurs?
comment on: http://stackoverflow.com/q/23906236
score: 0

http://stackoverflow.com/a/23803775
has body: There are 2 ways of going about this: Application specific: Add your 2 jars in your project's WEB-INF/lib folder, build your project and deploy. Alternatively, try the JBOSS_4_AS\server\all\lib folder. That way, all applications deployed in your JBOSS 4 Application server can see the 2 jars. I hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/23787566
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36635377
has comment: http://stackoverflow.com/comment/36643144
has comment: http://stackoverflow.com/comment/36973183
upvote count: 1

http://stackoverflow.com/comment/36691238
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23789709
has text: Thank you. I actually ended up building a complex compound view class instead. It's a bit closer to what I need. Marking this as accepted answer anyway since it's probably what anyone with my initial question would need.

http://stackoverflow.com/comment/39388759
comment on: http://stackoverflow.com/a/25253005
has text: Thanks! I'll try it in a few hours
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37007176
score: 0
type: Comment
has text: What does marathon actually record? Can you post that part of the script?
type: QuestionComment
comment on: http://stackoverflow.com/q/23837314

http://stackoverflow.com/q/23807830
has answer: http://stackoverflow.com/a/23808255
accepted answer: http://stackoverflow.com/a/23808255
has comment: http://stackoverflow.com/comment/36622852
tagged with: regex
downvote count: 0
has title: Optimize Java Regular expression
has answer: http://stackoverflow.com/a/23807891
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36623077
tagged with: performance
has comment: http://stackoverflow.com/comment/36623299
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36622653
type: Question
has body: I have a file with huge if statements like this: if ((Pattern.compile("string1|String2|String3").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String4|String5").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String6|String7|String8").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String9|String10").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String11|String12").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String13|String14").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String15|String16").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String17|String18").matcher(text_str).find()) &amp;&amp; (Pattern.compile("String19|String19|String20").matcher(text_str).find()) ) { return true; } I basically need to do checks for a strings like (Pseudocode): String contains? (I have a) AND (cat OR dog OR fish) AND (and it) AND (eats OR drinks OR smells) AND (funny OR a lot OR nothing) how would I make this more maintainable and efficient with a very big amount of checks?
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36622940
has comment: http://stackoverflow.com/comment/36622999
favorite count: 0
possible better answer: http://stackoverflow.com/a/23807891
tagged with: maintainability

http://stackoverflow.com/q/23915129
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/23915396
tagged with: bufferstrategy
answer count: 1
favorite count: 0
has body: I am currently learning from a GameDev tutorial and what really confuses me is how a BufferedImage that you raster into an array is being updated. In my code I never specified that a certain BufferedImage is supposed to be used for the BufferStrategy, which changes the Buffers by itself I guess, but the code still somehow works. http://pastie.org/private/un1ep4wwrbsi0ecwmqc5w#15 I mean just ctrl+f for "image" and you see that the parameter "image" is never being updated; only created once and that is it. Yet, when the pixel-array is being changed (in a different class and copied to the one I posted), the changes affect the image-Object, which is then drawn by Graphics. Where exactly do I tell the JVM to copy the array-raster back to the BufferedImage (= parameter image)?
type: AnsweredQuestion
has title: Java: Applying BufferedImage to BufferStrategy
has answer: http://stackoverflow.com/a/23915396
tagged with: java
tagged with: bufferedimage
downvote count: 1
type: Question
tagged with: graphics

http://stackoverflow.com/a/23901088
has comment: http://stackoverflow.com/comment/36824688
has body: In the case of a type where you cannot use normal copying methods for deep copy (in your case of non-serializable, non-clonable, non-instantiable...), you would need to work around with reflection. If you think reflection is too slow, or constructors can't be used, then you may want to think about using sun.misc.Unsafe to instantiate.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23901008
upvote count: 1
score: 1

http://stackoverflow.com/q/23819900
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23826334
type: Question
tagged with: jgit
downvote count: 0
has title: JGIT: git checkout --
has body: I have a not staged modified file and I would like to discard the changes. In git it would be something like git checkout -- . How can I emulate this behavior with JGit ? Thanks in advance.
answer count: 1
accepted answer: http://stackoverflow.com/a/23826334
favorite count: 0

http://stackoverflow.com/q/23823994
type: Question
has body: Need to copy files/documents from one GCS Bucket/folder into another Bucket/Folder via AppEngine GWT Java application. Use case: On accepting a document on the screen, the document is duplicated into another location via this application.
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: file-io
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/36671326
answer count: 0
type: UnansweredQuestion
has title: Copy files from one bucket/folder to another through GWT java application on Google App Engine
has comment: http://stackoverflow.com/comment/36700113
tagged with: gwt
has comment: http://stackoverflow.com/comment/36658862
tagged with: java
has comment: http://stackoverflow.com/comment/36656420
tagged with: google-cloud-storage

http://stackoverflow.com/a/23845962
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/23845935
downvote count: 1
has body: Iterate thought all the keys and check in the value if found then break the loop. for (String key : cat.keySet()) { if (cat.get(key).contains("Carrot")) { System.out.println(key + " contains Carrot"); break; } }
type: Answer

http://stackoverflow.com/a/23876769
score: 0
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23876405
has body: You are setting a Student object at an index to null, then later in a different method attempting to call toString() on a null object. Using List would help you work with this problem much more elegantly. Without rewriting the whole code, here is how you could implement List instead: public static void process() { List&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); List&lt;Student&gt; newStudents = new ArrayList&lt;Student&gt;(); ... Then when you loop through a List in all your different functions, you would use for (int count = 0; count &lt; students.size(); count++) { //do stuff here } If you want to remove a student from a list, use students.remove(count); To populate the list, use Student student1 = new Student(7654321, "Lara Zhivago", 3.75); students.add(student1); ....

http://stackoverflow.com/comment/36855355
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23929842
type: AnswerComment
has text: There is no password needed to login to mysql. Its not the one troubling me. My problem is I couldn't connect to a mysql server (one having no password) in JDBC.

http://stackoverflow.com/comment/36980678
type: QuestionComment
has text: related post : http://reddymails.blogspot.fr/2013/10/troubleshooting-database-connection.html
comment on: http://stackoverflow.com/q/23913665
score: 0
type: Comment

http://stackoverflow.com/comment/36860296
score: 0
has text: See here: http://stackoverflow.com/a/10262454/1166894
comment on: http://stackoverflow.com/q/23932650
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32487035
has body: I need to support Spring 2.5.5 on Java 8, so I used the approach from this answer to provide a future-proof drop-in replacement for JdkVersion.class with as few side-effects as possible (nobody else posted a complete class, and I didn't want to hijack the other answer). There is no need to check for Java 8, simply default to Java 7, which is the highest version the class cared about: Extract the jar file: mkdir spring cd spring jar xvf ../spring.jar Check the Spring version in META-INF/MANIFEST.MF (you should see something like version=2.5.5). Look up the appropriate version of JdkVersion.java and use that as a starting point (the example below is for Spring 2.5.5 and you don't want to change any method signatures from the version you're working with). Check the major and minor version of the JdkVersion.class file: javap -verbose org/springframework/core/JdkVersion.class We see that the class was original compiled as target 48.0 (looking this up, we find that is Java 1.4): Classfile /tmp/spring/org/springframework/core/JdkVersion.class Last modified Jun 23, 2008; size 1286 bytes MD5 checksum 98e6ea08ce9186c50cc71d14465fc3dd Compiled from "JdkVersion.java" public abstract class org.springframework.core.JdkVersion minor version: 0 major version: 48 flags: ACC_PUBLIC, ACC_SUPER, ACC_ABSTRACT Constant pool: ... Create org/springframework/core/JdkVersion.java with the following content: package org.springframework.core; public abstract class JdkVersion { public static final int JAVA_13 = 0; public static final int JAVA_14 = 1; public static final int JAVA_15 = 2; public static final int JAVA_16 = 3; public static final int JAVA_17 = 4; private static final String javaVersion; private static final int majorJavaVersion; static { javaVersion = System.getProperty("java.version"); if (javaVersion.indexOf("1.7.") != -1) { majorJavaVersion = JAVA_17; } else if (javaVersion.indexOf("1.6.") != -1) { majorJavaVersion = JAVA_16; } else if (javaVersion.indexOf("1.5.") != -1) { major…
has comment: http://stackoverflow.com/comment/111512776
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23813369
upvote count: 16
score: 16

http://stackoverflow.com/q/23828309
type: Question
score: 1
tagged with: java
has title: How to send response from a filter in jersey without communicating with the actual service
tagged with: jersey
downvote count: 0
favorite count: 0
tagged with: rest
tagged with: filter
tagged with: service
answer count: 0
type: UnansweredQuestion
has body: is there anyway in jersey, to send the response from the filter itself, without not even passing the request to the service. But, it should be a proper response with some output, not throwing some exception as reply. I'm using jersey 1.8
upvote count: 1

http://stackoverflow.com/comment/36777355
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23885913
has text: May 27, 2014 4:25:47 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 0, SQLState: 42883 May 27, 2014 4:25:47 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ERROR: operator does not exist: integer ~~ integer Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 250

buildpath
tags question: http://stackoverflow.com/q/23834385
type: Tag
tags question: http://stackoverflow.com/q/23825193
tag name: buildpath

http://stackoverflow.com/comment/36613121
type: Comment
comment on: http://stackoverflow.com/q/23802595
score: 0
has text: so how do I create new generics array for firstHalf
type: QuestionComment

http://stackoverflow.com/a/23804351
downvote count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/36616243
answers question: http://stackoverflow.com/q/23804236
has body: use request.getHeader("Referer"). referer gives a url from where you redirected.
type: Answer
has comment: http://stackoverflow.com/comment/36616940

http://stackoverflow.com/comment/36641510
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23814452
has text: I'm pretty new to this stuff, so I dont really understand how to do that :/ Ive been stuck on this for days now :P I posted up the tiledmaprenderer for reference

http://stackoverflow.com/q/23819127
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23819351
tagged with: java
has comment: http://stackoverflow.com/comment/36644949
has comment: http://stackoverflow.com/comment/36644917
tagged with: swing
has body: I'm bit newbie for these sort of GUI related areas. My problem is when I click the JButton mentioned in the below code, it doesn't compute. I tried several ways but no any luck. Can any one give some idea on this? This is the driver: package project; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.TitledBorder; public class Driver extends JFrame{ private JTextField jtfDeposit = new JTextField("0.00"); private JTextField jtfWithdraw = new JTextField("0.00"); private JTextField jtfTransfer = new JTextField("0.00"); private JTextField jtfCBalance = new JTextField("0.00"); private JTextField jtfSBalance = new JTextField("0.00"); private JButton jbtDeposit = new JButton("Deposit"); private JButton jbtWithdraw = new JButton("Withdraw"); private JButton jbtTransfer = new JButton("Transfer"); String[] depositStrings = { "Checking", "Savings"}; String[] withdrawStrings = { "Checking", "Savings"}; String[] transferStrings = { "CHK* to SAVA*", "SAVA* to CHK*"}; public Driver(){ JPanel p1 = new JPanel(new GridLayout(3,4)); p1.add(new JLabel("Deposit Into: ")); p1.add(new JComboBox(depositStrings)); p1.add(jtfDeposit); p1.add(jbtDeposit); p1.add(new JLabel("Withdraw From: ")); p1.add(new JComboBox(withdrawStrings)); p1.add(jtfWithdraw); p1.add(jbtWithdraw); p1.add(new JLabel("Transfer From: ")); p1.add(new JComboBox(transferStrings)); p1.add(jtfTransfer); p1.add(jbtTransfer); p1.setBorder(new TitledBorder("WELCOME TO THE BANK OF IS247")); JPanel p2 = new JPanel(new GridLayout(2,2)); p2.add(new JLabel("Checking : ")); p2.add(jtfCBalance); p2.add(new JLabel("Savings : ")); p2.add(jtfSBalance); p2.setBorder(new TitledBorder("YOUR BALANCES")); add(p1, BorderLayout.CENTER); add(p2, BorderLayout.SOUTH); jbtDeposit.addActionListener(new ButtonListener()); jbtWithdraw.addActionListener(new ButtonListener()); jbtTransfer.addActionListener(new ButtonListener()); } class ButtonListener implements ActionListener{ Account cAcc = new CheckingAccount…
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/23819351
has title: JButton won't compute when clicked
score: 0
answer count: 2
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/23819278
has answer: http://stackoverflow.com/a/23819278

http://stackoverflow.com/a/23838170
answers question: http://stackoverflow.com/q/23838102
has comment: http://stackoverflow.com/comment/36681079
has comment: http://stackoverflow.com/comment/36681118
has comment: http://stackoverflow.com/comment/36681739
has body: No everything is right, but: you wait for the termination of Thread1 (join wait, until it is finished). Thread2 will be started, but it is a daemon Thread. There Threads will be terminiated, if the main-Thread is terminated. Change your code to: thread1.start(); thread2.start(); thread1.join(); thread2.join(); Now both Threads will be finished (and work parallel). edit: Clarification: one.start(); // Starts the execution of the runnable in Thread "one" one.join(); // Waits for the Runnable to FINISH two.start(); // after Thread "one" died, Thread "two" starts (no more moneys in the account) join(): Waits for this thread to die. This is the same as calling everything synchron.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36681675
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23838102

http://stackoverflow.com/comment/36775655
has text: The encoding and decoding mostly OK (you should specify explicit `UTF-8` encoding both for `String.getBytes()` and `new String()`). Are you embedding that base64-encoded value into the JSP somehow?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23886913

http://stackoverflow.com/comment/36728581
has text: okey, but... i still don't get it :(. Sorry.
comment on: http://stackoverflow.com/q/23862790
score: 0
type: QuestionComment
type: Comment

upload
tags question: http://stackoverflow.com/q/23848409
tag name: upload
tags question: http://stackoverflow.com/q/23913561
tags question: http://stackoverflow.com/q/23780696
tags question: http://stackoverflow.com/q/23932436
type: Tag

http://stackoverflow.com/q/23893793
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/23894046
score: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/23894046
has body: I have a Java servlet that operates with a heavy-weight and thread-unsafe resource to handle user requests. The resource is an object that needs a long time to be instantiated (up to 10 seconds) and takes a large amount of memory. But when the object is allocated, it takes a short time to run its method I need to process a request. There can be several such resources, different from each other. Each request comes with an ID, which points out on the certain resource. I wish to implement a pool of such resources, so that requests with the same IDs will not instantiate a new object, but will pick one from the pool. The scheme is following: after the request has been received, servlet checks whether a resource with the requested ID is in the pool if not, servlet creates one and provides it if the resource is already instantiated, the request goes into a queue to be executed, doPost waits for it. The operation over different resources must be concurrent, but synchronized within the same resource. I am new to multithreading in Java, and the ThreadPoolExecutor does not seem to be usable as is, so I would be appreciated for an advice how to implement the above described scheme. Thanks.
type: AnsweredQuestion
tagged with: java
has title: Pool of threads tied to resources on the server
tagged with: servlets
type: Question
tagged with: pool

http://stackoverflow.com/comment/36803334
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23901942
has text: For potential answerers: I *believe* the question is "Why does the `Integer` cache only go from -128 to 127?"
type: Comment

http://stackoverflow.com/q/23836533
score: -1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36677904
has answer: http://stackoverflow.com/a/23836628
favorite count: 0
has comment: http://stackoverflow.com/comment/36677744
type: UnansweredQuestion
has title: Java Method not Implementing
has body: I created a small Java program that basically draws a keyboard controllable circle and some "walls" in a JFrame. Here's what it looks like when executed; The program has 3 classes: main.java (the main method class) Infout.java (circle + walls constructor class) world.java (the class that draws the JFrame) Here is the code: main.java public class main { public static void main(String[] args) { world w = new world(); Infout o = new Infout(); w.frame(); } } world.java import javax.swing.JFrame; public class world { JFrame f = new JFrame(); Infout o = new Infout(); public void frame(){ f.setVisible(true); f.setDefaultCloseOperation(3); f.setSize(300, 400); f.setTitle("Circle"); f.add(o); } } Infout.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; public class Infout extends JPanel implements ActionListener, KeyListener { Timer t = new Timer(5, this); double x = 0, y = 0, velx = 0, vely = 0; public Infout(){ t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.fill(new Ellipse2D.Double(x, y, 40, 40)); g2.fill(new Rectangle2D.Double(0, 270, 300, 5)); g2.fill(new Rectangle2D.Double(140, 270, 5, 300)); g2.fill(new Rectangle2D.Double(140, 60, 70, 5)); g2.fill(new Rectangle2D.Double(50, 140, 5, 70)); g2.fill(new Rectangle2D.Double(150, 130, 5, 40)); g2.fill(new Rectangle2D.Double(190, 210, 40, 5)); if (x &gt;= 120 &amp;&amp; y &gt;= 270) { g.drawString("You win!",115,35); } if (x &lt;= 120 &amp;&amp; y &gt;= 270) { g.drawString("You lose!",115,35); } if (x == 120 &amp;&amp; y &gt;= 270){ velx = 0; vely = 0; } if (x == 31.5 &amp;&amp; y &lt;= 200 &amp;&amp; y &gt;= 100){ velx = 0; } if (x == 132 &amp;&amp; y &lt;= 170 &amp;&amp; y &gt;= 100){ velx = 0; } if (x &lt;= 190 &amp;&am…
upvote count: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/36678440
type: Question
tagged with: graphics

http://stackoverflow.com/a/23905408
has comment: http://stackoverflow.com/comment/36815969
has comment: http://stackoverflow.com/comment/36814246
has body: Use this: JTextField Mytxtfield = new JTextField() {protected void paintComponent( Graphics g ) { if ( !isOpaque( ) ) { super.paintComponent( g ); return; } Graphics2D g2d = (Graphics2D)g; GradientPaint gp = new GradientPaint( 0, 0, color1, 0, 20, color2); g2d.setPaint( gp ); // g2d.fillRect( 0, 0, w, h ); g2d.fillRoundRect(0, 0, getWidth()-1, getHeight()-1, 10, 10); setOpaque( false ); super.paintComponent( g ); setOpaque( true ); }}; Full Working code: import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Shape; import java.awt.SystemColor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; public class DBconnection extends JFrame { private JPanel contentPane; private JTextField textFieldHost; private Color color2 = Color.white; private Color color1 = Color.white; public DBconnection() throws SAXException, IOException, ParserConfigurationException { setTitle("Connect To MDM Database"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(450, 200, 410, 280); contentPane = new JPanel(); contentPane.setBackground(SystemColor.inactiveCaption); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); GridBagLayout gbl_contentPane = new GridBagLayout(); gbl_contentPane.columnWidths = new in…
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36814665
has comment: http://stackoverflow.com/comment/36812159
answers question: http://stackoverflow.com/q/23904731
has comment: http://stackoverflow.com/comment/36810792
score: 1
has comment: http://stackoverflow.com/comment/36812858
has comment: http://stackoverflow.com/comment/36814936
upvote count: 1
has comment: http://stackoverflow.com/comment/36814118

http://stackoverflow.com/comment/36616447
score: 0
comment on: http://stackoverflow.com/q/23804388
type: QuestionComment
type: Comment
has text: There is no such thing a "loading a method" in the Java language.

http://stackoverflow.com/q/23831198
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23831477
accepted answer: http://stackoverflow.com/a/23831477
has comment: http://stackoverflow.com/comment/36667439
downvote count: 1
linked to: http://stackoverflow.com/q/218384
favorite count: 0
has comment: http://stackoverflow.com/comment/36668175
has comment: http://stackoverflow.com/comment/36668651
has comment: http://stackoverflow.com/comment/36667495
duplicate of: http://stackoverflow.com/q/218384
tagged with: swing
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36667574
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36667327
has comment: http://stackoverflow.com/comment/36668021
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36674616
has body: Following on from my previous questions about this concentrate game i have been working on i have hit a java.lang.NullPointerException when trying to run a specific part of it and i cannot find out what could be causing it, It just appears to be pointing to my main method in netbeans. Exception in thread "main" java.lang.NullPointerException at concentrate.Concentrate.main(Concentrate.java:281) Here is the code or the page that the error is appearing on, at first i thought it may be something to do with my playGame method i was running but nothing appeared to change. Even when i removed everything from within it so once again i have come to stack overflow for help. package concentrate; import static concentrate.HighscoreManager.scores; import static concentrate.Score.nameField; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import java.util.logging.Logger; import javax.swing.*; public final class Concentrate extends JFrame implements ActionListener { //below are all the variables declared for the gui and the game program itself private final JFrame window = new JFrame("Concentrate"); private final int WINDOW_WIDTH = 330; private final int WINDOW_HEIGHT = 485; private JButton exitBtn, scoresBtn, resetButton; public static ArrayList&lt;Card&gt; gameBtn; public static int Point = 46; public static int numCards = 16; public static JLabel Score; public static GameButtonPanel gamePnl; private final Panel buttonPnl = new Panel(); private final Panel scorePnl = new Panel(); private GameButtonListener buttonListener; // Listener for the button actions private GameButtonPanel gui; // The GUI this game controls Concentrate game; Random rand = new Random(); private int cardVal; private GameButtonPanel theGUI; //update score checks and sets the score on the main board public static void updateScore() { Score.setText("Score: " + Point); } public Concentrate(){ //below is calling the create gui function and set varia…
has comment: http://stackoverflow.com/comment/36667412
has comment: http://stackoverflow.com/comment/36667438
possible better answer: http://stackoverflow.com/a/23831350
has title: java.lang.NullPointerException Concentration game
has answer: http://stackoverflow.com/a/23831350
upvote count: 2

http://stackoverflow.com/a/23868783
has body: if you are working on Windows create a bat file within this command subst G: ,G is a local disque name it's just an example the only condition it to choose a disque local name that not already exist. put this bat file next to your workspace in the same level, then execute this but file ,a disque local icon with the name G or the one you had chosen will appear in your work station,then launch eclipse and chose the this path G:\workspace.the positive about this method is not only eclipse became portable but everything exist in same level of the bat file.
answers question: http://stackoverflow.com/q/23867762
type: Answer
score: 0

http://stackoverflow.com/a/23780281
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36572071
answers question: http://stackoverflow.com/q/23780057
has body: I am having some trouble understanding your question, even with the translation :) In the line mesDonnees = maDonnee.split("/"); mesDonnees needs to be a String array (String[]) and you can loop through it like: for (String str : mesDonnees) { //... do somwething with str } You can rename str something in French if you like, I couldn't think of a suitable name
score: 2
has comment: http://stackoverflow.com/comment/36572229
has comment: http://stackoverflow.com/comment/36571246
downvote count: 0

http://stackoverflow.com/comment/109020034
has text: You can't seem to follow this pattern after a mapTo though using an IntStream. I found I had to convert it back to a `Set<Integer>` using `collect(Collectors.toSet())` ... and do a couple of operations on that. I wanted `max()` and if a specific value was in set as two operations... `filter(d -> d == -1).count() == 1;`
comment on: http://stackoverflow.com/a/30922045
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36843830
type: Comment
has text: If you download the homework, the POM file has all the versions the class is using. I loaded the POM into eclipse and was able to compile their homework using the same style they used in the lecture. The halt() in the exception handler was another issue, but that went away as well. I assume at some point they are going to have to update the course material.
type: QuestionComment
comment on: http://stackoverflow.com/q/23898628
score: 0

http://stackoverflow.com/q/23874176
possible better answer: http://stackoverflow.com/a/23874213
has answer: http://stackoverflow.com/a/23874210
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23874245
type: Question
accepted answer: http://stackoverflow.com/a/23874210
has answer: http://stackoverflow.com/a/23874315
has comment: http://stackoverflow.com/comment/36749035
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23874213
answer count: 4
has title: Call reverse method
has body: Problem: I hope to call reve method, the result should be "edcba". But the real result is "abcde". The reve method does not work well. Any suggestion to solve it ? Thanks a lot import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Reverse { public static void main (String args[]) throws IOException { System.out.println(reve("abcde")); } // to reverse a string public static String reve(String sentence) { StringBuilder sb = new StringBuilder(sentence.length() + 1); String[] words = sentence.split(" "); for (int i = words.length - 1; i &gt;= 0; i--) { sb.append(words[i]).append(' '); } sb.setLength(sb.length() - 1); // Strip trailing space return sb.toString(); } }
has comment: http://stackoverflow.com/comment/36749069

http://stackoverflow.com/comment/37126914
comment on: http://stackoverflow.com/q/23853363
score: 0
type: Comment
type: QuestionComment
has text: @matiash I looked into it and I'm using the 64bit version. Do you think the 32 bit version could help?

rotation
tags question: http://stackoverflow.com/q/23839808
tag name: rotation
type: Tag
tags question: http://stackoverflow.com/q/23929746
tags question: http://stackoverflow.com/q/23803243
tags question: http://stackoverflow.com/q/23856489

http://stackoverflow.com/comment/36846085
type: Comment
type: QuestionComment
has text: i want to extract users that not have any project and also users that have a project where the statut of this project is "Terminé"
comment on: http://stackoverflow.com/q/23924544
score: 0

http://stackoverflow.com/q/23811609
answer count: 2
has body: I've ben researching how to use swing timers for 2 days now and am trying to figure out how to change the image I have at the center of my JFrame. As of now my program runs properly, but the image does not change the way I want it to. This class was just used as a test so it might not have proper java syntax. package hauntedHouseAdventure; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Timer; public class timertest { static JFrame sceneOne = new JFrame(); public static void main(String[] args) throws IOException { // TODO Auto-generated method stub ImageIcon image = new ImageIcon( "/Users/computerscience2/Desktop/dark-forest-night-image.jpg"); JLabel imageLabel = new JLabel("", image, JLabel.CENTER); JPanel panel = new JPanel(new BorderLayout()); panel.add(imageLabel, BorderLayout.NORTH); sceneOne.add(panel); sceneOne.setResizable(false); imageLabel.setVisible(true); sceneOne.pack(); JButton leave=new JButton("Leave"); JButton stay= new JButton ("Stay"); leave.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { //Execute when button is pressed sceneOne.setVisible(false); } }); stay.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent f) { //Execute when button is pressed sceneOne.setVisible(false); } }); panel.add(leave, BorderLayout.EAST); panel.add(stay, BorderLayout.WEST); JLabel label1 = new JLabel("Test"); label1.setText("&lt;html&gt;&lt;font color='red'&gt; It was approximately 11:30 pm. The night sky was black not a single star piercing through the darkness" + "except the thick and powerful moonlight." + "&lt;br&gt;" + "You are alone leaving a costume party at a friend's place." + "It was rather boring and you decided to leave early." + "A stutter is heard and yo…
upvote count: 0
accepted answer: http://stackoverflow.com/a/23813281
favorite count: 0
tagged with: jlabel
tagged with: timer
has comment: http://stackoverflow.com/comment/36631663
linked to: http://stackoverflow.com/q/23555676
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23811807
has answer: http://stackoverflow.com/a/23811807
downvote count: 1
has title: How to make a JLabel change once based on time
has comment: http://stackoverflow.com/comment/36646788
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23813281

http://stackoverflow.com/q/23800848
has body: I don`t have good understanding of intern method of String. String s1="java"; // should create one object in String Constant pool String ss="java"; // no object is created (java is already in String pool)..it refers to object in String constant pool String s2= new String("Android").intern(); // should create 2 objects one in heap and second in String constant pool String s3= new String("java").intern()// i guess only one object is created on heap and s3 will point to object in String constant pool (as 'java' already exist).so the object in heap is lost because there is no reference please let me know my understanding is correct or not ?
linked to: http://stackoverflow.com/q/3052442
has comment: http://stackoverflow.com/comment/36609995
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23801128
possible better answer: http://stackoverflow.com/a/23800893
has comment: http://stackoverflow.com/comment/36609797
tagged with: java
has answer: http://stackoverflow.com/a/23800893
linked to: http://stackoverflow.com/q/10045147
accepted answer: http://stackoverflow.com/a/23801128
downvote count: 1
type: Question
upvote count: 4
answer count: 2
duplicate of: http://stackoverflow.com/q/10045147
has comment: http://stackoverflow.com/comment/111975594
has title: How many objects are created when we use String`s intern method
tagged with: string
has comment: http://stackoverflow.com/comment/36610034
favorite count: 0

http://stackoverflow.com/comment/36858713
type: AnswerComment
has text: "*There can, but shouldn't*" > Can you be more specific? That's a very vague answer. Your second paragraph, while interesting, doesn't address the question so your "Short answer" is in fact your entire answer at the moment.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23930995

http://stackoverflow.com/comment/82111775
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24146320
type: AnswerComment
has text: Sorry just to answer my own question there in case its any use to anyone, when you say "jar-with-dependencies" - you mean downloading [this version](http://fimt-nexus-repository.fmrco.com/nexus/service/local/repositories/central/content/org/fitnesse/plugins/maven-classpath-plugin/1.9/maven-classpath-plugin-1.9-jar-with-dependencies.jar) of the jar and putting it in the plugins folder, doing this resolved the issue for me

http://stackoverflow.com/comment/36892951
score: 0
type: AnswerComment
has text: Yes you are right, that makes the normalization more normalized :P
type: Comment
comment on: http://stackoverflow.com/a/23936548

http://stackoverflow.com/q/23807414
duplicate of: http://stackoverflow.com/q/10435557
accepted answer: http://stackoverflow.com/a/23807627
tagged with: spring
type: AnsweredQuestion
has title: Stop Spring writing startup text to console (or anywhere)
tagged with: java
has answer: http://stackoverflow.com/a/23807627
linked to: http://stackoverflow.com/q/10435557
type: Question
has comment: http://stackoverflow.com/comment/36713399
has comment: http://stackoverflow.com/comment/36713233
has body: I have a simple console application that uses Spring for DI. When the application starts, spring dumps the following text to the console: May 22, 2014 10:46:30 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4bb2668f: startup date [Thu May 22 22:46:30 EST 2014]; root of context hierarchy May 22, 2014 10:46:30 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [spring-config.xml] Does anyone know how to stop it writing to the console, and anywhere else? I want it to start silently. Update: Though this has been marked as a duplicate, the other question doesn't answer my question. That said, it would appear that what I want can't be achieved, so fair enough :)
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36712339
favorite count: 0
has comment: http://stackoverflow.com/comment/36625951

http://stackoverflow.com/q/23830105
has comment: http://stackoverflow.com/comment/36667971
has comment: http://stackoverflow.com/comment/36665131
tagged with: interface
has comment: http://stackoverflow.com/comment/36665284
tagged with: input
has answer: http://stackoverflow.com/a/23832830
accepted answer: http://stackoverflow.com/a/23832830
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36668094
has comment: http://stackoverflow.com/comment/36674280
tagged with: swing
type: Question
tagged with: graphics
has title: Linebreak in text inputted through GUI
linked to: http://stackoverflow.com/q/23816019
score: -2
has body: I'm trying to build a program that, through a GUI, receives input text with linebreaks, splits it at lines, then at spaces, and for each string does something "special". The problems are 2: I can't get linebreaks into the input field; I don't know how to get the linebreaks into the output. How do I do that? My code is: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author michelegorini */ import java.util.Scanner; public class HakkaTranslator extends javax.swing.JFrame { /** * Creates new form HakkaTranslator */ public HakkaTranslator() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { inputField = new javax.swing.JTextField(); translateButton = new javax.swing.JButton(); pinyinField = new javax.swing.JLabel(); hakkaCharField = new javax.swing.JLabel(); mandCharField = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); translateButton.setText("Translate"); translateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { translateButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(hakkaCharField, javax.swing.GroupLayout.PREFERRED_SIZE, 282, jav…
tagged with: java
has comment: http://stackoverflow.com/comment/36665262
has comment: http://stackoverflow.com/comment/36665617
has comment: http://stackoverflow.com/comment/36665665
downvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36848962
type: Comment
type: QuestionComment
has text: Should show us the details error message of 'File Not Found' you faced.
comment on: http://stackoverflow.com/q/23926124
score: 0

return
tags question: http://stackoverflow.com/q/23854328
type: Tag
tags question: http://stackoverflow.com/q/23875575
tag name: return
tags question: http://stackoverflow.com/q/23846411
tags question: http://stackoverflow.com/q/23919809
tags question: http://stackoverflow.com/q/23892578
tags question: http://stackoverflow.com/q/23856710

http://stackoverflow.com/q/23913665
possible better answer: http://stackoverflow.com/a/23957552
type: Question
score: 5
has answer: http://stackoverflow.com/a/24026356
downvote count: 0
has body: We have a spring application deployed on a jboss 7 server. The application uses multiple datasources obtained from jboss through jndi. The Transaction management is also provided by the Java EE container (we use Spring JtaTransactionManager) The app architecture is a legacy one with DAOs extending hibernate Templates (using Spring HibernateDaoSupport). Transaction are managed in the service layer using @Transactional annotations. My 1st questions are: when encountering the annotation, how does the transaction manager know which datasources will be involved in the transaction ? when does it effectively retrieve a JDBC connection and on which datasources ? when does it effectively open a transaction ? (only DAOs got a reference to the sessionFactory bound to a specific datasource). The driver we are using does not support distributed (XA) transactions, in most case we doesn't need multi-phase commit as only one datasource is written. Anyway when we access (read only) other datasources within the same transaction we got messages in logs : INFO [org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager] (http--0.0.0.0-8080-4) IJ000100: Closing a connection for you. Please close them yourself: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@691644c: java.lang.Throwable: STACKTRACE at org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl.registerConnection(CachedConnectionManagerImpl.java:265) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:495) at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) [hibernate-core-3.3.1.GA.jar:3.3.1.GA] [...] Is there a way to properly manage connecti…
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23957552
has comment: http://stackoverflow.com/comment/36980678
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24040176
accepted answer: http://stackoverflow.com/a/24040176
tagged with: transactions
has title: Global transaction management - Jboss : Closing a connection for you
upvote count: 5
tagged with: java
tagged with: hibernate
tagged with: jboss

http://stackoverflow.com/comment/36798388
has text: @SotiriosDelimanolis Yes it was 18,204 bytes.
comment on: http://stackoverflow.com/q/23899266
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23826491
score: 1
has body: Remove rowhead.getCell(1).setCellValue(capacity); line.It gives NullPointerException error and don't use createCell(short) it is deprecated method so please remove short type cast. Here is my code import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFCell; import java.io.IOException; import org.apache.commons.io.FileSystemUtils; import java.io.*; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileSystemUtils; import java.io.File; import java.util.ArrayList; public class DiskSpace { public static void main(String[] args) { try{ String filename="/home/likewise-open/EZDI-DOMAIN/cshah/Desktop/NewExamle.xls" ; HSSFWorkbook workbook=new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("FirstSheet"); ArrayList alldisk=null; alldisk=new ArrayList(); alldisk.add("/home/likewise-open/EZDI-DOMAIN/cshah/Desktop"); File drive=null; long capacity=0,freespace=0, usedspace=0; for(int i=0;i&lt;alldisk.size();i++) { drive = new File(alldisk.get(i).toString()); capacity = drive.getTotalSpace(); freespace = drive.getFreeSpace(); usedspace = capacity - freespace; HSSFRow rowhead= sheet.createRow((short)i); //rowhead.getCell(1).setCellValue(capacity); rowhead.createCell(0).setCellValue(capacity); rowhead.createCell(1).setCellValue(freespace); rowhead.createCell(2).setCellValue(usedspace); } FileOutputStream fileOut = new FileOutputStream(filename); workbook.write(fileOut); fileOut.close();} catch ( Exception ex ) { ex.printStackTrace(); } }}
has comment: http://stackoverflow.com/comment/36659250
has comment: http://stackoverflow.com/comment/36658649
has comment: http://stackoverflow.com/comment/36658398
has comment: http://stackoverflow.com/comment/36658816
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23826116
has comment: http://stackoverflow.com/comment/36659399
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36659874
answers question: http://stackoverflow.com/q/23826116
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36692713
type: Comment
comment on: http://stackoverflow.com/q/23844379
has text: As it is you can build only on the project creator's machine, but you can recreate a project before you try to build it.
score: 0
type: QuestionComment

morphia
tag name: morphia
tags question: http://stackoverflow.com/q/23929133
type: Tag
tags question: http://stackoverflow.com/q/23779233
tags question: http://stackoverflow.com/q/23779378
tags question: http://stackoverflow.com/q/23911250

http://stackoverflow.com/a/23902431
answers question: http://stackoverflow.com/q/23900976
has comment: http://stackoverflow.com/comment/36804130
score: 2
has comment: http://stackoverflow.com/comment/36847046
has comment: http://stackoverflow.com/comment/36810486
downvote count: 0
has body: You should be able to add the cascade to the many-to-one element: &lt;many-to-one name="address" column="addressId" not-null="true" unique="true" cascade="delete" />
type: Answer
has comment: http://stackoverflow.com/comment/36810109
upvote count: 2

http://stackoverflow.com/a/24066630
downvote count: 0
type: Answer
score: 1
has body: The Euler method is rather bad for faithful physics simulation, especially if you take the time step as large as the time between two frames. Either perform a number of 10-20 simulation step per frame or use an higher order integration method. Even with the Euler method, you need to apply the time step at all parts of the differential system. So it is velocity += acceleration*timestep position += velocity*timestep And if you intend it to be some kind of symplectic integrator, assuming that the acceleration results from a gradient force field and only depends on position, exchange the parts, update the position first, position += velocity*timestep velocity += acceleration*timestep
upvote count: 1
answers question: http://stackoverflow.com/q/23859015

http://stackoverflow.com/comment/36661366
type: QuestionComment
has text: Your problem is definitely in one of these two: 1) Your collision and dynamics code is buggy 2) Your rendering is off: the world is moving, but the ball isn't, or vise versa. Showing us a video might help.
comment on: http://stackoverflow.com/q/23828088
score: 0
type: Comment

http://stackoverflow.com/comment/36586368
comment on: http://stackoverflow.com/a/23787839
type: Comment
score: 0
type: AnswerComment
has text: Sam ,by two levels of nesting i mean this : if input is : {4:{CLIENT ACCOUNT} :-} then output be : {4:CLIENT ACCOUNT:-}. Please check my updated question.There it mentions clearly.

http://stackoverflow.com/comment/36729863
score: 2
has text: If memory serves, that's actually pretty close to how array accesses happen in C/C++. I'm not sure what Java does internally, but I'm fairly certain that array accesses are always O(1)
comment on: http://stackoverflow.com/q/23863543
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23923414
tagged with: java
has answer: http://stackoverflow.com/a/23923823
type: Question
has title: Read, scan, modify a text file and put modified text into a new file
score: 0
answer count: 2
tagged with: .net
tagged with: string
has body: I've tried to read a text file and try to modify it. So many discussion that I got from StackOverflow, here is the content: NO 1025 0 NO 1025 1 OP 1026 0 EndRow The modified text file that I want: NO 0 AND 1 OP 0 EndRow I read some discussion topics about it, and then came the conclusion that I have to use the .hasNextLine method to check every line. Here's the code: import java.io.*; import java.util.Scanner; public class MainConvert { /** * @nahdiya */ public static void main(String[] args) { try { File readNet = new File("testttt.net"); FileReader readFileNet = new FileReader(readNet); BufferedReader reader = new BufferedReader(readFileNet); Scanner scan = new Scanner("testttt.net"); PrintWriter fileConvert = new PrintWriter("convertNet.txt"); while (scan.hasNextLine()) { String check = scan.next(); String checkLine = scan.nextLine(); if (checkLine.contains("NO 1025")) { if(checkLine.contains("NO 1025")) { fileConvert.println("AND "+check ); } else if (checkLine.contains("OP 1026")) { fileConvert.println("OP"+check); } else { fileConvert.println(checkLine);} } } } reader.close(); fileConvert.close(); } catch(Exception ex) { ex.printStackTrace(); } } When I tried to run the class, an output message appeared like this: java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Unknown Source) at fileConvertSave.MainConvert.main(MainConvert.java:21) The problem is: PrintWriter fileConvert = new PrintWriter("convertNet.txt"); What is the problem with this line? I just want to modify the testttt.net file. fileConvert must be created as the new file. What is wrong with it?
has answer: http://stackoverflow.com/a/23923479
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36843774
has comment: http://stackoverflow.com/comment/36843759
tagged with: text

http://stackoverflow.com/comment/36579301
type: Comment
type: AnswerComment
has text: @ElliotFrisch So, the best solution should be `return "g l e o u t s c k v f w";` ;). Seriously, I think he made a mistake in his expected output or in his explanation.
comment on: http://stackoverflow.com/a/23784377
score: 0

http://stackoverflow.com/a/23870203
has comment: http://stackoverflow.com/comment/36763021
has comment: http://stackoverflow.com/comment/36755473
type: Answer
answers question: http://stackoverflow.com/q/23869267
score: 0
has body: You can use FileWriter to write string to the files. Below code works fine. package areaText; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; public class TextAreaTest extends JFrame{ /** * @param args */ public static void main(String[] args) { new TextAreaTest().createFrame(); } private void createFrame() { setSize(200,200); setLayout(null); final JTextArea area=new JTextArea("Test"); area.setSize(50, 50); area.setBounds(0, 0, 100, 100); add(area); JButton button=new JButton("Save"); button.setBounds(100, 100, 80, 30); add(button); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String s=area.getText(); System.out.println("GOT-"+s); try { File f=new File("testFile.txt"); System.out.println("Writing "+f.getAbsolutePath()); FileWriter fr=new FileWriter(f); fr.write(s); fr.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } }

modal-dialog
tag name: modal-dialog
type: Tag
tags question: http://stackoverflow.com/q/23901970

http://stackoverflow.com/comment/56015483
type: QuestionComment
comment on: http://stackoverflow.com/q/23794482
score: 0
type: Comment
has text: The standard Java library is full of inconsistencies in this regard and don't count on it that new classes and interfaces will adhere to any standard.

http://stackoverflow.com/a/27201749
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/23784422
type: AcceptedAnswer
downvote count: 0
has body: Here is the complete code. I also did some changes: if audio is longer, then write the rest separately, and added progress of audio and video in title bar. You may need to check if there is really video or audio stream in your files to prevent errors. import com.xuggle.mediatool.IMediaWriter; import com.xuggle.mediatool.ToolFactory; import com.xuggle.xuggler.Global; import com.xuggle.xuggler.IAudioSamples; import com.xuggle.xuggler.IContainer; import com.xuggle.xuggler.IPacket; import com.xuggle.xuggler.IStreamCoder; import com.xuggle.xuggler.IVideoPicture; import com.xuggle.xuggler.video.ConverterFactory; import com.xuggle.xuggler.video.IConverter; import java.awt.Graphics; import java.awt.Image; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.SwingUtilities; /** * * @author Pasban */ public class MergeVideoAudio extends JDialog { Image image; private double video_duration = 0.00001, video_read = 0, audio_duration = 0.00001, audio_read = 0; public static void main(String[] args) { final MergeVideoAudio merge = new MergeVideoAudio(); Thread thread = new Thread() { @Override public void run() { merge.perform("y:/a.mp4", "y:/b.mp3", "y:/c.mp4"); merge.setVisible(false); System.exit(0); } }; thread.run(); } public void perform(String path_video, String path_audio, String path_output) { IMediaWriter mWriter = ToolFactory.makeWriter(path_output); IContainer containerVideo = IContainer.make(); IContainer containerAudio = IContainer.make(); // check files are readable if (containerVideo.open(path_video, IContainer.Type.READ, null) &lt; 0) { throw new IllegalArgumentException("Cant find " + path_video); } if (containerAudio.open(path_audio, IContainer.Type.READ, null) &lt; 0) { throw new IllegalArgumentException("Cant find " + path_audio); } // read video file and create stream IStreamCoder coderVideo = containerVideo.getStream(0).getStreamCoder(); if (coderVideo.open(null, null) &lt; 0) { throw new RuntimeException("Cant open video coder"); } int …
accepted answer of: http://stackoverflow.com/q/23784422
has comment: http://stackoverflow.com/comment/86518792
type: Answer

http://stackoverflow.com/q/23846498
has comment: http://stackoverflow.com/comment/36697890
has comment: http://stackoverflow.com/comment/36696573
has answer: http://stackoverflow.com/a/23846717
duplicate of: http://stackoverflow.com/q/18880962
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36697122
has comment: http://stackoverflow.com/comment/36696664
answer count: 3
has comment: http://stackoverflow.com/comment/36698015
has comment: http://stackoverflow.com/comment/36697699
accepted answer: http://stackoverflow.com/a/23846831
has comment: http://stackoverflow.com/comment/36697632
has comment: http://stackoverflow.com/comment/36696711
has title: Second Activity - Android application. Unable to instantiate activity ComponentInfo
has comment: http://stackoverflow.com/comment/36696933
score: 0
linked to: http://stackoverflow.com/q/7460095
has comment: http://stackoverflow.com/comment/36698407
tagged with: android
has answer: http://stackoverflow.com/a/23846729
has comment: http://stackoverflow.com/comment/36697174
tagged with: android-activity
has comment: http://stackoverflow.com/comment/36696708
has body: I added a second activity to my perfectly working application and after that it crashes already when running. I though I did all necessary things to make it works, like cleaning project, adding reference into manifest file etc., but it still doesn't work. New activity should start after choosing imageButtonInfo. Any ideas what could be wrong? MainActivity.java: package com.example.beatzlooper; import java.io.IOException; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.os.Build; import android.content.Intent; import android.graphics.Color; import android.media.MediaPlayer; public class MainActivity extends ActionBarActivity implements OnClickListener{ /* Declarations */ MediaPlayer mp = new MediaPlayer(); Beat beatOne = new Beat("Unknown", "1 asdasfsdfsdfsdfsfdad", R.raw.elements6); // (author, title, id) Beat beatTwo = new Beat("Unknown", "2 adasdavvvzzzzfff", R.raw.beat); TextView labelView = (TextView) findViewById(R.id.labelView); Intent intent = new Intent(MainActivity.this, InfoActivity.class); /* ----------------------------------------------------------- */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // if (savedInstanceState == null) { // getSupportFragmentManager().beginTransaction() // .add(R.id.container, new PlaceholderFragment()) // .commit(); // } /* Buttons */ ImageButton btnStop = (ImageButton) findViewById(R.id.imageButtonStop); btnStop.setOnClickListener(this); ImageButton btnInfo = (ImageButton) findViewById(R.id.imageButtonInf…
duplicate of: http://stackoverflow.com/q/7460095
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36697011
has comment: http://stackoverflow.com/comment/36697287
has comment: http://stackoverflow.com/comment/36697335
has comment: http://stackoverflow.com/comment/36696899
has comment: http://stackoverflow.com/comment/36697714
type: Question
has answer: http://stackoverflow.com/a/23846831
linked to: http://stackoverflow.com/q/18880962
has comment: http://stackoverflow.com/comment/36696597
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36696551
has comment: http://stackoverflow.com/comment/36696999
possible better answer: http://stackoverflow.com/a/23846717
tagged with: java

http://stackoverflow.com/q/23886463
linked to: http://stackoverflow.com/q/2526681
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Automatic XSL generation from dynamically generated XML
type: UnansweredQuestion
tagged with: xslt
type: Question
has body: Is it possible to automatically generate xsl from dynamically generated xml in java if I don't know the structure of the xml in advance? I know what tags can be there, but I can't know for sure which ones will be there. Is such a thing even possible? :>
tagged with: java
has comment: http://stackoverflow.com/comment/36786442
has answer: http://stackoverflow.com/a/23886928

http://stackoverflow.com/comment/135038072
type: AnswerComment
comment on: http://stackoverflow.com/a/69192349
type: Comment
has text: thanks this one was the only one that fixed the issue for me !
score: 0

http://stackoverflow.com/q/23902986
has comment: http://stackoverflow.com/comment/36805406
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/36805857
has comment: http://stackoverflow.com/comment/36805914
score: 0
answer count: 2
tagged with: jquery
tagged with: ajax
has title: How to read file line by line and send response to ajax request using java and ajax with jsonp?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23903253
has body: I want to read file line by line that is on different domain and send response to ajax request as each line is read. I have written code that reads file and send last line as response. Here is my jquery-ajax code: $.ajax({ url: 'http://192.168.xx.xx:8080/myproject/readFile', dataType: 'jsonp', jsonp: 'callback', jsonpCallback: 'parseResponse', success: function(data,textStatus, jqXHR) { console.log(data); }, error: function(jqXHR, textStatus, errorThrown){ console.log(errorThrown); console.log("ok"); console.log(jqXHR); console.log("Something really bad happened " + textStatus); } }); Here is my servlet code: public class readFile extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{ // The name of the file to open. System.out.println("in read file"); String fileName = "myfile,txt"; PrintWriter out = response.getWriter(); // This will reference one line at a time String line = null; try { // FileReader reads text files in the default encoding. FileReader fileReader = new FileReader(fileName); // Always wrap FileReader in BufferedReader. BufferedReader bufferedReader = new BufferedReader(fileReader); BasicDBObject oneLine = new BasicDBObject(); String set_data = ""; StringBuilder stringBuilder = new StringBuilder(); while((line = bufferedReader.readLine()) != null) { line = line.replaceAll("\\{",""); line = line.replaceAll("\\}",""); line = line.replaceAll("\\*",""); line = line.replaceAll("\\:",""); line = line.replaceAll("\\|",""); // stringBuilder.append(line); } /* out.println("parseResponse("+JSON.parse("{'Name':'"+stringBuilder.toString()+"'}")+")");*/ out.flush(); out.println("parseResponse("+JSON.parse("{'Name':'"+line+"'}")+")"); out.flush(); // Always close files. bufferedReader.close(); } catch(FileNotFoundException ex) { System.out.println( "Unable to open file '" + fileName + "'"); } catch(IOException ex) { System.out.println("Error reading file '" + fileName + "'"); } } public void set_print…
tagged with: java
has comment: http://stackoverflow.com/comment/36805982
has answer: http://stackoverflow.com/a/23903130

http://stackoverflow.com/a/29048085
type: Answer
has comment: http://stackoverflow.com/comment/47228891
has comment: http://stackoverflow.com/comment/47224212
answers question: http://stackoverflow.com/q/23828078
has body: Thanks a lot for such a great post.it is helping me lot. hope so these code help you. public static String houghTransform(Mat original_image, String outFile) { Mat imgSource = original_image; Mat untouched = original_image.clone(); Imgproc.cvtColor(imgSource, imageGray, Imgproc.COLOR_RGB2GRAY); Imgproc.GaussianBlur(imgSource, imgSource, new Size(11,11), 0); // 2) AdaptiveThreshold -&gt; classify as either black or white Imgproc.adaptiveThreshold(imgSource, imgSource, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 5, 2); // 3) Invert the image -&gt; so most of the image is black Core.bitwise_not(imgSource, imgSource); // 4) Dilate -&gt; fill the image using the MORPH_DILATE Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_DILATE, new Size(3,3), new Point(1,1)); Imgproc.dilate(imgSource, imgSource, kernel); // Imgproc.GaussianBlur(imgSource, imgSource, new Size(5, 5), 0); // // // adaptive threshold thresholds the image taking an optimum value for a // // local neighbourhood. // // Imgproc.adaptiveThreshold(imgSource, imgSource, 255, // // Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY, 3, 1); // // // convert the image to black and white does (8 bit) // Imgproc.Canny(imgSource, imgSource, 20, 60); Mat lines = new Mat(); int threshold = 80; int minLineSize = 40; int lineGap = 20; Imgproc.HoughLinesP(imgSource, lines, 1, Math.PI / 2, threshold, minLineSize, lineGap); ArrayList&lt;Point&gt; corners = new ArrayList&lt;Point&gt;(); for (int i = 0; i &lt; lines.cols(); i++) { for (int j = i + 1; j &lt; lines.cols(); j++) { Point pt = computeIntersect(lines.get(0, i), lines.get(0, j)); if (pt.x &gt;= 0 &amp;&amp; pt.y &gt;= 0) corners.add(pt); } } if (corners.size() &lt; 4) { return ""; } Point center = new Point(0, 0); // Get mass center for (int i = 0; i &lt; corners.size(); i++) { center.x += corners.get(i).x; center.y += corners.get(i).y; } center.x = (center.x / corners.size()); center.y = (center.y / corners.size()); ArrayList&lt;Point&…
has comment: http://stackoverflow.com/comment/47228199
has comment: http://stackoverflow.com/comment/47228152
has comment: http://stackoverflow.com/comment/47228966
score: 0
has comment: http://stackoverflow.com/comment/47227785
upvote count: 1
has comment: http://stackoverflow.com/comment/47228647
downvote count: 1
has comment: http://stackoverflow.com/comment/47227245

http://stackoverflow.com/q/23896586
upvote count: 14
type: UnansweredQuestion
has body: I have the following enum declaration: @Document @JsonFormat(shape= JsonFormat.Shape.OBJECT) @JsonAutoDetect() public enum Compass { north("Upper Center"), south("Lower Center"), east("Left Center"), west("Right Center"), ne("Upper Right"), nw("Upper Left"), se("Lower Right"), sw("Lower Left"), ; @JsonProperty private String presentableName; @JsonProperty private String name; private Compass() {} private Compass(String presentableName) { this.presentableName = presentableName; } public String getPresentableName() { return presentableName; } public void setPresentableName(String presentableName) { this.presentableName = presentableName; } public String getName() { return name; } public void setName(String name) { this.name = name; } @JsonCreator public static Compass fromObject(@JsonProperty("name") String name, @JsonProperty("presentableName") String presentableName) { return Compass.sw; } } The input arrives as a json object and most of it is deserialized correctly, but the relevant part is as below, where placement is a Compass: {"placement":{"name":"se","presentableName":"Lower Right"}} Deserialization doesn't work. I thought a JsonCreator would work here, but for some reason I'm getting a org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported which is actually just a symptom of deserialization failure. If I change the creator to: @JsonCreator public static Compass fromObject(@JsonProperty("name") String name) { return Compass.sw; } It gets even more wierd, because now name equals { instead of se (which looks like a bug in the json object, but it's the same object that got deserialized a second ago so it's probably ok) I'm using jackson 2.2.3 which is the latest right now.
type: Question
score: 14
tagged with: enums
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36793613
has answer: http://stackoverflow.com/a/24553806
answer count: 2
has title: Deserializing enum Shape.OBJECT using Jackson fails
downvote count: 0
tagged with: jackson
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/44828782

http://stackoverflow.com/a/23850138
answers question: http://stackoverflow.com/q/23849954
has body: Try: public static&lt;X&gt; UnaryOperator&lt;X&gt; iterate(UnaryOperator&lt;X&gt; f, int n) { ... } If Y &lt;: X, then a function from X to Y is also a function from X to X, and you should be able to do what you want.
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/23849954

http://stackoverflow.com/a/24148415
answers question: http://stackoverflow.com/q/23893928
has comment: http://stackoverflow.com/comment/59738548
score: 2
has body: The plugin generates the HTML report from json. So the first step is to have cucumber generate the json. When I ran into the same issue I found the cause of this the problem is that the cucumber.json file does not exist. I addressed this in my project by adding json:target under the @CucumberOptions annotation, this then generated the json. for example @CucumberOptions(features = "src/test/resources/features/some.feature", monochrome = false, format = {"pretty", "json:target/cucumber.json"}) The masterthought plugin then processes the generated JSON by looking for it at ${project.build.directory}/cucumber.json At this point the Maven plugin generates the HTML from the JSON.
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/23860102
has body: To scan everything for each row and a particular column family, instantiate a Scan object like shown below. Scan scan = new Scan(); //creating a scan object for all rows. scan.addFamily(byte[] column_family); // adding your required column family to scan object. ResultScanner scanner = table.getScanner(scan); for (Result result : scanner) { // ....... }
score: 0
answers question: http://stackoverflow.com/q/23858413
type: Answer

http://stackoverflow.com/a/23926013
type: Answer
answers question: http://stackoverflow.com/q/23925847
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23925847
has body: You can create a line by adding a view to your xml. Vertical line: &lt;View android:layout_width="1dip" android:layout_height="fill_parent" android:background="#FF0000FF" /&gt; Horizontal line: &lt;View android:layout_width="fill_parent" android:layout_height="1dip" android:background="#FF0000FF" /&gt; Adjust the background color to your desired line color.
score: 1
has comment: http://stackoverflow.com/comment/36997823
has comment: http://stackoverflow.com/comment/36997773
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23866256
type: Question
has answer: http://stackoverflow.com/a/23866387
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/23884598
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36736649
has body: I try to cleanup incoming Strings (invisible controll characters and separators except whitespace) but I can't clean them all. Still get some uncleaned ones. I am using following regex expression: String cleanedPart = codePart.trim().replaceAll("[\\p{Zl}\\p{Zp}\\p{C}]+", ""); I also have a simple junit test: assertEquals("one.two.thr%ee.fou rrr.bla", Cleaner.cleanupString(" one. two . thr%ee\n\t\r .fou rrr \t.bla ")); assertEquals("one...two.thr%ee....", Cleaner.cleanupString(" one...two. thr%ee\n\t\r . ... ")); assertEquals("one...two.thr%ee....", Cleaner.cleanupString("one\r...two.thr%ee.... ")); assertEquals("onetwo", Cleaner.cleanupString("one\rtwo")); assertEquals("...one.two.three..four...", Cleaner.cleanupString("...one.two.three..four...")); But in my live system I get still some Strings with a "CR" like in line 1 and 3: Anybody here has an idea?
tagged with: java
has title: Replace all invisible controll characters and separators except whitespace

http://stackoverflow.com/comment/36778964
has text: @Hirak thank you for solution, sorry for misunderstanding. It works perfectly, just needed to use it as a function.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23885064
type: Comment

http://stackoverflow.com/comment/36688280
type: QuestionComment
score: 2
has text: How on earth do you want to do that from UI level? Is there a reason you can't use [Youtube API](https://developers.google.com/youtube/getting_started)?
comment on: http://stackoverflow.com/q/23841845
type: Comment

http://stackoverflow.com/q/23825247
has title: Tomcat user file access rights
type: UnansweredQuestion
tagged with: beagleboneblack
tagged with: java
type: Question
has body: I have a tomcat web application running in a beagle bone black. Inside this application, some pins can be controlled: private static final String GPIO_DIR = "/sys/class/gpio"; public static void enablePin(int gpio) { try (RandomAccessFile out = new RandomAccessFile(new File(GPIO_DIR + "/export"), "rw")) { out.write(("" + gpio).getBytes()); } catch (IOException io) { //possibly the pin was already enabled log.trace("Not able to enable pin", io); } } The problem is that the files in gpio folder are protected. How can I configure the access rights of tomcat7 to be able to access those files. The current access rights of export are ls -l --w------ 1 root root ..... If I change the access rights with chmod, they will be set to default after restarting the system.
answer count: 1
tagged with: tomcat
score: 0
tagged with: linux
has answer: http://stackoverflow.com/a/23825658

http://stackoverflow.com/comment/36601640
type: AnswerComment
score: 0
type: Comment
has text: Thank you very much. I forgot to change it when I copied.. This worked.
comment on: http://stackoverflow.com/a/23796356

http://stackoverflow.com/q/23806744
tagged with: java
has title: Arraylist as Message when sending mail
type: Question
score: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/23806845
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23806845
type: AnsweredQuestion
tagged with: sendmail
has body: I have this arraylist; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); I have populate this arraylist from some DB queries and i must send this list as e-mail. public void sendMail(ArrayList carriers) throws Exception { Email email = new SimpleEmail(); email.setHostName("mail.test.com.tr"); email.setSmtpPort(587); email.setAuthentication("testuser@mail.test.com.tr","testuserpass"); email.setSSLOnConnect(false); email.setFrom("testuser@mail.test.com.tr"); email.setSubject("Test Information List"); email.setMsg("Last 1 hour Information;\n"+carriers); email.addTo("test@mail.test.com.tr"); email.send(); System.out.println("email sended succesfully."); } When i call this sendMail(list); method mail came to my mailbox succesfully. But all strings in this list showing side by side in message body normally. I want all strings align vertically.Let me explain; Now; trying1, trying2, trying3 Desired format; trying1 trying2 trying3 How can i handle it? --SOLVED-- StringBuilder b = new StringBuilder(); for(Object carrier : carriers) b.append(carrier).append("\n"); String carriersString = b.toString(); Above lines added to sendMail() method, beginning of code. And below lines editing to; email.setMsg("Last 1 hour Information;\n"+carriersString); Thanks to @Icewind

http://stackoverflow.com/a/23867519
answers question: http://stackoverflow.com/q/23867459
has body: But it gets executed, because once one of the case satements is true the flow of execution "falls trough" see here for some information
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/36802679
has text: (This is generally true for all the C-based languages.)
type: QuestionComment
comment on: http://stackoverflow.com/q/23901542
score: 0
type: Comment

http://stackoverflow.com/q/23803324
has comment: http://stackoverflow.com/comment/36633149
has title: Dynamic Sql qyery using prepare statement
has comment: http://stackoverflow.com/comment/36614899
has answer: http://stackoverflow.com/a/23803742
has comment: http://stackoverflow.com/comment/36614654
has body: Hii i want to create a dynamic query for filtering products. I want filter product from PRODUCTS table on the basis of certain parameters like Brand Flavour Price Size Type i am creating a function in which i am executing MySQL query i want to check which parameter user has used which parameter is used those value will not be null and rest of the not selected parameters will be null. so i am checking the function which is null which is not and passing them in query I have tried the following code but it shows null pointer execption with following message You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 and u tried printing the query: SELECT * FROM products WHERE 1=1 AND brand in (?,? AND Price &lt; ? AND Size &lt; ? AND Type = ? Follwing is the code: public List&lt;Products&gt; Filter_Itemsl(String[] Brand, String[] Flavour, float Price, float Size, String Type) { List&lt;Object&gt; parameters = new ArrayList&lt;Object&gt;(); ResultSet rs; List&lt;Products&gt; data = null; PreparedStatement stmt; try { StringBuilder query = new StringBuilder("SELECT * FROM products WHERE 1=1"); if (Brand != null) { query.append(" AND brand in ("); for (int i = 0; i &lt; Brand.length; i++) { query.append('?'); if (i &lt; Brand.length - 1) { query.append(','); } parameters.add(Brand[i]); } } if (Flavour != null) { query.append(" AND Flavour in ("); for (int i = 0; i &lt; Brand.length; i++) { query.append('?'); if (i &lt; Flavour.length - 1) { query.append(','); } parameters.add(Flavour[i]); } } if (Price != 0) { query.append(" AND Price &lt; ?"); parameters.add(Price); } if (Size != 0) { query.append(" AND Size &lt; ?"); parameters.add(Size); } if (Type != null) { query.append(" AND Type = ?"); parameters.add(Type); } String Query = query.toString(); System.out.println(Query); stmt = DataBaseConnection.DBConn.getConnection().prepareStatement(Query); int i = 1; for (Object parameter : para…
has answer: http://stackoverflow.com/a/23803454
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/36615206
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36614793
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36614506
has comment: http://stackoverflow.com/comment/36614299
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36633190
tagged with: mysql
upvote count: 1
downvote count: 1
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/36615000
has comment: http://stackoverflow.com/comment/36614716
type: UnansweredQuestion

http://stackoverflow.com/a/23812837
has comment: http://stackoverflow.com/comment/36633015
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36632533
type: Answer
accepted answer of: http://stackoverflow.com/q/23812764
score: 8
has body: How can i have the original value in a double variable? You can't. The closest double to your original value is exactly 38.739793110376837148578488267958164215087890625 That's being converted to "38.73979311037684" because that's the shortest value which uniquely identifies that double value. From the documentation: How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type double. That is, suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument d. Then d must be the double value nearest to x; or if two double values are equally close to x, then d must be one of them and the least significant bit of the significand of d must be 0. If you want to retain exactly your original value, you should be using BigDecimal.
downvote count: 0
answers question: http://stackoverflow.com/q/23812764
has comment: http://stackoverflow.com/comment/36632892
upvote count: 8

http://stackoverflow.com/comment/36653811
type: QuestionComment
has text: Have you tried `DateFormat.getDateInstance(DateFormat.SHORT).format(convertedDate)`?
comment on: http://stackoverflow.com/q/23823856
type: Comment
score: 2

http://stackoverflow.com/a/23831273
upvote count: 3
has comment: http://stackoverflow.com/comment/36667469
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23828229
accepted answer of: http://stackoverflow.com/q/23828229
has body: Your setup disables Spring Boot to do its magic. Instead of setting up the container yourself let Spring Boot handle it. You can simply add your JettyServerCustomizer to the configuration as a @Bean. This will execute it and you can do your registration of whatever you need. This still allows Spring Boot to do its magic and you have registered the additional endpoint y ou need. Another solution could be to add the servlet as a ServletRegistrationBean to your configuration it will then automatically be added by Spring Boot.
type: Answer

http://stackoverflow.com/comment/36634337
score: 0
has text: See this post http://stackoverflow.com/questions/19740604/java-lang-runtimeexception-android-os-networkonmainthreadexception-api-level-18
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23813704

http://stackoverflow.com/a/23871650
accepted answer of: http://stackoverflow.com/q/23858601
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37397032
type: Answer
has comment: http://stackoverflow.com/comment/36771237
has comment: http://stackoverflow.com/comment/37389889
has comment: http://stackoverflow.com/comment/37389860
has body: Exceptions thrown in JSNI methods are exposed to the Java code as JavaScriptExceptions, and you can easily wrap the object caught in JS in a JavaScriptException if you need to give it to GWT APIs that need an exception (such as GWT.log). try { … } catch (e) { var ex = @com.google.gwt.core.client.JavaScriptException::new(Ljava/lang/Object;)(e); @com.google.gwt.core.client.GWT::log(Ljava/lang/String;Ljava/lang/Throwable;)("Error doing …", ex); } In GWT 2.6.1+ you can use JsonLogRecordClientUtil.throwableAsJson(e) to turn any exception into a String to, e.g. send it to your server or display it. In GWT 2.6.0+ you can use GWT.reportUncaughtException to report any exception to the UncaughtExceptionHandler if any, or to the browser otherwise: try { … } catch (e) { var ex = @com.google.gwt.core.client.JavaScriptException::new(Ljava/lang/Object;)(e); @com.google.gwt.core.client.GWT::reportUncaughtException(Ljava/lang/Throwable;)(ex); } That said, in most case you don't need this: just let the exception propagate outside your JSNI method and catch the JavaScriptException in Java-land.
score: 5
has comment: http://stackoverflow.com/comment/36746272
upvote count: 5
answers question: http://stackoverflow.com/q/23858601

tabs
type: Tag
tag name: tabs
tags question: http://stackoverflow.com/q/23866755
tags question: http://stackoverflow.com/q/23871094
tags question: http://stackoverflow.com/q/23885292

http://stackoverflow.com/comment/36839787
type: Comment
comment on: http://stackoverflow.com/q/23921254
score: 0
type: QuestionComment
has text: setLayout(null) could do the trick, but i would not reccomend that, it's good for starting with few components, but unusable for acctuals projects. Read some LayoutManager tutorials

http://stackoverflow.com/q/23828946
has answer: http://stackoverflow.com/a/23829126
has answer: http://stackoverflow.com/a/23829077
has title: Java: Thread doesn't work
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23830014
tagged with: multithreading
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/23829054
tagged with: java
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/36663769
has answer: http://stackoverflow.com/a/23829087
downvote count: 0
has answer: http://stackoverflow.com/a/23828996
has body: I'm trying to start a thread in a for-loop. This task should only wait for a second (Thread.sleep()), so every time the loop starts over again, a new thread is started and it should cause the code after the thread to wait until it is executed. public void count() { for(int i = 29; i&gt;=0; i--) { Thread t1; t1 = new Thread(new TimerClass()); t1.start(); String s = String.valueOf(i); jLabel6.setText(s); System.out.println(s); } } public class TimerClass implements Runnable{ @Override public void run() { try{ Thread.sleep(1000); System.out.println("Timer"); } catch(InterruptedException e) { } } } As you can see, I implemented in both methods System.out.println() to check if they are actually executed. I get this: 29 28 27 26 ...//25 - 3 2 1 0 Timer Timer Timer //in all 29 times Timer So it should be 29, Timer, 28, Timer and so on, but it isn't. Does anyone know what's wrong with the code? Thanks a lot.
linked to: http://stackoverflow.com/q/1036754
has answer: http://stackoverflow.com/a/23829706
has answer: http://stackoverflow.com/a/23829166
has comment: http://stackoverflow.com/comment/36662992

http://stackoverflow.com/a/23832338
accepted answer of: http://stackoverflow.com/q/23831728
has body: There is a typo in your configuration: change the "other methods" tx matching to the following: &lt;tx:method name="*" propagation="REQUIRED"/&gt;
answers question: http://stackoverflow.com/q/23831728
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/23792212
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23792127
answers question: http://stackoverflow.com/q/23792127
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You also need to retain the annotation at runtime. When you specify RetentionPolicy.CLASS, this is not done as the doc says: Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time. So change it to @Retention(RetentionPolicy.RUNTIME)
score: 1

http://stackoverflow.com/a/23793861
has comment: http://stackoverflow.com/comment/36627739
has body: In your ContainerReponseFilter, you can do something like this: public class ApplicationResponseFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext request, final ContainerResponseContext response) throws IOException { // your code response.getEntity(); } } which converts it to your object with JAXB annotations. I was not doing it in my responseFilter, but I've just debugged it and it works.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23785789
downvote count: 0
answers question: http://stackoverflow.com/q/23785789
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36639495
has comment: http://stackoverflow.com/comment/36611577

http://stackoverflow.com/q/23833923
favorite count: 0
has comment: http://stackoverflow.com/comment/36677123
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23834340
upvote count: 3
tagged with: java
has body: I'm retrieving files list from FTPClient using ftpClient.listFiles(); and it returns an array with correct file names and appropriate quantity. I'm trying to read content from files, but only ftpClient.retrieveFileStream(fileName) is available for that purpose. And it somehow breaks after reading the first file and returns null. Is there a way to convert FTPFile directly into String? ftp.connect(); ftp.changeWorkingDirectoryToFrom(); List&lt;String&gt; idsList = new ArrayList&lt;String&gt;(); List&lt;String&gt; names = ftp.listFileNames(); for (String fileName : names) { String content = fromFTPFileToString(fileName); Matcher matcher = FILES_PATTERN.matcher(content); String id = extractId(content); if (matcher.find()) { boolean duplicate = idsList.contains(id); LOG.info("MATCHED: " + fileName); if (!duplicate) { ftp.moveFileFromTo(fileName); idsList.add(id); } else { LOG.info("DUPLICATE: " + fileName); duplicated++; ftp.deleteFileOnFromFtp(fileName); } } processed++; } ftp.disconnect(); private String fromFTPFileToString(String fileName) { String content = ""; try { InputStream is = ftp.readContentFromFTPFile(fileName); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer, ENCODING); content = writer.toString(); IOUtils.closeQuietly(is); IOUtils.closeQuietly(writer); } catch (Exception ex) { LOG.error(ex); } return content; } void deleteFileOnFromFtp(String fileName) { changeWorkingDirectory(properties.getProperty(PropertiesType.FOLDER_FROM.toString())); deleteFile(fileName); } InputStream readContentFromFTPFile(String fileName) { changeWorkingDirectory(properties.getProperty(PropertiesType.FOLDER_FROM.toString())); InputStream inputStream = null; try { inputStream = ftpClient.retrieveFileStream(fileName); } catch (IOException ex) { LOG.error("Unable to extract content from file:" + O_Q + fileName + C_Q); } return inputStream; } void moveFileFromTo(String fileName) { String from = FORWARD_SLASH + properties.getProperty(PropertiesType.FOLDER_FROM.toStrin…
has comment: http://stackoverflow.com/comment/36672615
type: Question
tagged with: apache-commons-net
downvote count: 0
has comment: http://stackoverflow.com/comment/36672861
accepted answer: http://stackoverflow.com/a/23834340
answer count: 1
has title: How to convert from org.apache.commons.net.ftp.FTPFile to String?

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/23827787
tag name: nosuchmethoderror

http://stackoverflow.com/comment/36707456
comment on: http://stackoverflow.com/a/23849830
has text: Thanks for the info. So as learning about the field access just means looking through the bytecode of whatever class/method happens to access the field? Since I'm working on a library that code will be user defined. Any ideas for how I could find the bytecode where the field is dereferenced? I suppose I could grab a stacktrace to see what is calling `detectFieldName`, but that doesn't seem ideal.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/48516441
comment on: http://stackoverflow.com/a/30189713
type: AnswerComment
score: 0
type: Comment
has text: Can U Please Use the link to download code may be you will get Clear View of Code.

http://stackoverflow.com/q/23888154
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36776195
answer count: 2
has comment: http://stackoverflow.com/comment/36776173
has comment: http://stackoverflow.com/comment/36776028
has title: get single column from multiple rows in mysql
has comment: http://stackoverflow.com/comment/36776151
score: 0
has comment: http://stackoverflow.com/comment/36777039
has answer: http://stackoverflow.com/a/23888928
has answer: http://stackoverflow.com/a/23888322
favorite count: 0
has comment: http://stackoverflow.com/comment/36777372
has body: i have two rows as show in below image.i want to get it as a single column based on aday(TUE) in the table,please any help me how to workout this. thanks in advance
has comment: http://stackoverflow.com/comment/36776689
upvote count: 1
possible better answer: http://stackoverflow.com/a/23888322
downvote count: 1
has comment: http://stackoverflow.com/comment/36776725
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23888928
tagged with: java
tagged with: database

http://stackoverflow.com/a/23842066
downvote count: 0
score: 1
has body: The changes that I made to my code to make it work are In my Customer.hbm.xml file I changed the type of column from type="String" to type="string" In the hibernate.cfg.xml file I had create the table in database already so I commented create The problem seems to be system specific because the code was working without any hiccups in my home computer but was showing org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml error in my office computer. At home I am using Eclipse Kepler, Tomcat 7 and hibernate 3.6.4 Final In office there is Eclipse Galileo , Tomcat 6 and hibernate 3.x.x I am not really sure want really solved the problem or the problem crept-in in the first place.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23821265

http://stackoverflow.com/comment/36722668
has text: Is it a problem that the order is changed? Or does it just surprise you? Often, when you want a key-value mapping, order of the key-value pairs doesn't matter.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23859686
type: QuestionComment

http://stackoverflow.com/a/23830667
downvote count: 0
has body: Try to imagine that 10 people have messages they need to deliver. Another 10 people are expecting messages from the previous group. In an open environment, each person in the first group would have to deliver their message to the recipient manually, so each person has to visit at least one member of the second group. This is inefficient and chaotic. In broker, there is a control class (in this case the postman) who receives all the messages from group one. The broker then organizes the messages based off destination and does any operations needed, before visiting each recipient once to deliver all messages for them. This is far more efficient. In software design, this lets remote and heterogeneous classes communicate with each other easily. The control class has an interface which all incoming messages can interact with so a sorts of messages can be sent and interpreted correctly. Keep in mind this is not very scalable, so it loses effectiveness for larger systems. Hope this helped!
type: Answer
upvote count: 52
accepted answer of: http://stackoverflow.com/q/23830413
answers question: http://stackoverflow.com/q/23830413
has comment: http://stackoverflow.com/comment/36666665
score: 52
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36666536

http://stackoverflow.com/q/23919303
has body: This is related to this other question: Last evaluated expression in Javascript But I wanted to provide more details about what I wanted to do and show how I finally solved the problem as some users requested in the comments. I have snippets of Javascript that are written by users of my app. This snippets need to go to a kind of template like this: var foo1 = function(data, options) { &lt;snippet of code written by user&gt; } var foo2 = function(data, options) { &lt;snippet of code written by user&gt; } ... Expressions can be very different, from simple things like this: data.price * data.qty To more complex tings like this: if (data.isExternal) { data.email; } else { data.userId; } The value returned by the function should be always the last evaluated expression. Before we had something like this: var foo1 = function(data, options) { return eval(&lt;snippet of code written by user&gt;); } But due to optimizations and changes we are making, we cannot keep using eval, but we need to return the last evaluated expression. Just adding a 'return' keyword won't work because expressions can have several statements. So I need to make those functions return the last evaluated expressions. Restrictions and clarification: I cannot force users to add the 'return' keyword to all the scripts they have because there are many scripts written already and it is not very intuitive for simple expressions like 'a * b'. I'm using Java and Rhino to run Javascripts on server side.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23897320
type: Question
tagged with: rhino
tagged with: java
tagged with: javascript
score: 0
tagged with: abstract-syntax-tree
has title: Get last evaluated expression inside function
answer count: 1
has answer: http://stackoverflow.com/a/23919304
accepted answer: http://stackoverflow.com/a/23919304

http://stackoverflow.com/comment/36857857
comment on: http://stackoverflow.com/q/23902842
score: 0
type: QuestionComment
type: Comment
has text: There is some better approach. A Hint i got was - Use smart ways to find the prime factors and then find the number of co prime pairs. Brute force wont work. But no possible solution :(

http://stackoverflow.com/a/23791348
type: Answer
accepted answer of: http://stackoverflow.com/q/23790271
answers question: http://stackoverflow.com/q/23790271
type: AcceptedAnswer
has body: Your solution works but with a slight modification like below. Remove the (?i) part if you dont want to take case sensitivity into account. public class StringReplacer { public static void main(String[] args) { String str1 = "New York"; String str2 = "New Jersy"; for(String s : str1.split("(?i)[" + str2 +"]")){ if(s.trim().length() &gt; 0){ str1 = str1.replace(s, "+"); } } System.out.println(str1); // Prints New Y+r+ } }
score: 0

http://stackoverflow.com/a/23826334
has body: To revert a single file, you could use the CleanCommand: Set&lt;String&gt; paths = new HashSet&lt;String&gt;(); paths.add( ... ); git.clean().setPaths( paths ).call(); Unfortunately there is a bug that prevents the CleanCommand to reset files in sub-directories. If I interpret the '.' in git checkout -- . correctly you want to revert all changes in the work directory. The ResetCommand does that: git.reset().setMode( ResetType.HARD ).call(); This would also override the index with the contents from HEAD. If you don't care about the index, you could also read the file-contents from the HEAD commit and write them to the work directory yourself. Let me know if that is of interest for you and I will try to assemble a snippet that does so.
upvote count: 1
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23819900
answers question: http://stackoverflow.com/q/23819900
type: AcceptedAnswer

http://stackoverflow.com/comment/36835091
type: Comment
score: 1
has text: What is the purpose of this? By what it looks like, it will open up a new window, wait 2 seconds, then close it. But as you have put it in a loop, you wont notice the second window being closed, probably just a fast, almost unnoticeable blink... If you want to get a slow blink, you should put another Thread.sleep(2000) after calling s.dispose();
comment on: http://stackoverflow.com/q/23918620
type: QuestionComment

http://stackoverflow.com/comment/36582244
has text: I usually use a super lightweight struct-like class to achieve this
comment on: http://stackoverflow.com/q/23786246
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36604576
score: 0
type: Comment
has text: Can u tell me how to implement your code with format java for android?
type: AnswerComment
comment on: http://stackoverflow.com/a/23798019

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/23827757
tags question: http://stackoverflow.com/q/23814615
tags question: http://stackoverflow.com/q/23806764
tags question: http://stackoverflow.com/q/23778810
tags question: http://stackoverflow.com/q/23908617
type: Tag
tags question: http://stackoverflow.com/q/23925656
tags question: http://stackoverflow.com/q/23812292

http://stackoverflow.com/comment/36797611
comment on: http://stackoverflow.com/q/23898855
score: 0
type: Comment
type: QuestionComment
has text: but the input is not always -0500, it may be -0300,+500 etc too.. I want to take them all, then convert them to my own timezone

http://stackoverflow.com/comment/36661136
score: 1
has text: I assume that the view is in the fragment layout (fragment_main.xml) and not in the activity layout (activity_main.xml). Like explained already, the method onCreate() is too early in the lifecycle to find it in the activity view hierarchy, and a null is returned. Invoking a method on null causes the NPE. Move the code in this case to the fragment onCreateView(). I edited my response above.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23826970

http://stackoverflow.com/a/23792727
score: 3
accepted answer of: http://stackoverflow.com/q/23792441
downvote count: 0
has body: You should never explicitly call the paintComponent method of any component. If you want to do custom painting, then you would instead create a custom class that extends JPanel/JComponent and @Override the paintComponent method. See more at Performing Custom Painting JPanel panel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(...); } // also override getPreferredSize() }; The easiest, and probably more correct, solution is just to use a JLabel and an ImageIcon instead of trying to custom painting. Image img = ImageIO.read(new URL(ClassLoader.getSystemResource("Icon_Entrey_21.png"), "img")); JLabel panel = new JLabel(new ImageIcon(img)); contentPane.add(panel, BorderLayout.NORTH);
has comment: http://stackoverflow.com/comment/36594980
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36594774
type: Answer
answers question: http://stackoverflow.com/q/23792441
has comment: http://stackoverflow.com/comment/36595047

http://stackoverflow.com/q/23884861
favorite count: 0
accepted answer: http://stackoverflow.com/a/24071294
has comment: http://stackoverflow.com/comment/36773011
has comment: http://stackoverflow.com/comment/36770329
has answer: http://stackoverflow.com/a/24071294
type: AnsweredQuestion
has body: I use hibernate v4.2.7.Final Table structure is : CREATE TABLE "OWNER"."TABLE" ( "COL1" VARCHAR2(20 BYTE), "COL2" VARCHAR2(20 BYTE), "COL3" VARCHAR2(20 BYTE), "COL4" VARCHAR2(20 BYTE), "COL5" VARCHAR2(20 BYTE) ) ; Method code source : @SuppressWarnings("rawtypes") public List&lt;?&gt; getAllPropertyValues(String property) { logger.debug("finding all {} from TABLE", property); try { // Set the session ... String query = String.format( "SELECT DISTINCT t.%s, t.col2 FROM TABLE t ORDER BY t.col2", property.toUpperCase()); logger.debug("query : '{}'", query); SQLQuery results = session.createSQLQuery(query); List list = null; if (null != results) { list = results.list(); } session.getTransaction().commit(); return list; } catch (RuntimeException re) { logger.error("find all failed", re); throw re; } } Why does results is null ? But the SQL Query in SQLDEVELOPER returns 50 results... This @SuppressWarnings("rawtypes") public List&lt;?&gt; getAllPropertyValues(String property) { logger.debug("finding all {} from TABLE", property); try { // Set the session ... String query = String.format("SELECT DISTINCT t.id.%s, t.id.col2 FROM Table t ORDER BY t.id.col2", property.toLowerCase()); logger.debug("query : '{}'", query); Query results = session.createQuery(query); // query is NOT NATIVE SQL here, THIS IS HQL List list = null; if (null != results) { list = results.list(); } session.getTransaction().commit(); return list; } catch (RuntimeException re) { logger.error("find all failed", re); throw re; } } resolve the problem. But this is not native SQL. I'm curious to know why native SQL do not work here ? Can someone explain why ? And how can I use native SQL here ?
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36771214
has comment: http://stackoverflow.com/comment/36770516
has title: Why does native SQL do not work?
has comment: http://stackoverflow.com/comment/36774266
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36771899
has comment: http://stackoverflow.com/comment/37120021
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/36772442
has comment: http://stackoverflow.com/comment/36772683
has comment: http://stackoverflow.com/comment/36770011
has comment: http://stackoverflow.com/comment/36771097
answer count: 1

http://stackoverflow.com/comment/36573010
has text: Okay, that explains that. Thank you vera much! How do I set the loop? And how do I send a String back to the web socket?
comment on: http://stackoverflow.com/a/23781032
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23879721
tagged with: assert
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23879965
tagged with: field
has answer: http://stackoverflow.com/a/23879973
has answer: http://stackoverflow.com/a/23879791
favorite count: 0
has body: So I have some code that creates a custom class ArrayUtil, then checks to see if the result of a method in the ArrayUtil class is equal to a certain string. The code that I have to insert in to the main() method will go where [???] is currently. class ArrayUtil{String opening="["; String closing="]"; String separator=", "; public final String format(Object[]array){ String result=opening; if(array.length==0)return result+closing; for(int i=0;i&lt;array.length-1;i++){ result+=array[i]+separator; } return result+array[array.length-1]+closing; } } public class Exercise{ public static void main(String [] arg){ ArrayUtil u=(new ArrayUtil(){[???]}); assert "[1; 2; 3]".equals(u.format(new Integer[]{1,2,3})); assert "[4; 5; 6]".equals(u.format(new Integer[]{4,5,6})); assert "[7; 8; 9]".equals(u.format(new Integer[]{7,8,9})); } } I've identified what the issue is. String separator (in class ArrayUtil) is "," , whereas the main() method is looking for ";". What I'm stuck on is changing the separator field's value into ";". I've tried to change separator like this: ArrayUtil u=(new ArrayUtil(){String separator = ";";}); It's not correct. So my question is: how do I get my String separator to change it's value from the main method?
has title: Changing a field's value from another method
possible better answer: http://stackoverflow.com/a/23879791
upvote count: 1
accepted answer: http://stackoverflow.com/a/23879965
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: class
type: Question

http://stackoverflow.com/comment/36644088
has text: Please read the Help Center. Also, consider using a debugger.
comment on: http://stackoverflow.com/q/23818713
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23879650
has answer: http://stackoverflow.com/a/23880048
has comment: http://stackoverflow.com/comment/36760166
has comment: http://stackoverflow.com/comment/36760788
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36760725
score: 0
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/23880048
has comment: http://stackoverflow.com/comment/36760096
tagged with: java
has comment: http://stackoverflow.com/comment/36760163
has comment: http://stackoverflow.com/comment/36760183
has title: Editing nested JDialog in Netbeans' Design mode
linked to: http://stackoverflow.com/q/2561480
has body: Say I have the following code: public class MainDialog extends javax.swing.JFrame { static class SubDialog extends javax.swing.JDialog { } } If I open 'MainDialog.java' in design mode, I can only edit the GUI of the MainDialog class. Is there anyway to edit the SubDialog class in design mode? Thanks
has comment: http://stackoverflow.com/comment/36760783
answer count: 1
tagged with: nested-forms
tagged with: jdialog
has comment: http://stackoverflow.com/comment/36760663
has comment: http://stackoverflow.com/comment/36760593
has comment: http://stackoverflow.com/comment/36760205

http://stackoverflow.com/comment/37705995
has text: Yes, that is the right way for your problem. But I can't imagine how somebody is doing something so advanced without knowing something so basic. I have been programming Java for 2 years and I never came across the View Object.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23922791
type: AnswerComment

http://stackoverflow.com/comment/36706008
score: 0
has text: I cannot believe i did that. Thanks though.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23851092

http://stackoverflow.com/comment/36833928
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23918106
type: Comment
has text: Wunderbar. Thank you fine sir, it's exactly what I was looking for.

http://stackoverflow.com/a/37945521
has body: It's called an enhanced for loop. The first part, Card card, says that the current version of Card of this iteration is going to be called card. The second part, myDeck, is the array of Cards that you are iterating through. https://blogs.oracle.com/CoreJavaTechTips/entry/using_enhanced_for_loops_with
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23786433

http://stackoverflow.com/q/23794084
tagged with: synchronization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23836436
has body: It works when I sync with ONE String[], for example; String[] paths = new String[]{//path1,//path2,//path3,etc.}; it will sync all the files into ONE target folder, say "myFolder" IServer server = ServerFactory.getServer("myServer", null); server.connect(); server.setUserName("myUsername"); server.login("myPass"); IClient tempClient = new Client(); tempClient.setName("tempClient" + UUID.randomUUID().toString().replace("-", "")); tempClient.setRoot("myFolder"); tempClient.setServer(server); server.setCurrentClient(tempClient); ClientViewMapping tempMappingEntry = new ClientViewMapping(); tempMappingEntry.setLeft("//Connect/..."); tempMappingEntry.setRight("//" + tempClient.getName() + "/..."); tempMappingEntry.setType(EntryType.INCLUDE); ClientView tempClientView = new ClientView(); tempClientView.addEntry(tempMappingEntry); tempClient.setClientView(tempClientView); server.createClient(tempClient); try { List&lt;IFileSpec&gt; fileSpecsSet = FileSpecBuilder.makeFileSpecList(pathsUnderDepot);//**HERE** tempClient.sync(FileSpecBuilder.getValidFileSpecs(fileSpecsSet), true, false, false, false); } finally { server.deleteClient(tempClient.getName(), false); } However, when I want to sync more than one folders, it does not sync to my target folders. Here is what I got so far. The code is similar to the above with some changes: each folder F has multiples paths to sync from foreach forlder F in folderList { IServer server = ServerFactory.getServer("myServer", null); ..... ..... ..... ..... ..... tempClient.setRoot(F);//**HERE** ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... try { List&lt;IFileSpec&gt; fileSpecsSet = FileSpecBuilder.makeFileSpecList(F.paths);//**HERE** ..... } finally { ..... } My question is how can I implement the code work as I expected. I think that the error come from two places (where I label HERE in the code). Any helps or suggestions are appreciated. Quan.
tagged with: java
type: Question
tagged with: perforce
score: 0
answer count: 1
has title: Programatically syncing multiple paths with Perforce doesn't seem to work

http://stackoverflow.com/comment/36665450
type: QuestionComment
has text: If you are looping over a collection of entities, how are you freeing the memory? Without details, its hard to say this isn't just a problem with your application, such as having a heavily interconnected object model and keeping a reference to the root. You might also try lazily fetching the lob field by marking it lazy and using weaving http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving
comment on: http://stackoverflow.com/q/23830080
score: 0
type: Comment

http://stackoverflow.com/a/23810439
type: Answer
has comment: http://stackoverflow.com/comment/36629929
upvote count: 11
has body: It's not a wrapper, but actually java.lang.String. No need in additional hassle: » touch 123 » scala ... val foo = new java.io.File("123") // java.io.File = 123 // Get name is a java api, which returns Java string foo.getName.toInt // res2: Int = 123
has comment: http://stackoverflow.com/comment/36628230
has comment: http://stackoverflow.com/comment/36627773
score: 11
accepted answer of: http://stackoverflow.com/q/23810276
answers question: http://stackoverflow.com/q/23810276
has comment: http://stackoverflow.com/comment/36633591
has comment: http://stackoverflow.com/comment/36631432
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36628980
downvote count: 0
has comment: http://stackoverflow.com/comment/36628646
has comment: http://stackoverflow.com/comment/36633358
has comment: http://stackoverflow.com/comment/36627857
has comment: http://stackoverflow.com/comment/36629330
has comment: http://stackoverflow.com/comment/36631710

http://stackoverflow.com/comment/36628086
has text: Humm interesting I do not think I actually have a JDK on this machine. That would be bad. However I cannot find a 1.6 JDK to down load. If the only option is to just go with 1.7 and move on I will have to consider that. Scratch that there is a JDK on here and Eclipse knows about it. My impression came from the terminal java -version
score: 0
comment on: http://stackoverflow.com/q/23810403
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23937494
score: 1
tagged with: java
upvote count: 1
has title: Cannot deploy WebService with NetBeans and Glassfish server
type: Question
tagged with: glassfish
has body: I'm working on java netbeans webservice. I'm deploying the webservice successfully, but when I press Test Web Service. I get the error in the attached image. in the glassfish server output it's throw exceptions but I dont't know how to solve them. img1 img2 this is the glassfish server output: Info: Invoking wsimport with http://localhost:8080/AppleStoreServer/ShoppingWS?WSDL Info: parsing WSDL... Info: [WARNING] schema_reference: Failed to read schema document 'ShoppingWS?xsd=1', because 'http' access is not allowed due to restriction set by the accessExternalSchema property. Info: line 7 of http://localhost:8080/AppleStoreServer/ShoppingWS?WSDL#types?schema1 Warning: StandardWrapperValve[ShoppingWS]: Servlet.service() for servlet ShoppingWS threw exception java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: bundle://218.0:1/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'bundle' access is not allowed due to restriction set by the accessExternalSchema property. at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:80) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:237) at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95) at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141) at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444) at com.sun.tools.ws.wscompile.WsimportTool.ru…
has answer: http://stackoverflow.com/a/45963106
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25877274
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23938589
tagged with: netbeans

http://stackoverflow.com/a/70735100
score: 0
has body: Also to save list of apps to txt use this command: adb shell pm list packages -f &gt; d:\1.txt or if you want to save file to adb folder just use adb shell pm list packages -f &gt; installed-apps.txt
answers question: http://stackoverflow.com/q/23900697
type: Answer

junit4
tags question: http://stackoverflow.com/q/23932399
tags question: http://stackoverflow.com/q/23920872
tags question: http://stackoverflow.com/q/23874913
tags question: http://stackoverflow.com/q/23910743
tags question: http://stackoverflow.com/q/23849692
tags question: http://stackoverflow.com/q/23910822
type: Tag
tags question: http://stackoverflow.com/q/23810781
tag name: junit4

http://stackoverflow.com/comment/36854112
type: Comment
type: QuestionComment
has text: The only information I can find is from the [videolan wiki page on Java Bindings](https://wiki.videolan.org/Java_bindings/) *"At the moment the JVLC project is dead, as there is no maintainer for it. If you want information on it, see the wiki history"*
score: 0
comment on: http://stackoverflow.com/q/23928774

http://stackoverflow.com/comment/36680286
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23837847
has text: @SotiriosDelimanolis I was quoting from the Android docs, which don't mention that. I won't make that mistake again.
score: 0

http://stackoverflow.com/a/23875847
upvote count: 3
type: Answer
downvote count: 0
has body: Fundamental frequency detection for human voice is an active area of research, as the references below suggest. Your approach must be carefully designed and must depend on the nature of the data. For example if your source is a person singing a single note, with no music or other background sounds in the recording, a modified peak detector might give reasonable results. If your source is generalized human speech, you will not get a unique fundamental frequency for anything other than the individual formants within the speech. The graph below illustrates an easy detection problem. It shows the frequency spectrum of a female soprano holding a B-flat-3 (Bb3) note. The fundamental frequency of Bb3 is 233 Hz but the soprano is actually singing a 236 Hz fundamental (the left-most and highest peak.) A simple peak detector yields the correct fundamental frequency in this case. The graph below illustrates one of the challenges of fundamental frequency detection, even for individually sung notes, let alone for generalized human speech. It shows the frequency spectrum of a female soprano holding an F4 note. The fundamental frequency of F4 is 349 Hz but the soprano is actually singing a 360 Hz fundamental (the left-most peak.) However, in this case, the highest peak is not the fundamental, but rather the first harmonic at 714 Hz. Your modified peak detector would have to contend with these cases. In generalized human speech, the concept of fundamental frequency is not really applicable to any subset of longer duration than each individual formant within the speech. This is because the frequency spectrum of generalized human speech is highly time-variant. See these references: Speech Signal Analysis Human Speech Formants Fundamental frequency detection FFT, graphs, and audio data from Sooeet.com FFT calculator
score: 3
answers question: http://stackoverflow.com/q/23867867

http://stackoverflow.com/a/23901533
type: Answer
upvote count: 10
accepted answer of: http://stackoverflow.com/q/23901519
answers question: http://stackoverflow.com/q/23901519
has body: The ^ operator isn't the exponentiation operator in Java; it's the bitwise XOR operator, which doesn't make much sense with double arguments. You can either multiply the value by itself or you can call Math.pow(yourValue, 2) for exponentiation.
score: 10
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36610540
score: 0
comment on: http://stackoverflow.com/a/23801190
has text: The reason I am asking is that in my program I have to add JButtons in one column of Jtable where all the other values are fetched from database. So, the link I referred to had used the values to be filled in the code itself. Hence the used JButton button = (JButton)value; But I got error on doing so, hence instead of this line I wrote JButton button = new JButton("BUTTON NAME); and on doing this the buttons got displayed. But now I seem to use this object variable value somewhere else too in my code. So can you tell me how to to so ?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/64291026
comment on: http://stackoverflow.com/a/23797831
has text: Can the port be changed via the annotation?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36745139
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23871893
has text: Sadly there are no errors
type: Comment

http://stackoverflow.com/a/23879719
has comment: http://stackoverflow.com/comment/36761348
has comment: http://stackoverflow.com/comment/36760321
has comment: http://stackoverflow.com/comment/36760519
answers question: http://stackoverflow.com/q/23879656
downvote count: 0
has comment: http://stackoverflow.com/comment/36760545
score: 1
has comment: http://stackoverflow.com/comment/36760335
has comment: http://stackoverflow.com/comment/36760309
has comment: http://stackoverflow.com/comment/36760452
has comment: http://stackoverflow.com/comment/36760471
upvote count: 1
has comment: http://stackoverflow.com/comment/36776590
has body: String.indexOf(int ch) returns the index of a character. If you do sb.indexOf(' ') you'll get the first index of a space. You can use that in conjunction with substring(): sb.substring(0,sb.indexOf(' ')-1) will get you your first token. This seems like a homework problem, so I don't want to give you the full answer, but you probably can work it out. Comment if you need more help.
has comment: http://stackoverflow.com/comment/36760472
has comment: http://stackoverflow.com/comment/36760328
type: Answer

http://stackoverflow.com/a/27630476
type: Answer
has comment: http://stackoverflow.com/comment/59330937
has body: I realize this is an old question, but I came here looking for an answer as well, and then was able to figure it out myself, so putting my solution here for the next person with this problem. In my case, the clustering component is part of a Java application, so I don't have the option of using the Weka workbench. Here is what I did to pull out the id along with the cluster assignments. int[] assignments = kmeans.getAssignments(); for (int i = 0; i < assignments.length; i++) { int id = (int) data.instance(i).value(0); // cast from double System.out.printf("ID %d -> Cluster %d \n", id, assignments[i]); } Unlike the OP, I did not build my Instances from DataSource.getDataSet(), I built this manually from a database table, but the id field was the first one in my case as well, so I think the code above should work. I had a custom distance function that skipped the id field when computing similarity.
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/65780481
downvote count: 0
answers question: http://stackoverflow.com/q/23872807

http://stackoverflow.com/q/23906717
has answer: http://stackoverflow.com/a/23907074
tagged with: shell
tagged with: variables
has title: Pass a variable from Java to a Shell script
has answer: http://stackoverflow.com/a/23907078
accepted answer: http://stackoverflow.com/a/23907078
type: AnsweredQuestion
type: Question
tagged with: parameters
tagged with: java
has body: I am trying to run a shell script from a Java code. At the moment I am providing data manually in the script, but I would like to be able to provide the variables from the Java code that runs the script. This is the Java code and the script: public static void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder( "/home/najib/upload.sh"); Process p = pb.start(); p.waitFor(); System.out.println("Script executed successfully"); } catch (Exception e) { e.printStackTrace(); } } The shell code: #!/bin/bash /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="set AUTOCOMMIT MANUAL;"&amp; /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="delete from DB.DBA.load_list;"&amp; /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="SPARQL CREATE GRAPH &lt;VAR1&gt;;"&amp; /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="ld_dir('/home/najib', 'VAR2', 'VAR1');"&amp; wait /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="rdf_loader_run();" I would like to know where I can put the variables in the Java code, and how to then call it in run time! Edit: Based on the solutions provided, I changed the script to this: /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="SPARQL CREATE GRAPH &lt;$2&gt;;"&amp; /usr/local/virtuoso-opensource/bin/isql 1111 dba dba exec="ld_dir('/home/najib', '$1', '$2');"&amp; I also added an echo at the end of the script to see if the variables are being passed correctly, and it seems that they are. The first command (the SPARQL one) seems to work as the graph is indeed created, but the second one is not processed correctly..
score: 0
tagged with: bash
answer count: 2
possible better answer: http://stackoverflow.com/a/23907074

http://stackoverflow.com/q/23907498
has answer: http://stackoverflow.com/a/23907680
has title: JTextField.getInputContext() returns null value
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23907680
favorite count: 0
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/36813472
has body: In my Swing application, I use JTextField component to get Farsi text values. I want to set locale for this component by using the following code: txt_fname.getInputContext().selectInputMethod(new Locale("fa", "IR")); But txt_fname.getInputContext() returns null and the code throws a NullPointerException. How can I solve this problem? Edited the code is called in InternalJFrame constructor: public DriversList() { initComponents(); txt_fname.getInputContext().selectInputMethod(new Locale("fa", "IR")); }
has comment: http://stackoverflow.com/comment/36813702
upvote count: 1
tagged with: swing
tagged with: jtextfield
answer count: 1

http://stackoverflow.com/comment/36591938
type: QuestionComment
type: Comment
has text: You didn`t see button "More". Am i right?
comment on: http://stackoverflow.com/q/23789074
score: 0

http://stackoverflow.com/q/23836448
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23836534
tagged with: swing
has comment: http://stackoverflow.com/comment/36685802
tagged with: java
has body: Like in a topic, I've readed the most of all solutions for repaint() but for my code their are not working. I'm a begginer so forgive me a mess in my code.. class View.java public class View extends JFrame{ public void make(){ setSize(640,480); setVisible(true); setTitle("Parking"); } double x_ = MyFrame.x; double y_ = MyFrame.y; double odchylenie_ = MyFrame.odchylenie; int szerokosc = 50; int wysokosc = 30; public void paint(Graphics g){ Rectangle2D rect = new Rectangle2D.Double(-szerokosc / 2., -wysokosc / 2., szerokosc, wysokosc); AffineTransform transform = new AffineTransform(); transform.translate(x_, y_); transform.rotate(Math.toRadians(odchylenie_)); Shape rotatedRect = transform.createTransformedShape(rect); Graphics2D g2 = (Graphics2D)g; g2.draw(rotatedRect); } All I want to do to re-paint this rotatedRect with new values of x,y and odchylenie (sorry for polish variable names). I'm calculating new variable values and using Jbutton to redraw it. Here is my MyFrame.class public class MyFrame extends javax.swing.JFrame { static double x,y,odchylenie,kat; private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { View v = new View(); v.make(); Fuzzy f = new Fuzzy(); kat = f.wyjscie(x, odchylenie); jLabel5.setText("Kąt: " + Double.toString(kat)); odchylenie = Fuzzy.wyliczOdchylenie(odchylenie,kat); jLabel8.setText("Nowe odchylenie: " + Double.toString(odchylenie)); x = Fuzzy.wyliczX(x, 10, kat,odchylenie); jLabel6.setText("Nowy x: " + Double.toString(x)); y = Fuzzy.wyliczY(y,x, 10, kat,odchylenie); jLabel7.setText("Nowy y: " + Double.toString(y)); v.repaint(); //Not works } Instead of doing repaint(), the new window appears, and old one stays... I have tried to declare View v outside the button function body, but it not worked too(nothing is painting).
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 2
downvote count: 2
score: -2
has title: Repaint Java - I've read many questions, but still not working
favorite count: 0
tagged with: repaint
has answer: http://stackoverflow.com/a/23836513
upvote count: 0

http://stackoverflow.com/q/23871510
answer count: 1
has comment: http://stackoverflow.com/comment/36744874
tagged with: libgdx
has body: I have, up till now been loading all textures into my AssetManager class by - manager.load("images/image_1.png", Texture.class); this has been working perfectly but I am working on a project that uses a very large number of small images and would like to use a more generic way of loading these files. I have tried - FileHandle[] fileArray = Gdx.files.internal("images").list(); for(int i=0; i&lt;fileArray.length; i++){ //if it is not a directory if(!(fileArray[i].isDirectory())){ String stringPath = fileArray[i].path(); //load file manager.load(stringPath, Texture.class); } } this works but it takes a long time compared to the previous method. first of all why? is the time its taking due to obtaining a list of FileHandle instances? and secondly, is there a way to load all images from a directory into the Asset manager as Textures that will not take this long?
upvote count: 4
type: AnsweredQuestion
has title: libGDX loading all images from directory into AssetManager in loop taking ages
downvote count: 0
has answer: http://stackoverflow.com/a/23883226
favorite count: 0
has comment: http://stackoverflow.com/comment/36747352
type: Question
score: 4
has comment: http://stackoverflow.com/comment/36744594
accepted answer: http://stackoverflow.com/a/23883226
tagged with: java

http://stackoverflow.com/comment/36855379
comment on: http://stackoverflow.com/q/23929904
score: 0
type: Comment
type: QuestionComment
has text: i am entry level in sql

http://stackoverflow.com/a/23863650
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36730242
answers question: http://stackoverflow.com/q/23863475
has body: Start by having a look at Basic I/O Essentially, you need to do a recursive search of the directories you want to include and append the contents to some other file For example, you could simply create a BufferedWriter which allows you to write content to a, in this case, specific file (or master file)... public static void main(String[] args) { File output = new File("Master-Part1.txt"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(output))) { findAndAppend(new File("."), bw); } catch (IOException exp) { exp.printStackTrace(); } } You need to scan a specific file for any matches (part1.txt) and append their contents to the BufferedWriter, if found. Once you've done the current directory, you need to try and scan the sub directories, if any... public static void findAndAppend(File parent, BufferedWriter bw) throws IOException { // Find any matching files... File files[] = parent.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().equals("part1.txt"); } }); // Append any results...technically there should only be 0-1 // matches, but this is a nice example ;) for (File file : files) { append(file, bw); } // Find the sub directories... File dirs[] = parent.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } }); // Scan the sub directories... for (File dir : dirs) { findAndAppend(dir, bw); } } Finally, you need to be able to write the content of any matches to your master file... protected static void append(File file, BufferedWriter bw) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader(file))) { String text = null; while ((text = br.readLine()) != null) { bw.write(text); bw.newLine(); } } finally { } } This example is using Java 7's try-with-resources functionality, so make sure you're running Java 7. Take a look at java.io.File for more details Updated with walkFileTree example (Java 7) public static void main(Strin…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36730072
has comment: http://stackoverflow.com/comment/36730112
has comment: http://stackoverflow.com/comment/36730048
has comment: http://stackoverflow.com/comment/36730059
type: Answer
has comment: http://stackoverflow.com/comment/36730023
accepted answer of: http://stackoverflow.com/q/23863475

http://stackoverflow.com/comment/36629179
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23810614
type: QuestionComment
has text: @Sully Brooks i have already followed your suggestion. thanks btw :)

http://stackoverflow.com/a/23860451
has body: Apache Math has a nice Descriptive Statistics package that does this sought of thing. http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.2_Descriptive_statistics If you're using Java 8 this works well with Lambdas: DescriptiveStatistics stats = new DescriptiveStatistics(); students.forEach(s -&gt; stats.add(s.age)); double mean = stats.getMean(); And to filter etc: //Only students with an age &gt; 18 students.stream.filter(s -&gt; s.age &gt; 18).forEach(s -&gt; stats.add(s.age)); If you're not using Java 8 then simply foreach it.
answers question: http://stackoverflow.com/q/23860170
accepted answer of: http://stackoverflow.com/q/23860170
type: Answer
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/36765646
type: QuestionComment
type: Comment
has text: &gt; is actually > (greater than symbol)
comment on: http://stackoverflow.com/q/23882693
score: 1

http://stackoverflow.com/q/23874230
tagged with: string
has title: How to compare strings using textview and buttons
has body: I am new to Java and having some difficulty comparing two strings inside a textView. Basically when a user clicks the fillfive button I want the method to set the text to whatever argument is relevant. For example the default string is "0" so when the user clicks the fillfive button if the string is "0" then it will set the string to "5" else if the string is already "5" it will set the string back to "0". Any pointers in the right direction would be most welcome, thanks. Currently in the code below this does not work because I only seem to ever get 0 so I'm guessing for some reason it's not checking the if statement properly. public void fillfive(View v) { if (v.toString().equals("0")){ TextView view = (TextView) findViewById(R.id.txt_fivecup); view.setText("5"); } else{ TextView view = (TextView) findViewById(R.id.txt_fivecup); view.setText("0"); } }
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23874272
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23874272

http://stackoverflow.com/comment/36808900
has text: actually, i'm doing many filtering with those selection, and my result is merely 15 tuples. I'm trying to find a way to iterate over that cartesian product and single out the tables.
comment on: http://stackoverflow.com/a/23904922
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36646823
comment on: http://stackoverflow.com/q/23812574
score: 0
type: Comment
has text: could you now pls highlight 55 line of your OpenBMI class?
type: QuestionComment

http://stackoverflow.com/a/23845352
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23845161
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23845161
has body: systemProperties needs to go inside javaexec: task cucumber(type: JavaExec) { dependsOn assemble, compileTestJava main = "cucumber.api.cli.Main" classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output args = ['-f', 'pretty', '--glue', 'steps', 'src/test/resources'] systemProperties = System.getProperties() } PS: Unless you absolutely need to combine multiple concerns into a single task, always prefer task types (e.g. JavaExec) over methods (e.g. javaexec).

http://stackoverflow.com/a/23911796
type: Answer
has comment: http://stackoverflow.com/comment/36822320
score: 2
has comment: http://stackoverflow.com/comment/36822405
has comment: http://stackoverflow.com/comment/36821880
accepted answer of: http://stackoverflow.com/q/23911665
upvote count: 2
answers question: http://stackoverflow.com/q/23911665
has body: Your rest service is listening on http://localhost:8081/<webappname>/api/api This is because you first define the root of the rest service to be api in your web.xml: Jersey REST Service /api/* And then you define your service class to be reachable by api: @Path("/api") If you change this to either @Path("") or /* it should be reachable by http://localhost:8081/<webappname>/api
has comment: http://stackoverflow.com/comment/36821353
has comment: http://stackoverflow.com/comment/36821931
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36821281
downvote count: 0

http://stackoverflow.com/q/23860009
downvote count: 0
has body: I'm working on a Mario game and am in need of assistance and suggestions on how to go about creating hit detection for a tilemap. Currently, the player has the ability to walk/jump through the blocks. I added in a fixed detection to the ground for now which I am hoping to replace with regular hit detection. I understand that there are four sides to each block and the player. Only some blocks need hit detection and some things you might need to know is that the player stays at 300px(middle of screen) 98% of the time. The only thing that moves is the map The map is rendered from a .txt file and is rendered like so: for(int y=0;y&lt;map.length;y++) { for(int x=0;x&lt;map[y].length;x++) { int index = map[y][x]; int yOffset = 0; if(index&gt;(tileSheet.getWidth() / Engine.TILE_WIDTH) -1) { yOffset++; index = index - (tileSheet.getWidth() / Engine.TILE_WIDTH); } g.drawImage(tileSheet, ((x * Engine.TILE_WIDTH)*scale)+position, ((y * Engine.TILE_HEIGHT)*scale), (((x * Engine.TILE_WIDTH) + Engine.TILE_WIDTH )*scale)+position, (((y * Engine.TILE_HEIGHT) + Engine.TILE_HEIGHT)*scale), index * Engine.TILE_WIDTH, yOffset * Engine.TILE_HEIGHT, (index * Engine.TILE_WIDTH) + Engine.TILE_WIDTH, (yOffset * Engine.TILE_HEIGHT) + Engine.TILE_HEIGHT, null ); } } //This code is actually longer(included file later on) Colour hit detection is too slow and inconsistent for multi coloured tiles Since the map is moving I suppose I need to move the hit detection boxes with it. As for selecting the boxes that it should detect might be difficult. Maybe it would be a better idea to make the code NOT hit detect certain tiles. My attempts have ended in obfuscation of code. Can anyone suggest the easiest way to implement the hit detection? (keep in mind I have jumping). The important codes are listed below: Board.java(The panel where everything is drawn) package EvilMario; //Include this class in the EvilMario game package import java.awt.*; //Imported to allow use of Image import java.awt.event.*; //…
score: 1
tagged with: java
tagged with: hit
has comment: http://stackoverflow.com/comment/36723292
type: Question
has comment: http://stackoverflow.com/comment/36726555
has comment: http://stackoverflow.com/comment/36723251
has comment: http://stackoverflow.com/comment/36723344
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26021389
favorite count: 0
has title: Hit detection in tilemaps
tagged with: detection
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36724780
tagged with: 2d

http://stackoverflow.com/comment/36843260
score: 0
type: Comment
has text: Thanks. Just two quick questions: Why did you need to implement BookDetails? and, how do you tell gson to map the value of "writer" in the json object to an instance of Author class and vice versa?
comment on: http://stackoverflow.com/a/23920099
type: AnswerComment

http://stackoverflow.com/q/23868957
has answer: http://stackoverflow.com/a/23869097
has answer: http://stackoverflow.com/a/23868985
has answer: http://stackoverflow.com/a/23869144
score: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/23869060
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23868984
upvote count: 1
downvote count: 1
type: Question
has title: Java String format error
has answer: http://stackoverflow.com/a/23868983
tagged with: java
has body: for some reason this string format is not working. It says that frameCount should be an object. I'm not importing any libraries at the moment. Does anyone know why it gives an error? frameRate is a String, frameCount is an int frameRate = String.format("FPS %s", frameCount);
answer count: 6

http://stackoverflow.com/q/23869768
has title: How To call class extending ClientRequestFilter for Client-side Filter
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23890238
tagged with: jax-ws
type: Question
tagged with: jersey
has body: I have a class which implements the ClientRequestFilter for the Client-side filtering. import java.io.IOException; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.ext.Provider; import javax.ws.rs.client.ClientRequestFilter; import org.glassfish.jersey.server.ContainerRequest; @Provider public class checkRequestFilter implements ClientRequestFilter{ @Override public void filter(ClientRequestContext clientRequestContext) throws IOException { System.out.println("I am in checkResponseFilter"); } } But I don't know what to do so that I will be able to call this filter? Do we need to add some kind of servlets in web.xml ?
tagged with: rest
answer count: 2
tagged with: filter
downvote count: 0
has answer: http://stackoverflow.com/a/61482464
favorite count: 0

http://stackoverflow.com/q/23824364
accepted answer: http://stackoverflow.com/a/23824753
has title: Fastest way to check if a byte array is all zeros
has comment: http://stackoverflow.com/comment/36655343
has answer: http://stackoverflow.com/a/23840859
has answer: http://stackoverflow.com/a/23837031
tagged with: java
has comment: http://stackoverflow.com/comment/36656460
has comment: http://stackoverflow.com/comment/36667028
tagged with: primitive
has comment: http://stackoverflow.com/comment/36654535
type: Question
has comment: http://stackoverflow.com/comment/36663327
has comment: http://stackoverflow.com/comment/36687874
has comment: http://stackoverflow.com/comment/36655192
upvote count: 46
tagged with: performance
has comment: http://stackoverflow.com/comment/36654714
has comment: http://stackoverflow.com/comment/36654938
linked to: http://stackoverflow.com/q/10784951
tagged with: arrays
has comment: http://stackoverflow.com/comment/36654679
has comment: http://stackoverflow.com/comment/36654860
has answer: http://stackoverflow.com/a/33414419
has comment: http://stackoverflow.com/comment/36655230
has comment: http://stackoverflow.com/comment/36654676
has comment: http://stackoverflow.com/comment/36654545
has comment: http://stackoverflow.com/comment/36851536
downvote count: 0
has body: I have a byte[4096] and was wondering what the fastest way is to check if all values are zero? Is there any way faster than doing: byte[] b = new byte[4096]; b[4095] = 1; for(int i=0;i&lt;b.length;i++) if(b[i] != 0) return false; // Not Empty
has answer: http://stackoverflow.com/a/33292071
favorite count: 0
score: 46
has comment: http://stackoverflow.com/comment/36674116
answer count: 5
has answer: http://stackoverflow.com/a/23824753
has comment: http://stackoverflow.com/comment/36659525
has comment: http://stackoverflow.com/comment/36686636
possible better answer: http://stackoverflow.com/a/33292071
type: AnsweredQuestion

http://stackoverflow.com/comment/36602092
comment on: http://stackoverflow.com/q/23796496
has text: If you're new to programming, one of the things you should *definitely* learn is how to use a debugger. It's an incredibly useful and important skill for a programmer, and would let you solve both this situation and many others that you come across.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23852798
score: -1
has comment: http://stackoverflow.com/comment/36709776
answer count: 2
downvote count: 1
has title: In order recursion in binary trees
tagged with: recursion
has comment: http://stackoverflow.com/comment/36718123
tagged with: inorder
tagged with: java
has answer: http://stackoverflow.com/a/23937363
has body: Can someone please explain to me how recursion works in in Order traversal. here's my inOrder() method. public void inOrder(BinaryNode p){ if(p.left!=null){ inOrder(p.left); } visit(p); if(p.right!=null){ inOrder(p.right); } } public void visit(BinaryNode p){ System.out.println(p.element); } BinaryTree t=new BinaryTree(); t.insert(5); t.insert(t.root,4); t.insert(t.root,6); t.insert(t.root,60); t.insert(t.root,25); t.insert(t.root,10); t.inOrder(t.root); The method inOrder() prints the elements correctly,but I don't understand how it works. When I call t.inOrder(t.root); since root has value 5 it would be similar to inOrder(5); and that has a left node so if(p.left!=null){ inOrder(p.left); } would get executed.There the recursion call would be inOrder(4); Since 4's left points to null, then visit(4) is the line that executed printing the value 4. But then after that how does 5 get printed.Although at first when the method was called by t.inOrder(t.root); the local variable p was assigned with BinaryNode of value 5, now p is 4. Then after printing out 4, the next line that can get executed is if(p.right!=null){ inOrder(p.right); } But since p.right now refers to right in BinaryNode with element 4 and 4's right is null, this also won't get executed. Then how does the recursion is maintained? How does it print out 5 and the rest of the nodes?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36709346
has comment: http://stackoverflow.com/comment/36749418
has comment: http://stackoverflow.com/comment/36709372
upvote count: 0
tagged with: data-structures
favorite count: 0
tagged with: binary-tree
type: Question
has comment: http://stackoverflow.com/comment/36709498
has answer: http://stackoverflow.com/a/23852887
has comment: http://stackoverflow.com/comment/36709567
has comment: http://stackoverflow.com/comment/36716796

http://stackoverflow.com/comment/36976012
comment on: http://stackoverflow.com/a/23992532
score: 0
type: Comment
has text: Fine, you research deserves +1. Hope you'll get the bounty. And as you stated than when using Spring *normally* there are no concurrency problem during initialization, I think I can safely delete my own answer.
type: AnswerComment

http://stackoverflow.com/comment/36822443
has text: @ganaraj with this in the loop is only allowing the user 1 guess and if it is incorrect it is telling the user it is too high or too low and then asking do they want to play again whereas if the number is correct it just exits the game without asking the user if they want to play again.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23912099

http://stackoverflow.com/a/23906357
type: Answer
has comment: http://stackoverflow.com/comment/36923860
answers question: http://stackoverflow.com/q/23883518
has comment: http://stackoverflow.com/comment/36945814
has comment: http://stackoverflow.com/comment/36927744
score: 0
has body: I would recommend saving the package name of the app that the user wants as default. To do this, you should separate the call for Intent.createChooser and startActivity, then between those two calls, save the package in the intent. For example: Intent intent = Intent.createChooser(...); String packageName = intent.getPackage();//you might have to play around with the name of the method here.... it is not clear from the docs whether this returns what you want String action = intent.getAction();//this will return the action that the user wants to preform - this needs to be saved too, so you know when to display the choosing dialog again and when not to saveChoice(action, packageName); startActivity(...)
has comment: http://stackoverflow.com/comment/36945673

http://stackoverflow.com/q/23870239
answer count: 2
accepted answer: http://stackoverflow.com/a/23872610
downvote count: 0
has comment: http://stackoverflow.com/comment/36742293
favorite count: 0
score: 2
type: AnsweredQuestion
has body: I have some buttons, panels over a JLayeredPane. When I click a button, a panel shows up by setvisible(true). But if there is a button behind panel and I hover on button button comes over panel. I am using JLayeredPane to move panel front. This is what happens when I click button to show panel. private void jbOffCenActionPerformed(java.awt.event.ActionEvent evt) { if(!offsetedilmis) { jPOffsetSor.setVisible(true); KHLayered.moveToFront(jPOffsetSor); offsetedilmis = true; jbOffCen.setText("&lt;html&gt;&lt;center&gt;RESET&lt;br&gt;CENTRE"); } else if(offsetedilmis) { jbOffCen.setText("&lt;html&gt;&lt;center&gt;OFFSET&lt;br&gt;CENTRE"); offsetedilmis = true; } } Btw, I am using netbeans' designer. Auto generated code to add panel to JLayeredPanel: KHLayered.add(jPOffsetSor, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 250, 450, 150)); Main screen without any click. Click on OFFSET CENTRE button and panel shows up. If I hover on buttons behind panel, they comes front. But I have already move panel to front. Should I set some property on/off for buttons or panel?
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/23870487
has answer: http://stackoverflow.com/a/23872610
tagged with: swing
has answer: http://stackoverflow.com/a/23870487
type: Question
tagged with: jlayeredpane
tagged with: jpanel
has title: Panel in JLayeredPane shows buttons behind of it

http://stackoverflow.com/comment/36626207
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23808210
type: Comment
has text: The curl statement I executed is as follows: curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: my_sandbox_api_username" -H "X-PAYPAL-SECURITY-PASSWORD: my_sandbox_api_password" -H "X-PAYPAL-SECURITY-SIGNATURE: my_sandbox_api_signature" -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails -d "transactionId=95W1454568676024G&requestEnvelope.errorLanguage=en_US"

http://stackoverflow.com/q/23911110
has comment: http://stackoverflow.com/comment/36820631
answer count: 1
has title: How to set library path for java outlook connector moyocore.dll in jsf project
tagged with: connector
has comment: http://stackoverflow.com/comment/36820998
score: 0
has comment: http://stackoverflow.com/comment/36820964
tagged with: email
has comment: http://stackoverflow.com/comment/36820151
has comment: http://stackoverflow.com/comment/36820676
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23928311
tagged with: jsf
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23928311
tagged with: outlook
has body: I have a problem setting the library path for moyocore.dll in my jsf project, i have already tried to allocate the file in different folders and set different paths. Outlook.setLibraryPath("C:\\Users\\irebollo\\Desktop\\plazos\\Java Outlook Connector\\lib\\moyocore.dll"); this one was working in a single java file, but when added the code to a bean function in my jsf project absolute route stops working, ok that was obvious but the problem is next then I tried setting relative paths from my workspace like: Outlook.setLibraryPath("\\lib-joc\\moyocore.dll"); Outlook.setLibraryPath("\\resources\\lib-joc\\moyocore.dll"); tried with "\" and "/" but still cant get it working. I have to say that everything in the code is ok, the only problem is the path to the library but if someone needs to see the code i will post it. moyocore.dll is allocated in /projectRoot/plazosExcel/WebContent/WEB-INF/lib also in /projectRoot/web/resources/lib-joc/moyocore.dll I'm not very skilled with JSF and it's folder structure so maybe i'm not putting it in the right place or not referencing it ok or both. Additional information: Path to workspace -> C:\Users\irebollo\Documents\NetBeansProjects\plazosExcel OS -> Win7 IDE -> NetBeans8 I have googled it but there is no information about java outlook connector in jsf so I hope this big community can help me once again. P.S: it's my first question so if i'm missing something or there is something wrong i'd appreciate to know it.

http://stackoverflow.com/q/23937218
type: AnsweredQuestion
score: 0
tagged with: java
has body: A PSD file i'm working with has its icons designed IN PSD using layers that are a result of using magic wand, rectangle tool, circle tools etc. For example, an icon can be made up of 4 different layers in 1 photoshop folder (ie using magic wand 2x, rectangle tool 1x, circle tool 1x) I understand that if an icon in PSD were to be usable in code it should be in jpeg, png format, please correct me if I'm wrong as I'm new to this.
type: Question
tagged with: ios
answer count: 1
has answer: http://stackoverflow.com/a/23937841
tagged with: user-interface
has title: button in PSD as multiple layers into mobile code java
tagged with: photoshop
tagged with: android
accepted answer: http://stackoverflow.com/a/23937841

http://stackoverflow.com/comment/36885899
type: Comment
type: QuestionComment
has text: It would help if you explained *how* it doesn't work.
comment on: http://stackoverflow.com/q/23856477
score: 0

http://stackoverflow.com/a/23872638
score: 0
has body: If you would want to use synchronized you would have to do something like that synchronized(myList) { //Do stuff } So no other thread can access the list while another Thread is in the synchronized block. But watch out for deadlocks Here you have a tutorial on synchronized http://tutorials.jenkov.com/java-concurrency/synchronized.html
type: Answer
answers question: http://stackoverflow.com/q/23872559

http://stackoverflow.com/q/23868273
linked to: http://stackoverflow.com/q/2745265
type: Question
score: 5
upvote count: 6
has body: This works ok: Map aMap; aMap = new HashMap&lt;String, TreeSet&lt;String&gt;&gt;(); This does not compile: Map&lt;String, Set&lt;String&gt;&gt; aMap; aMap = new HashMap&lt;String, TreeSet&lt;String&gt;&gt;(); Error message: Compilation failed (26/05/2014 11:45:43) Error: line 2 - incompatible types - found java.util.HashMap&lt;java.lang.String,java.util.TreeSet&lt;java.lang.String&gt;&gt; but expected java.util.Map&lt;java.lang.String,java.util.Set&lt;java.lang.String&gt;&gt; Why?
answer count: 3
has comment: http://stackoverflow.com/comment/36738289
downvote count: 1
has comment: http://stackoverflow.com/comment/36738265
favorite count: 0
possible better answer: http://stackoverflow.com/a/23868582
accepted answer: http://stackoverflow.com/a/23868407
tagged with: collections
has answer: http://stackoverflow.com/a/23880593
has answer: http://stackoverflow.com/a/23868582
has comment: http://stackoverflow.com/comment/36738184
has title: HashMap / TreeSet combination inconsistency
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36738328
has comment: http://stackoverflow.com/comment/36738250
tagged with: java
has answer: http://stackoverflow.com/a/23868407

http://stackoverflow.com/comment/36578901
has text: @lpratlong And in the OP's expected output of "g l e o u t s c k v f w".
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23784377
type: AnswerComment

http://stackoverflow.com/q/23790423
has answer: http://stackoverflow.com/a/23790485
has answer: http://stackoverflow.com/a/23790480
has answer: http://stackoverflow.com/a/23790698
has comment: http://stackoverflow.com/comment/36590712
score: 5
possible better answer: http://stackoverflow.com/a/23790480
has comment: http://stackoverflow.com/comment/36590262
has comment: http://stackoverflow.com/comment/36590124
tagged with: stringbuilder
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/23790485
upvote count: 5
tagged with: java
tagged with: stringbuffer
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: string
has body: I am trying to understand why String and Stringbuilder/StringBuffer are treated differently when used as Hashmap keys. Let me make my confusion clearer with the following illustrations: Example #1, using String: String s1 = new String("abc"); String s2 = new String("abc"); HashMap hm = new HashMap(); hm.put(s1, 1); hm.put(s2, 2); System.out.println(hm.size()); Above code snippet prints '1'. Example #2, using StringBuilder(or StringBuffer): StringBuilder sb1 = new StringBuilder("abc"); StringBuilder sb2 = new StringBuilder("abc"); HashMap hm = new HashMap(); hm.put(sb1, 1); hm.put(sb2, 2); System.out.println(hm.size()); The above code snippet prints '2'. Could anyone please explain why the difference in behaviour.
has comment: http://stackoverflow.com/comment/36590146
favorite count: 0
has comment: http://stackoverflow.com/comment/36590172
has answer: http://stackoverflow.com/a/23791705
has title: String Vs Stringbuffer as HashMap key
type: Question

http://stackoverflow.com/comment/36660662
has text: Hashmapping to textfields almost the same like lists or collection. Use indexed property names and make sure `createIfNull` is enabled.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23827599
score: 0

http://stackoverflow.com/q/23821377
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23822388
has answer: http://stackoverflow.com/a/23822388
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23821585
has title: Trouble with connection SQL database to JAVA in NetBeans
score: 0
has comment: http://stackoverflow.com/comment/36649752
has body: I try to connect netbeans with SQL, but still I have a problem. I suppose, something still missing. Here, I create this class: (Here now errors occurs - on the other hand, I dont really know, if it is fully right) public class connection { public Connection con; public void dbConnect(){ try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://FIO\\SQLEXPRESS;" + "databaseName=Feedback;integratedSecurity=true"; con = DriverManager.getConnection(connectionUrl); } catch (SQLException e) { System.out.println("SQL Exception: "+ e.toString()); } catch (ClassNotFoundException cE) { System.out.println("Class Not Found Exception: "+ cE.toString()); } } public Connection getConnection() { return con; } static PreparedStatement prepareStatement(String sql) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } Then, here within another class named Questions, I try to prepare statement and load information from database: public class Questions { public void doQuestion() {... ... ... ... connection con = new connection(); con.dbConnect(); PreparedStatement preparedStatement; try{ **preparedStatement = con.getConnection().createStatement();** String sql = "SELECT Answer FROM Feedback.dbo.Question1 WHERE TrainerFirstName=? AND TrainerLastName=?" preparedStatement.setString(1,"ffname"); preparedStatement.setString(2, "llname"); ResultSet result = preparedStatement.executeQuery(sql); while(result.next()) { System.out.println(result.getString(1) + result.getString(2)); } }catch (SQLException ex) { Logger.getLogger(Questions.class.getName()).log(Level.SEVERE, null, ex); } ... ... ... ... ... } } Netbeans underlines : "preparedStatement = con.getConnection().createStatement(); ", due to "incompatible types: Statement cannot be converted to PreparedStatement." I cant overcome it. Then I try to make something like this to resolve a problem, but problem is st…
tagged with: sql
tagged with: connection
tagged with: netbeans
has answer: http://stackoverflow.com/a/23821585

http://stackoverflow.com/comment/36739051
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23868662
has text: I have used opentok for video chatting but in my case server side opentok lib will generating the session id and token id. After that my app server was providing that one to the respective user.

http://stackoverflow.com/comment/36870364
comment on: http://stackoverflow.com/q/23897259
has text: I'm using a matrix of characters where ball and rackets are represented with '\u2588' character, so for display this graphics I only call 'toString' method. This method loop into matrix and concatenate each char in a string, which will be return at the end.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23833243
has comment: http://stackoverflow.com/comment/36671742
type: Answer
has body: You are on the righ path- scaling the numbers linearly is correct. To test your logic, plug in 0.0 and 1.0 as values from nextDouble() 0.0 * (9 - 5 + 1) + 5 = 5, o.k. 1.0 * (9 - 5 + 1) + 5 = 10, not o.k. This is a basic way to test your math.
has comment: http://stackoverflow.com/comment/36671550
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36671435
accepted answer of: http://stackoverflow.com/q/23833111
answers question: http://stackoverflow.com/q/23833111

http://stackoverflow.com/comment/36813463
type: Comment
comment on: http://stackoverflow.com/a/23907482
score: 0
type: AnswerComment
has text: Many tools will warn about calling non final methods from constructors

http://stackoverflow.com/comment/36585004
has text: Why would you want to use a regex rather than an XML API? That's almost *always* the wrong decision.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23787722

http://stackoverflow.com/q/23829707
has answer: http://stackoverflow.com/a/23833603
has comment: http://stackoverflow.com/comment/36670591
tagged with: lazy-loading
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has title: failed to lazily initialize a collection of role
type: Question
has comment: http://stackoverflow.com/comment/36671436
score: 0
answer count: 1
has body: I have two classes having a one to many relationship: OpinionPoll (one) and PollResult (many). When I execute the criteria query below the following error is raised: Failed to lazilyinitialize a collection of role: com.bonrix.gcm.demo.model.OpinionPoll.pollResults, could not initialize proxy - no Session. I just want to query only the parent (OpinionPoll class) records. But i got the above error and due to my requirement I have to use FetchType=Lazy. Here is the mapping of my two classes: Opinionpoll mapping: @OneToMany(cascade=CascadeType.ALL,mappedBy="opinionPoll",fetch=FetchType. LAZY) private List&lt;PollResult&gt; pollResults = new ArrayList&lt;PollResult&gt;() ; PollResult mapping: @ManyToOne(cascade = { CascadeType.ALL },fetch=FetchType.LAZY) @JoinColumn(name = "poll_id") private OpinionPoll opinionPoll; Query: Criteria criteria = session.createCriteria(OpinionPoll.class) .add(Restrictions.eq("clientName", username)) .addOrder(Order.desc("pollId")) .setMaxResults(maxpoll) .setFirstResult(offset); opinionPolls = criteria.list();

http://stackoverflow.com/comment/36676437
type: AnswerComment
has text: @user3239652 You have to know exactly what application it is. Else wise you can't do this (at least from my knowledge).
comment on: http://stackoverflow.com/a/23835778
score: 0
type: Comment

http://stackoverflow.com/comment/36579340
type: Comment
comment on: http://stackoverflow.com/a/23784184
has text: @user3560140 You should have mentioned in your question that you need the 32bit version. Anyway, I've updated my answer with a link to v3.2.2, which is available for Win 32bit, as well.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36618811
type: QuestionComment
comment on: http://stackoverflow.com/q/23805885
score: 2
has text: And what's your question?
type: Comment

http://stackoverflow.com/a/23901132
downvote count: 0
score: 1
has body: Yes, there is documentation available that describes what each of the formatting options is for: Java printf quick reference In summary (copied from the linked document): Format String: Composed of literals and format specifiers. Arguments are required only if there are format specifiers in the format string. Format specifiers include: flags, width, precision, and conversion characters in the following sequence: %[flags][width][.precision]conversion-character (square brackets denote optional parameters) Flags: - : left-justify (default is to right-justify) + : output a plus (+) or minus (-) sign for a numerical value 0 : forces numerical values to be zero-padded ( default is blank padding ) , : comma grouping separator (for numbers &gt; 1000) : space will display a minus sign if the number is negative or a space if it is positive Width: Specifies the field width for outputting the argument and represents the minimum number of characters to be written to the output. Include space for expected commas and a decimal point in the determination of the width for numerical values. Precision: Used to restrict the output depending on the conversion. It specifies the number of digits of precision when outputting floating-point values or the length of a substring to extract from a String. Numbers are rounded to the specified precision. Conversion-Characters: d : decimal integer [byte, short, int, long] f : floating-point number [float, double] c : character Capital C will upper case the letter s : String Capital S will uppercase all the letters in the string h : hashcode A hashcode is like an address. This is useful for printing a reference n : newline Platform specific newline character - use %n instead of \n for greater compatibility
has comment: http://stackoverflow.com/comment/36803354
answers question: http://stackoverflow.com/q/23901037
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36801776

http://stackoverflow.com/comment/36848929
has text: The way you load the image `SWTResourceManager.getImage(Class,String)` uses `Class.getResourceAsStream()` so the image must be placed in the same place the class is loaded from. You must put the image inside the src folder, or load the image in a different way.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23926058
type: AnswerComment

http://stackoverflow.com/comment/36687648
has text: Thanks for the answer, you are 100% correct, my mistake. The problem was in dependency for javolution (which comes from JScience library), because it contains `javax.realtime` package.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23838362
type: QuestionComment

http://stackoverflow.com/comment/36678949
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23836657
has text: My idea is to subsequently implement a method that substitutes the words with their Hakka Ideograms, Mandarin translation Ideograms and corresponding Pinyin, for which the three labels are present. I will look into SQL to avoid writing an infinite sequence of `if`s and `elses`. The following step, though with my abilities it seems very ambitious, maybe too ambitious, is to develop a Google Translate-like interface that highlights single words in the labels when the mouse is passed over them and reveals a list of other translations when you click on the words.
score: 0

http://stackoverflow.com/a/23779698
score: 2
downvote count: 0
has body: The proper way to enable a field in a class to be retrieved and updated in Java is through getter and setter methods. Still, there's Project Lombok that aims to help developers to not write these methods and use annotations instead that will generate getters, setters and other methods like equals and hashCode for you. Here's a code sample from the demo in their site: public @Data class Mountain { private final String name; private final double latitude, longitude; private String country; } It will generate this code: public class Mountain { private final String name; private final double latitude, longitude; private String country; public Mountain(String name, double latitude, double longitude) { this.name = name; this.latitude = latitude; this.longitude = longitude; } public String getName() { return this.name; } public double getLatitude() { return this.latitude; } public double getLongitude() { return this.longitude; } public String getCountry() { return this.country; } public void setCountry(String country) { this.country = country; } @Override public String toString() { //... } @Override public int hashCode() { //... } @Override public boolean equals(Object o) { //... } } This makes the code compatible with JavaBeans specification, which is used by several frameworks like Hibernate, JPA, Expression Language, JSF, Spring, etc...
accepted answer of: http://stackoverflow.com/q/23779646
answers question: http://stackoverflow.com/q/23779646
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23846902
tagged with: java
has title: Sending data from packetlistener service to UI
has body: im in need of a solution abot how can i change UI from service variables,im listening for chat messages from service,i know how to turn messages into string, but i dont know how to send them into UI OR to another activity, here is my service: public void setConnection(XMPPConnection connection) { this.connection = connection; if (connection != null) { // Add a packet listener to get messages sent to us PacketFilter filter = new MessageTypeFilter(Message.Type.chat); connection.addPacketListener(new PacketListener() { @Override public void processPacket(Packet packet) { Message message = (Message) packet; if (message.getBody() != null) { String fromName = StringUtils.parseBareAddress(message.getFrom()); Log.i("XMPPChatDemoActivity ", " Text Recieved " + message.getBody() + " from " + fromName); messages.add(fromName + ":"); messages.add(message.getBody()); Log.i("XMPPChatDemoActivity",message.getBody()); mHandler.post(new Runnable() { public void run() { setListAdapter(); } }); } } }, filter); } } and here is where that data belongs in main activity public void setListAdapter() { ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.listitem, messages); listview.setAdapter(adapter); } i have otto bus library in case, so i tried to use intent and otto just before mhandler.post but seems it totally stops the process... could you u guys help me here? thanks here i did with mHandler.obtainMessage : messages.add(fromName + ":"); messages.add(message.getBody()); Log.i("XMPPChatDemoActivity",message.getBody()); mHandler.obtainMessage(1,message).sendToTarget(); mHandler.post(new Runnable() { public void run() { // setListAdapter(); } }); and in the activity : private class getit extends Handler{ public void handleMessage(Message msg) { mHandler.post(new Runnable() { public void run() { setListAdapter(); } }); } }
type: Question
has answer: http://stackoverflow.com/a/23848610
score: 0
accepted answer: http://stackoverflow.com/a/23848610
tagged with: android
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/23845703
type: Answer
has body: 2 is FALSE Because at the time you call a static method it is not guaranteed, that the instance (non-static) variables/functions exist.
answers question: http://stackoverflow.com/q/23845681
score: 0

http://stackoverflow.com/a/26095729
downvote count: 0
has comment: http://stackoverflow.com/comment/54577560
has comment: http://stackoverflow.com/comment/106339827
type: Answer
has comment: http://stackoverflow.com/comment/58433788
upvote count: 3
answers question: http://stackoverflow.com/q/23923696
has comment: http://stackoverflow.com/comment/55661816
score: 3
has comment: http://stackoverflow.com/comment/66565008
has body: If you want to highlight unused public methods, please enable the "Settings|Inspections|Declaration redundancy|Unused declaration" global inspection. If you want to highlight unused private methods, please enable the "Settings|Inspections|Declaration redundancy|Unused symbol" local inspection. So, if you want to highlight unused private members, but do not highlight unused public members, turn off "Unused declaration" and turn on "Unused symbol". Source I've just tested it using IDEA 13.1.4, and it worked exactly as described.

http://stackoverflow.com/a/23929305
type: Answer
has body: out is a variable(ref variable) that is declared in System class public final static PrintStream out = null; as it is static variable you need to call it through class name.As System class's constructor is private you can not create the object of System class &amp; you can't call it through reference .There is a way you can directly call out.println by using static import..refer bellow example .. import static java.lang.System.out; public class MainTest { public static void main(String[] args) { out.print("Hello"); } } Hope it may help .
answers question: http://stackoverflow.com/q/23929043
score: 0

http://stackoverflow.com/comment/36870033
score: 0
type: Comment
type: QuestionComment
has text: I'm not sure why people vote this as too broad, since the answer is a short piece of code. And the question is not unclear at all. The problem here is that OP doesn't try anything to solve it (or at least OP doesn't show his/her efforts).
comment on: http://stackoverflow.com/q/23937743

jdialog
type: Tag
tags question: http://stackoverflow.com/q/23879650
tags question: http://stackoverflow.com/q/23854937
tags question: http://stackoverflow.com/q/23863980
tag name: jdialog
tags question: http://stackoverflow.com/q/23869758

http://stackoverflow.com/a/23867105
answers question: http://stackoverflow.com/q/23866888
has body: BigInteger works like Integer in that the result of calculations between two integers is an integer. If we write int n = 1 / 1024 the result is likewise 0. Try this: BigDecimal b = new BigDecimal( new BigInteger("2").pow(200) ); BigDecimal one = new BigDecimal(1); BigDecimal quotient = one.divide(b); System.out.println(quotient); //scientific notation. (140 significant digits) System.out.println(quotient.toPlainString()); //regular notation with leading zeros
upvote count: 3
has comment: http://stackoverflow.com/comment/36736625
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/36736194
type: Answer

http://stackoverflow.com/a/23918829
type: Answer
has comment: http://stackoverflow.com/comment/36834951
answers question: http://stackoverflow.com/q/23917900
score: 0
has body: delet R.java and restart eclipse make sure drawables files is not with capital letters
has comment: http://stackoverflow.com/comment/36836378

http://stackoverflow.com/comment/36732126
type: Comment
type: QuestionComment
has text: Also, do you have the option to take out the database settings from persistence.xml and create a datasource managed by Spring?
score: 0
comment on: http://stackoverflow.com/q/23863401

http://stackoverflow.com/q/23896960
has title: Drools Rule format for firing only once
type: Question
accepted answer: http://stackoverflow.com/a/23904473
tagged with: drools
answer count: 1
downvote count: 0
favorite count: 0
tagged with: rule-engine
upvote count: 2
has comment: http://stackoverflow.com/comment/36797797
has answer: http://stackoverflow.com/a/23904473
score: 2
has comment: http://stackoverflow.com/comment/36797683
type: AnsweredQuestion
has body: I'm using the drools 6 engine. Suppose I have an account object that has a collection of sections and each section has a status flag that can be "GOOD" or "BAD". If I was to write the following: rule "Check if account has a good subsection" when $account : Account() SubSection (status == "GOOD") from $account.getSubSections() then insertLogical(new AccountIsGood($account)); end I would expect this to simply add the logical rule AccountIsGood($account) if atleast one section was good. However, it seems this does not simply check for one successful subsection and end the rule, but instead it continues checking all subsections and inserting the logical rule for each valid subsection. Ex, if an account has four valid subsections, I get four copies of the rule for that account. So my question is, is there a way to rewrite this rule to get the desired behavior? The account class: public class Account { private List&lt;SubSection&gt; subsections; // Getters / Setters/ other code }
tagged with: java

http://stackoverflow.com/comment/36661866
type: Comment
type: QuestionComment
has text: He said: "Joptionpane message dialo"
score: 0
comment on: http://stackoverflow.com/q/23827960

sslengine
type: Tag
tags question: http://stackoverflow.com/q/23906736
tag name: sslengine

http://stackoverflow.com/comment/36763841
comment on: http://stackoverflow.com/q/23880817
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Regex Matching numbers with floating point](http://stackoverflow.com/questions/2139715/regex-matching-numbers-with-floating-point)

http://stackoverflow.com/comment/36709882
comment on: http://stackoverflow.com/a/23851739
type: Comment
has text: Thanks for your answer. But if ProcessBuilder is bad choice, what technology will be good choice for running native code in externall process from EJB?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36873307
type: AnswerComment
comment on: http://stackoverflow.com/a/23939522
score: 0
type: Comment
has text: Thanks Tim. What would be the structure of this loop ?

http://stackoverflow.com/comment/36806198
type: QuestionComment
has text: `{FILLIN PDPremium \* MERGEFORMATPDPremium }` -> `{PDPremium }` i want like this
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23903494

http://stackoverflow.com/q/23882251
upvote count: 0
has comment: http://stackoverflow.com/comment/36764919
score: -1
has comment: http://stackoverflow.com/comment/36765803
has title: What is wrong with my JSON string?
answer count: 1
has comment: http://stackoverflow.com/comment/36765034
linked to: http://stackoverflow.com/q/20152710
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23895229
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 1
type: Question
has body: I think the JSON string I had was working fine. I stumbled across on my unit tests and found out that my JSON parsing using google Gson library doesn't work anymore. Does anybody have any ideas why this is not working? String json = "{\"hybrid\":\"true\",\"trimName\":\"act\"}"; JsonObject data = new Gson().fromJson(json, JsonObject.class); System.out.println(" JSON is "+data); System.out.println(" JSON is "+data.get("hybrid")); The output I get is JSON is {} is hybrid ? null
has comment: http://stackoverflow.com/comment/36765038

http://stackoverflow.com/q/23927618
score: 1
has answer: http://stackoverflow.com/a/23927892
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36851989
has answer: http://stackoverflow.com/a/23927700
tagged with: arrays
tagged with: string
downvote count: 1
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23927863
has body: When I tried to analyze each word of a string separately, the first word was done well, but I failed for the rest. Help me to correct this JAVA code for right output: public class Test { public static void main(String[] args) { int count1=0; int chars_not_x=0 ; String str = "xyz xyxzghz zyxzz"; String[] words = str.split("\\s"); for(int m=0; m&lt;words.length; m++){ System.out.println(words[m]); System.out.println("Total characters in the word: "+words[m].length()); for(int n=0; n&lt;words[m].length(); n++){ if(words[m].charAt(n)=='x'){count1++;}} System.out.println("Number of x :"+count1); chars_not_x= words[m].length()- count1; System.out.println("Chars other than x: "+chars_not_x); System.out.println("\n"); }} } The output of the code is" xyz Total characters in the word: 3 Number of x :1 Chars other than x: 2 xyxzghz Total characters in the word: 7 Number of x :3 Chars other than x: 4 zyxzz Total characters in the word: 5 Number of x :4 Chars other than x: 1 The required output: xyz Total characters in the word: 3 Number of x :1 Chars other than x: 2 xyxzghz Total characters in the word: 7 Number of x :2 Chars other than x: 5 zyxzz Total characters in the word: 5 Number of x :1 Chars other than x: 4
has answer: http://stackoverflow.com/a/23927667
possible better answer: http://stackoverflow.com/a/23927863
type: AnsweredQuestion
has title: Analyzing each word of a string separately
accepted answer: http://stackoverflow.com/a/23927700

http://stackoverflow.com/q/23864764
tagged with: gcc
has body: Hi guys i have tried all the solutions like java -Djava.library.path=. demo adding the dll path to PATH java -Djava.library.path=c:\JNI\demo.dll demo But still the above error. Here is my java code.. class demo { public native void printline(); public static void main(String[]args) { new demo().printline(); } } Here is my c code... #include&lt;stdio.h&gt; #include&lt;jni.h&gt; #include "demo.h" JNIEXPORT void JNICALL Java_demo_printline(JNIEnv *a, jobject b) { printf("Hello wrold!!!"); return; } Steps for compiling and running, javac demo.java javah demo gcc -c -I"c:\jdk1.7.0_55\include" -I"c:\jdk1.7.0_55\include\win32" demo.c gcc -Wl,--add-stdcall-alias -shared -o demo.dll demo.c java -Djava.library.path=c:\JNI\demo.dll demo Am i going wrong somewhere? can someone please help me out,.
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23868321
type: Question
has title: Exception in thread "main" java.lang.UnsatisfiedLinkError 3
has answer: http://stackoverflow.com/a/23866885
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/36737016
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/23866885
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23868321

http://stackoverflow.com/a/23901184
score: 4
has body: You can use escapeSql in the org.apache.commons.lang.StringEscapeUtils: username="'; or 1=1"; sane_username=StringEscapeUtils.escapeSql(username); // turns into "''; or 1=1" sql= "select username from users where username = '" + sane_username + "'"; // select username from users where username = '''; 1 or 1' But this is really bad practice. You should always use prepared statements. Saves memory on the sql server Allows you to reuse sql statements without a reparsing sql, increasing performance more secure, you might forget to sanity some input.
accepted answer of: http://stackoverflow.com/q/23901065
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/23901065
upvote count: 5
has comment: http://stackoverflow.com/comment/36804577
has comment: http://stackoverflow.com/comment/36801917
type: Answer
has comment: http://stackoverflow.com/comment/36802995

reverse
tags question: http://stackoverflow.com/q/23813352
tag name: reverse
tags question: http://stackoverflow.com/q/23784312
type: Tag

http://stackoverflow.com/comment/36812053
type: QuestionComment
has text: sorry, missed that. can you try casting the return value of getProperty `(Long) versionNode.getProperty("transasactionVersion", 0L)`
comment on: http://stackoverflow.com/q/23790333
score: 0
type: Comment

http://stackoverflow.com/q/23856784
answer count: 4
accepted answer: http://stackoverflow.com/a/23856856
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: swing
has answer: http://stackoverflow.com/a/23857429
tagged with: jbutton
type: Question
linked to: http://stackoverflow.com/q/7229226
has answer: http://stackoverflow.com/a/23856809
possible better answer: http://stackoverflow.com/a/23856984
linked to: http://stackoverflow.com/q/21375255
has answer: http://stackoverflow.com/a/23856984
has answer: http://stackoverflow.com/a/23856856
linked to: http://stackoverflow.com/q/7702697
has body: I have made a JButton: JButton button = new JButton("Button"); Then added it to a JPanel: panel.add(button, BorderLayout.CENTER); Photo of the Button: I have noticed 2 different types of JButtons: I like the button titled "OK", is there any way I can set this as the preferred style of the button? Or if this can not be done, is there a way to make a panel with a fixed height, and add it to the center of another panel? Thanks.
linked to: http://stackoverflow.com/q/3420311
linked to: http://stackoverflow.com/q/12529200
has title: Swing Button Look and Feel Based On Size?

http://stackoverflow.com/comment/36672185
score: 0
type: QuestionComment
type: Comment
has text: have you checked if the getActivity is returning null?
comment on: http://stackoverflow.com/q/23833547

http://stackoverflow.com/a/23850892
answers question: http://stackoverflow.com/q/23845957
type: Answer
has body: Twilio Trial accounts can send messages to verified numbers only. I just set one up yesterday and was able to receive the messages while using my Trial. You can check which numbers are 'validated' for testing purpose by clicking the 'Numbers' tab, and then 'Verified Caller IDs'. When logged into your Twilio account, click on 'Logs', then 'Messages' and you will get a list of all incoming and outgoing messages that Twilio has processed. The messages may be being blocked because of Geographic restrictions. You can check on current geographic permissions and enable as necessary by clicking: Top right - your email/profile pic. Then 'Account Settings'. This will bring up account settings page, as well as a tab of options at the top. Select 'Geographic Permissions' and make changes as necessary.
has comment: http://stackoverflow.com/comment/36727438
has comment: http://stackoverflow.com/comment/36708755
upvote count: 3
has comment: http://stackoverflow.com/comment/36963914
has comment: http://stackoverflow.com/comment/36981779
score: 3
has comment: http://stackoverflow.com/comment/36762341
downvote count: 0

http://stackoverflow.com/a/23865668
answers question: http://stackoverflow.com/q/23864935
downvote count: 0
has comment: http://stackoverflow.com/comment/36736145
has comment: http://stackoverflow.com/comment/36734308
score: 1
has comment: http://stackoverflow.com/comment/36735324
has body: You could use Regex for that. Java provides Pattern and Matcher class that could do the job for you. String yourString = " "; String REGULAR_EXPRESSION= "(\\ .+?\\ )"; Pattern pattern = Pattern.compile(REGULAR_EXPRESSION, Pattern.DOTALL | Pattern.MULTILINE); Matcher matcher = pattern.matcher(hello); if (matcher.find()) { System.out.println(yourString.replaceAll(matcher.group(1), "")); } Here (\\ .+?\\ ) represents all the content enclosed inside tag inclusive of tag. The line matcher.group(1)represent the position of the matched string. if you want to replace all the occurrence simply use yourString = matcher.replaceAll(""); And to replace first occurrence only use : yourString = matcher.replaceFirst(""); And i am not sure whether it will work for the new line "\n" content in the string, if the string is of single line , you can use : System.out.println(yourString.replaceAll(REGULAR_EXPRESSION, ""));
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36735350
accepted answer of: http://stackoverflow.com/q/23864935
type: Answer

http://stackoverflow.com/q/23792625
answer count: 1
has body: I'm trying to profile the memory usage of my hadoop job. Could someone provide a step by step how-to on how to monitor hadoop tasks with yourkit - including setup?
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/23796028
type: AnsweredQuestion
tagged with: java
upvote count: 1
has title: how to profile hadoop tasks with yourkit
downvote count: 1
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/23796028
tagged with: yourkit
score: 0

http://stackoverflow.com/comment/36795156
comment on: http://stackoverflow.com/q/23814709
has text: No proxy configured, because I am testing from my work place, it seems they restricted some access, but is working outside my office network. thanks
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36847629
type: QuestionComment
comment on: http://stackoverflow.com/q/23925491
type: Comment
has text: Did you check out this [link](http://developer.android.com/training/implementing-navigation/lateral.html)?
score: 0

http://stackoverflow.com/comment/36632479
score: 0
has text: it is not showing stack trace on error i am confused
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23812609

http://stackoverflow.com/comment/36793316
score: 0
type: Comment
has text: When you are on the new branch, just push to remote. I don't understand what you mean by "actually nothing happened".
comment on: http://stackoverflow.com/a/23896419
type: AnswerComment

http://stackoverflow.com/q/23850680
downvote count: 1
has comment: http://stackoverflow.com/comment/36705187
type: Question
tagged with: android-layout
tagged with: layout
has comment: http://stackoverflow.com/comment/36705308
has comment: http://stackoverflow.com/comment/36705580
has body: this is page-curl view , i want when nextView() is called my TextView get the next string but I can't use TextView from xml layout it gives me null , how I can but buttons and TextView in customView ? can any one help me to solve this with code ? I have searched with many tutorials but I get this understanding activity class : public class StandaloneExample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.standalone_example); } @Override public void onDestroy(){ super.onDestroy(); System.gc(); finish(); } /** * Set the current orientation to landscape. This will prevent the OS from changing * the app's orientation. */ public void lockOrientationLandscape() { lockOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } /** * Set the current orientation to portrait. This will prevent the OS from changing * the app's orientation. */ public void lockOrientationPortrait() { lockOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } public void lockOrientation( int orientation ) { setRequestedOrientation(orientation); } } pageCurlView : public class PageCurlView extends View { private class Vector2D { public float x, y; public Vector2D(float x, float y) { this.x = x; this.y = y; } @Override public String toString() { // TODO Auto-generated method stub return "(" + this.x + "," + this.y + ")"; } public float length() { return (float) Math.sqrt(x * x + y * y); } public float lengthSquared() { return (x * x) + (y * y); } public boolean equals(Object o) { if (o instanceof Vector2D) { Vector2D p = (Vector2D) o; return p.x == x && p.y == y; } return false; } public Vector2D reverse() { return new Vector2D(-x, -y); } public Vector2D sum(Vector2D b) { return new Vector2D(x + b.x, y + b.y); } public Vector2D sub(Vector2D b) { return new Vector2D(x - b.x, y - b.y); } public float dot(Vector2D vec) { return (x * vec.x) + (y * vec.y); } public float cross(Vector2D a, Vector2D b) { return…
has answer: http://stackoverflow.com/a/23851218
score: 0
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36705507
has comment: http://stackoverflow.com/comment/36705792
favorite count: 0
has comment: http://stackoverflow.com/comment/36705917
has title: textView getting null exception in customView
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36705280
tagged with: android
has comment: http://stackoverflow.com/comment/36705303
has comment: http://stackoverflow.com/comment/36705943
has comment: http://stackoverflow.com/comment/36705328
tagged with: java
has comment: http://stackoverflow.com/comment/36705740
has comment: http://stackoverflow.com/comment/36705699

http://stackoverflow.com/comment/36799395
type: QuestionComment
has text: @ajb No view found for ID, doesn't it automatically create the ID when I do @+id/dBID ?
score: 0
comment on: http://stackoverflow.com/q/23899900
type: Comment

http://stackoverflow.com/comment/36822542
type: Comment
has text: @membersound Why? That is *exactly the purpose* of `mvn install`. To try and avoid this is to fight the very essence of Maven. I would recommend the Artifactory approach myself - easy to install and lots of benefits.
comment on: http://stackoverflow.com/a/23912366
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36644212
score: 1
comment on: http://stackoverflow.com/a/23818389
type: AnswerComment
type: Comment
has text: Read about [Installing Apache Tomcat Server](http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/InstallTomcat/InstallTomcat.html)

http://stackoverflow.com/comment/36670308
has text: And certainly the readFromRSClobStream method is poorly written.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23810008
type: Comment

http://stackoverflow.com/q/23838806
downvote count: 0
has body: In Java JDK 1.6 I need to run an executable that takes in redirected input, like so: exe &lt; input_file My code looks like this: final ProcessBuilder pb = new ProcessBuilder( "exe", "&lt;", "input_file"); // Set working directory pb.directory( new File( hps.hdfFilePath ) ); // Execute p = pb.start( ); This results in error: "File &lt; not found" ProcessBuilder does not like the "&lt;". How do I do this in JDK 1.6?
tagged with: runtime.exec
tagged with: executable
tagged with: java
has answer: http://stackoverflow.com/a/23838829
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23838861
answer count: 2
has title: In Java JDK 1.6 I need to run an executable that takes in redirected input
tagged with: java-6
favorite count: 0
tagged with: processbuilder
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/93871871
has comment: http://stackoverflow.com/comment/36682215
score: 2

http://stackoverflow.com/q/23868547
has comment: http://stackoverflow.com/comment/36740594
linked to: http://stackoverflow.com/q/23871541
has body: In my Spring project, my service classes are capturing the parameters I send from my forms via method POST this way, currently: @Transactional @PreAuthorize("hasPermission(#user, 'cadastra_fornecedor')") public boolean cadastra(HttpServletRequest request, HttpServletResponse response) { String identificador = request.getParameter("identificador"); String nome = request.getParameter("nome"); String website = request.getParameter("website"); String[] endereco2 = request.getParameterValues("endereco[]"); String[] contato2 = request.getParameterValues("contato[]"); Fornecedor f = new Fornecedor(); f.setRazao_social(nome); f.setWebsite(website); if(identificador.length() == 14) f.setCnpj(identificador); else if(identificador.length() == 11) f.setCpf(identificador); List&lt;Endereco&gt; lista_endereco = new ArrayList&lt;Endereco&gt;(); if(endereco2 != null) { int max = endereco2.length; for(int i=0; i&lt;max; i++) { int id = Integer.valueOf(endereco2[i]).intValue(); lista_endereco.add(endereco.findById(id)); } f.setEndereco(lista_endereco); } List&lt;Contato&gt; lista_contato = new ArrayList&lt;Contato&gt;(); if(contato2 != null) { int max = contato2.length; for(int i=0; i&lt;max; i++) { int id = Integer.valueOf(contato2[i]).intValue(); lista_contato.add(contato.findById(id)); } f.setContato(lista_contato); } return fornecedor.persist(f); } I am trying find another way to read this parameters, without the need of read one by one with the method getParameter (or getParaterValues). Each service class is related to one of my Entity classes, the name of the fields from form have the same name of the atributes in the table, and all of them which are arrays, are lists of primary keys to another entity. Anyone knows if exist any solution where I could use the information above to read this parameters all at once? (I trying create a generic class for my controller and service classes to group this commons methods. I wonder if exist a way to do that without direct reference to the…
tagged with: spring
has comment: http://stackoverflow.com/comment/36739100
has comment: http://stackoverflow.com/comment/36739359
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23870193
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36738884
has comment: http://stackoverflow.com/comment/36740368
accepted answer: http://stackoverflow.com/a/23870193
tagged with: servlets
score: 0
answer count: 1
has title: Reading parameters from jsp page in the server

http://stackoverflow.com/q/23859038
linked to: http://stackoverflow.com/q/1967136
has body: I just started developing for android and I am trying to figure out how to get a users signal strength. The following code gives me the Dbm for a GSM network: TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); // Get GSM Signal Strength (Dbm) CellInfoGsm GSM = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0); CellSignalStrengthGsm cellSignalStrengthGsm = GSM.getCellSignalStrength(); signalStrength = cellSignalStrengthGsm.getDbm(); However I want to be able to get the signal strength from any kind of network. May it be GSM, LTE, CDMA, or WCDMA. I have looked at the telephony documentation but I'm lost in how to go about this. I have tried to take the same code as above and just replace Gsm with Lte but that ended up crashing my emulator. Any help would be greatly appreciated. Updated and added the listener from the answer below. However now as soon as i run the app it crashes. This is the log file. 05-26 11:25:21.140: D/AndroidRuntime(921): Shutting down VM 05-26 11:25:21.140: W/dalvikvm(921): threadid=1: thread exiting with uncaught exception (group=0xb3aecba8) 05-26 11:25:21.170: E/AndroidRuntime(921): FATAL EXCEPTION: main 05-26 11:25:21.170: E/AndroidRuntime(921): Process: com.example.androidcellinfo, PID: 921 05-26 11:25:21.170: E/AndroidRuntime(921): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidcellinfo/com.example.androidcellinfo.MainActivity}: java.lang.NullPointerException 05-26 11:25:21.170: E/AndroidRuntime(921): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-26 11:25:21.170: E/AndroidRuntime(921): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-26 11:25:21.170: E/AndroidRuntime(921): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-26 11:25:21.170: E/AndroidRuntime(921): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-26 11:25:21.170: E/AndroidRuntime(…
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/7207175
has answer: http://stackoverflow.com/a/23859101
duplicate of: http://stackoverflow.com/q/1967136
favorite count: 0
linked to: http://stackoverflow.com/q/10454388
has title: How to get android signal strength
tagged with: android
tagged with: telephonymanager
type: UnansweredQuestion
upvote count: 7
score: 7
tagged with: java
type: Question

http://stackoverflow.com/q/23870081
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23870418
has answer: http://stackoverflow.com/a/23870288
has comment: http://stackoverflow.com/comment/36742280
upvote count: 1
has body: Alright so i have been trying to run a for loop that runs 60 times. In this for loop i am using Thread.sleep(2000); to ping a server. I want to do this 10 times for this thread but for a separate loop through the for loop. In the mean time i want another 6 threads running doing 10 of their own so this hole process is sped up and completed in around 12 seconds. for(int i = 0; i &lt; 6; i++) { //I am starting a new thread here. } @Override public void run() { //THIS is where i want a each thread to be doing 10 each to speed up the process. for(int i = 0; i &lt; 60; i++) { //Pinging server. Thread.sleep(2000L); //Gets info from server here. That is why there is a 2 second delay. } } I am sorry if this is hard to understand but i tried setting this out in the simplest way possible. Thanks in advance.
has comment: http://stackoverflow.com/comment/36741947
favorite count: 0
has title: MultiThreading with for loops in Java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/23870288
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36741900
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23870418
type: Question

http://stackoverflow.com/a/23884448
answers question: http://stackoverflow.com/q/23877969
score: 0
has body: You have to add HBase jar file into your class path. You can also seee Hbase installation stuff at this site : http://www.improgrammer.net/tag/hbase/
type: Answer

http://stackoverflow.com/a/23923203
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23922300
has body: Each of your customers creates an instance of CustomerContainer subclass that receives its own Lock object. Consider making the one final static Lock which should protect the resource you wish to access concurrently, in your case customerList. What you have now is one lock for each instance of customer because each customer creates CustomerContainer subclass and your lock is not static. Consider also keyword synchronized unless you really need reentrant lock features. Having more than one lock per resource negates the point of lock.
accepted answer of: http://stackoverflow.com/q/23922300
score: 0

http://stackoverflow.com/a/23883226
accepted answer of: http://stackoverflow.com/q/23871510
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23871510
type: Answer
upvote count: 5
has body: To not leave this question unanswered: In case you have a lot of different images, you should use a TextureAtlas. To create those, you can either use it directly from code (see this wiki article), or use this (a bit outdated) GUI. Using an atlas will solve many problems at once. It will decrease the loading time. It will solve the problem of being forced to have textures of a size with a power of two (POT). An atlas will usually be of a valid size by default. Since you pack several images at once into one big texture, the size in total becomes smaller (less memory consumption), because you only have to extend a single image to POT size, instead of every single one. The performance will increase because there are less texture bindings necessary. All you do is draw different parts of the same texture.

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/23827571
tags question: http://stackoverflow.com/q/23900079
tags question: http://stackoverflow.com/q/23811568
type: Tag

http://stackoverflow.com/q/23857246
has comment: http://stackoverflow.com/comment/36717521
has comment: http://stackoverflow.com/comment/36717614
upvote count: 0
tagged with: java
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/23857296
has title: Saving an int variable "highscore" with sharedpreferences
linked to: http://stackoverflow.com/q/3624280
type: Question
has comment: http://stackoverflow.com/comment/36717581
has comment: http://stackoverflow.com/comment/36717625
has comment: http://stackoverflow.com/comment/36717547
tagged with: adt
has comment: http://stackoverflow.com/comment/36717734
has comment: http://stackoverflow.com/comment/36717646
has comment: http://stackoverflow.com/comment/36717901
answer count: 1
downvote count: 1
has body: I am developing a game and I have written all the code, including the code that makes sure the highscore int is updated. Now I am wondering how I could save this int with SharedPreferences. I am an beginning programmer, so could you give me all the steps I would have to do? The variable highscore is in the MainView and I came to the understanding that you would have to save something with shared preferences in the MainActivity.
duplicate of: http://stackoverflow.com/q/3624280
favorite count: 0
has comment: http://stackoverflow.com/comment/36717508
has comment: http://stackoverflow.com/comment/36717847
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36717751
has comment: http://stackoverflow.com/comment/36717595

http://stackoverflow.com/comment/36747183
comment on: http://stackoverflow.com/a/23865758
score: 0
has text: Not sure if I understand you correctly, but `public Set<Product> filter(Class<Product> clazz, Predicate<Product> predicate)` and `public Set<Customer> filter(Class<Customer> clazz, Predicate<Customer> predicate)` creates same erasure error
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36844332
comment on: http://stackoverflow.com/q/23923703
score: 0
type: QuestionComment
type: Comment
has text: The emulator can sometimes lose connection with Eclipse. When you execute your android app and the emulator starts up, you should see "Waiting for HOME" in the console

http://stackoverflow.com/q/23838526
favorite count: 0
has body: I am trying to declare an integer generated at random to a variable ("i") and use that in a if statement. I keep getting errors sating that it doesn't recognize "i" and that "i" wasn't declared. If any one could shed some light on the situation, I would be grateful. This is in an Applet that I am making. public int tGen() { Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(10); return randomInt; } public int tortoiseMoves() { i = tGen(); if (i &gt;= 1 &amp;&amp; i &lt;= 5) { System.out.println(i); } } } The i = tGen() is the part I think is wrong and the System.out.println() is just a test to see what i is and if the if statement works. And the tGen() method is a generator.
tagged with: declaration
has answer: http://stackoverflow.com/a/23838554
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36681972
tagged with: java
score: -1
type: Question
answer count: 2
has title: Error declaring a variable with the declaration statement a method
has comment: http://stackoverflow.com/comment/36681648
has answer: http://stackoverflow.com/a/23838542
has comment: http://stackoverflow.com/comment/36681655
has comment: http://stackoverflow.com/comment/36681674
upvote count: 1
has comment: http://stackoverflow.com/comment/36681701

http://stackoverflow.com/q/23881534
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23883130
tagged with: keystore
has body: I have created a keystore and it includes private key and public key. I need to retrieve my public key and private key using java codes. I found a method to retrieve the private key from here. But I cannot find a way to retrieve the public key. Can anyone tell me a way to take my public key out
tagged with: cryptography
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36763654
score: 0
tagged with: private-key
has comment: http://stackoverflow.com/comment/36792272
tagged with: public-key-encryption
answer count: 1
has title: retrieving the public key from keystore

http://stackoverflow.com/comment/36621860
comment on: http://stackoverflow.com/a/23805976
type: Comment
has text: through class reference
score: 0
type: AnswerComment

http://stackoverflow.com/comment/119728454
score: 0
type: Comment
has text: I was also having a similar requirement of using a subset of threadpool but couldn't find any solution. Here is the approach I followed, I created an application level Semaphore allowing say 50 number of consequent access. I have wrapped my functionality which requires threadpool with this semaphore. Instead of using a global threadpoolexecutor, I am using Executors.newFixedThreadPool(10). After my concurrent request is completed I am releasing the lock on semaphore
comment on: http://stackoverflow.com/a/23808676
type: AnswerComment

http://stackoverflow.com/comment/36650303
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23822079
has text: Do you have to do this in Java ? do you have to actually set the bgcolor on the HTML tag (no use of a CSS file) ? Can you provide a little bit more context to your problem to help us answer it ?

http://stackoverflow.com/comment/36871030
score: 0
comment on: http://stackoverflow.com/a/23936455
type: Comment
has text: @Luiggi Thanks. Why do you think it wouldn't work and when do you think `@PreDestory` will be invoked? I just tried to stop and undeploy the application, the method gets notified.
type: AnswerComment

http://stackoverflow.com/q/23783550
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36577780
tagged with: string
has comment: http://stackoverflow.com/comment/36578367
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36605042
answer count: 3
has comment: http://stackoverflow.com/comment/36578110
accepted answer: http://stackoverflow.com/a/23784597
possible better answer: http://stackoverflow.com/a/23783737
has comment: http://stackoverflow.com/comment/36578156
has body: I have to check whether an arraylist contains any of the value passed through an object. Consider an arraylist with values "abc", "jkl","def", "ghi". And String check="abc,ghi" We have to check whether any of the value in string (abc or ghi) is present in the arraylist and we can stop checking when a match is found. Traditionally, we can split the String check with comma and use arraylist.contains() in iteration for each comma separated values. But this is time consuming. Is there any better way to do this check.
has comment: http://stackoverflow.com/comment/36578945
favorite count: 0
has comment: http://stackoverflow.com/comment/36607165
has comment: http://stackoverflow.com/comment/36607276
has comment: http://stackoverflow.com/comment/36577497
has answer: http://stackoverflow.com/a/23783709
tagged with: equals
has title: Efficient way to find multiple objects in Arraylist
has comment: http://stackoverflow.com/comment/36606383
has comment: http://stackoverflow.com/comment/36578431
has answer: http://stackoverflow.com/a/23783737
has answer: http://stackoverflow.com/a/23784597
has comment: http://stackoverflow.com/comment/36577469
has comment: http://stackoverflow.com/comment/36606350
has comment: http://stackoverflow.com/comment/36605569
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36577568
has comment: http://stackoverflow.com/comment/36577187
has comment: http://stackoverflow.com/comment/36577542
has comment: http://stackoverflow.com/comment/36577875
has comment: http://stackoverflow.com/comment/36606736
has comment: http://stackoverflow.com/comment/36578089
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36605443
has comment: http://stackoverflow.com/comment/36606240
has comment: http://stackoverflow.com/comment/36578289
type: Question
has comment: http://stackoverflow.com/comment/36605166
has comment: http://stackoverflow.com/comment/36606707
tagged with: contains
has comment: http://stackoverflow.com/comment/36604958

http://stackoverflow.com/q/23812292
linked to: http://stackoverflow.com/q/3965484
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23812359
tagged with: java
has answer: http://stackoverflow.com/a/23812359
type: Question
has answer: http://stackoverflow.com/a/23813121
answer count: 2
has body: I want to increase the size of the check in the checkbox. I am thinking that I add an image for a new check. But I don't see any options in XML to change the check for the checkbox. Is there an XML option I am missing or a way to add the new check image to java.
has title: Increasing the size of the check in Checkbox
score: 0
tagged with: android
tagged with: checkbox
accepted answer: http://stackoverflow.com/a/23813121
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23863716
type: Question
linked to: http://stackoverflow.com/q/21887358
tagged with: generics
has comment: http://stackoverflow.com/comment/36730873
has comment: http://stackoverflow.com/comment/36731500
has comment: http://stackoverflow.com/comment/36730214
has answer: http://stackoverflow.com/a/70322761
has comment: http://stackoverflow.com/comment/36730316
answer count: 2
has comment: http://stackoverflow.com/comment/36730709
tagged with: lambda
has comment: http://stackoverflow.com/comment/36730558
upvote count: 23
linked to: http://stackoverflow.com/q/23865950
has comment: http://stackoverflow.com/comment/36731209
has answer: http://stackoverflow.com/a/25612775
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36731101
has comment: http://stackoverflow.com/comment/36730442
has comment: http://stackoverflow.com/comment/36730517
has comment: http://stackoverflow.com/comment/36730504
has comment: http://stackoverflow.com/comment/36768565
has title: Java: how to resolve generic type of lambda parameter?
downvote count: 0
has comment: http://stackoverflow.com/comment/51173829
has comment: http://stackoverflow.com/comment/36730574
has comment: http://stackoverflow.com/comment/51174895
score: 23
favorite count: 0
has body: We have this functional interface: public interface Consumer&lt;T&gt; { void accept(T t); } And I can use it like this: .handle(Integer p -&gt; System.out.println(p * 2)); How can we resolve the actual generic type of that lambda parameter in our code? When we use it as an inline implementation it isn't so difficult to extract the Integer from the method of that class. Do I miss anything? Or just Java doesn't support it for lambda classes ? To be more clear: That lambda is wrapped with MethodInvoker (in the mentioned handle), which in its execute(Message&lt;?&gt; message) extracts actual parameters for further reflection method invocation. Before that it converts provided arguments to target parameters using Spring's ConversionService. The method handle in this case is some configurer before the real application work. The different question, but with expectation for the solution for the same issue: Java: get actual type of generic method with lambda parameter

http://stackoverflow.com/comment/38153292
has text: _I have to assume that pooled connections of the same class have the same characteristics_ You mean of the same `Class<T>` where `T extends SocketFactory`, right? If that's true, than would it be different if you used comparison by instance of `T` rather than by `Class<T>`? I mean that the general assumption (by design) is that given any 2 instances of `? extends SocketFactory` we can tell whether we can use connections created by them interchangeably.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24616088

http://stackoverflow.com/a/23784787
answers question: http://stackoverflow.com/q/23783839
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can use a javax.servlet.Filter, just make sure it is the first on in the filter chain (by simply adding it at first place in your web.xml). Second thing you have to make sure is that the request header is added before the further chain is called. public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { // add header here chain.doFilter(request, response); }
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23783839

http://stackoverflow.com/comment/36786395
score: 0
type: Comment
type: QuestionComment
has text: The only purpose of using JSoup was to compare the text and detect the correct string to be replaced. then I want to replace the original string and not the text string. I hope you got my question now
comment on: http://stackoverflow.com/q/23892525

http://stackoverflow.com/a/23845155
score: 0
has body: You anticipated the size of the array and assumed it is always 10 which is the first mistake, then you did your division based on the number of array elements not their sum: int[] english = new int[10]; /* Now we assume you did some stuff here to fill the array. */ //averageEnglish public void averageEnglish() { System.out.println("The Average Mark Of English Is"); int noOfElements = english.length; // The divisor int sum = 0; // The dividend for (int i = 0; i &lt; noOfElements; i++) { sum += english[i]; } // Here is your Average (Should be of type double since there will be floating points) double averageEnglish = sum / noOfElements; System.out.println("-----------"); System.out.println(averageEnglish); System.out.println("-----------"); }//End of averageEnglish
type: Answer
answers question: http://stackoverflow.com/q/23843971

http://stackoverflow.com/comment/36813549
comment on: http://stackoverflow.com/a/23907458
type: AnswerComment
score: 0
type: Comment
has text: The first code gives me the right behaviour when a tab gets activated, but the color does not go back when the tab is deactivated.

http://stackoverflow.com/comment/36735299
score: 0
type: Comment
has text: I did use an activemq broker and its actually working. problem was is that sending messages to offline users is not enqueued for them to be later consumed when they are connecting again.
type: AnswerComment
comment on: http://stackoverflow.com/a/23865605

http://stackoverflow.com/q/23842257
accepted answer: http://stackoverflow.com/a/23842453
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23842461
has body: I am facing a weird problem, I have a Java program which calls a shell script in netbeans. The shell script is supposed to create a file in the same directory where the script is running. But in this case the output file is getting created in netbeans (workflow) folder. can anyone let me know where am i going wrong. I cant change the script as it is dynamic. Note: If i run the class on command prompt the file is created in script directory itself, problem is when i run in netbeans Appreciate any help
has comment: http://stackoverflow.com/comment/36688953
has answer: http://stackoverflow.com/a/23842461
has answer: http://stackoverflow.com/a/23842453
tagged with: bash
type: AnsweredQuestion
tagged with: shell
tagged with: netbeans
has title: Shell Script output is in different directory
type: Question
answer count: 2

http://stackoverflow.com/q/23787222
favorite count: 0
score: 0
tagged with: http://stackoverflow.com/tag/xlsx
has title: Spreadsheet generation for both Microsoft Excel and Open/Libre office
has comment: http://stackoverflow.com/comment/36585884
tagged with: openoffice-calc
answer count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: excel
tagged with: java
tagged with: ods
has body: I need to generate programmatically with Java 2 spreadsheets with the same content, that differ in the file format. One for .xlsx and one for .ods As far as I understand I have 2 options: Use 2 spreadsheet generation libraries (I would opt out for Apache POI and Apache ODFDOM) Use 1 library. Generate either .xlsx or .ods and then use a converter library. The question is - which one is better?. However that is too vague of a question. What is the quality of conversion from .xlsx to .ods (and vice versa) and what Java libraries would you recommend? How does the performance compare between the two? Performance is not important, but if one method is twice as fast/takes up half the memory, I would opt out for that method. (Actually memory footprint is fairly important). Any other comments from experience? PS. The size of the documents can vary dramatically - from 1 row to a thousand. The generation is happening on a server. EDIT: There are no formulas present yet, but it is something that I have not given any thought yet. The main point of the switch from CSV is for formatting, and there is probably not much that can be done with formulas.
type: Question
has comment: http://stackoverflow.com/comment/36585988
has comment: http://stackoverflow.com/comment/36584843

newtons-method
tag name: newtons-method
type: Tag
tags question: http://stackoverflow.com/q/23830165

http://stackoverflow.com/comment/36857433
comment on: http://stackoverflow.com/a/23911243
type: AnswerComment
score: 0
type: Comment
has text: not helpful - you've said you need the spring runner, presumably to provide some config. You can always supply a different application-context,xml file for this test, with the relevant piece of config omitted or changed. Does this help?

http://stackoverflow.com/comment/36866616
has text: This is *not* the same thing. Here, you're assigning a raw type to a generic variable, and so do *not* get the type safety generics provides.
comment on: http://stackoverflow.com/a/23935950
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23879683
has comment: http://stackoverflow.com/comment/36760261
downvote count: 0
has body: In case you want to call the method of inner class using class name or we can say statically then you need to do following changes. Declare inner class method to be static. A non static inner class can never have a static method So you need to change inner class to be static. public class EnclosingClass{ public void enclosingClassMethod(){ InnerClass iC = new InnerClass(); iC.innerClassPrivateMethod(); // this one works but why the following line doesn't //work InnerClass.innerClassPrivateMethod(); // This also works... } public static class InnerClass{ // Class converted to static private static void innerClassPrivateMethod(){ // Method converted to static } } }
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23879387
answers question: http://stackoverflow.com/q/23879387
type: Answer
score: 2

http://stackoverflow.com/comment/36762378
type: QuestionComment
comment on: http://stackoverflow.com/q/23880401
has text: @AdamSilva One thing I noticed is that k & l are always zero in the for loop. You never defined coords[0] & coords[1] as anything so they are without a value. This makes the for loop useless as there is no iterations.
score: 0
type: Comment

http://stackoverflow.com/comment/36639019
has text: Thank's for a so quick answer. I didn't know that they were "thin client" too. I Need to edit my question, Give me a few sec !
type: AnswerComment
comment on: http://stackoverflow.com/a/23816099
score: 0
type: Comment

http://stackoverflow.com/comment/36759962
type: Comment
comment on: http://stackoverflow.com/a/23877116
has text: Thanks Nicko. I eventually made my regex working but found it was too slow: list.matches("(.*[,]|^)" + str1 + "([,].*|$)"); (might not be accurate I wrote from my memory). So I ended up using exactly the same method (looping, indexOf and checking boundary). It is by far the fastest compared to regex and split and comparing
score: 1
type: AnswerComment

transactions
tags question: http://stackoverflow.com/q/23809885
tags question: http://stackoverflow.com/q/23913665
tags question: http://stackoverflow.com/q/23906091
tags question: http://stackoverflow.com/q/23852451
tags question: http://stackoverflow.com/q/23897033
tags question: http://stackoverflow.com/q/23846458
tags question: http://stackoverflow.com/q/23880095
tag name: transactions
tags question: http://stackoverflow.com/q/23844092
tags question: http://stackoverflow.com/q/23790333
tags question: http://stackoverflow.com/q/23912293
tags question: http://stackoverflow.com/q/23904362
tags question: http://stackoverflow.com/q/23931698
tags question: http://stackoverflow.com/q/23928067
tags question: http://stackoverflow.com/q/23921386
type: Tag
tags question: http://stackoverflow.com/q/23922894
tags question: http://stackoverflow.com/q/23784256
tags question: http://stackoverflow.com/q/23831728
tags question: http://stackoverflow.com/q/23879444

http://stackoverflow.com/a/23809648
score: 0
has comment: http://stackoverflow.com/comment/36626773
has body: You are using com.example.stands.Location(the class that you created) in DatabaseHandler while in your activity you are using android.location.Location which is giving you this error. Change db.addLocation(new Location(name, lat, lng)); to db.addLocation(new com.example.stands.Location(name, lat, lng));
type: Answer
answers question: http://stackoverflow.com/q/23809542
has comment: http://stackoverflow.com/comment/36626296
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36626672
accepted answer of: http://stackoverflow.com/q/23809542
has comment: http://stackoverflow.com/comment/36626639
type: AcceptedAnswer

http://stackoverflow.com/comment/36856991
type: Comment
comment on: http://stackoverflow.com/q/23928128
score: 0
has text: I'm getting the same error after putting the artifactItems inside my Maven-plugin configuration. I just filled the artifactdetails with Current Project. Still error follows me. This looks that invokes the error while the goal unpack of maven.
type: QuestionComment

http://stackoverflow.com/comment/36655530
type: QuestionComment
comment on: http://stackoverflow.com/q/23824684
has text: onPostExecute is returned some JSON. the `task` variable you see up top is a class i implement on the fly to handle the data returned by the server (it deals with a data structure directly, no json). when the data being returned from the server was consistent, i had no issues. now that there is some variation between what is returned, i want to handle it all in one place (my service class). what i'm currently doing is parsing json in every activity and manually specifying the JSON class file gson feeds into in the activity. the end result is very verbose and not DRY at all.
score: 0
type: Comment

http://stackoverflow.com/comment/36836789
comment on: http://stackoverflow.com/q/23919809
type: QuestionComment
has text: I think the question would be clearer if it included some code examples.
type: Comment
score: 3

http://stackoverflow.com/comment/36765385
comment on: http://stackoverflow.com/q/23882552
score: 2
has text: Your third url is invalid. It's missing `http://`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36650053
has text: @DavidWallace I have eclipse, but when i run or compile or try to all it has is antbuild
score: 0
comment on: http://stackoverflow.com/q/23821833
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23828608
has comment: http://stackoverflow.com/comment/36675653
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36675787
type: Answer
has comment: http://stackoverflow.com/comment/36673969
has body: Note that you're trying to do something more complex with the cells in your ListView than you were with the cells in the TableView. In the TableView, the objects displayed in the cells were changing, so it was easy for the cells to observe this. In the ListView, you want the cells to notice when properties that belong to the objects displayed in the cells change; this is one further step removed, so you have to do a bit of extra coding (though not much, as you'll see). You could create a custom cell factory to bind to the stepNameProperty(), but it's tricky (you have to make sure to unbind/remove listeners from old items in the updateItem() method). The easier way, though, which isn't well documented is to use an ObservableList with an extractor defined. First, fix your method names: you have some weird mismatches in the code you posted. The getX/setX/xProperty method names should all match correctly. I.e. instead of public void setName(String name) { stepName.setValue(name); } public String getName() { return stepName.getValue(); } public StringProperty stepNameProperty() { return actionStepID; } you should have public final void setName(String name) { stepName.setValue(name); } public final String getName() { return stepName.getValue(); } public StringProperty nameProperty() { return stepName; } and similarly for the other property accessor methods. (Obviously, the names of the fields can be anything you like, as they're private.) Making the get/set methods final is good practice. Then, create the list with an extractor. The extractor is a function that maps each element in the list to an array of Observables which the list will observe. If those values change, it will fire list updates to the list's observers. Since your ActionStep's toString() method references the nameProperty(), I assume you want the ListView to update if the nameProperty() changes. So you want to do listOfSteps = FXCollections.observableArrayList( actionStep -&gt; new Observable[] { actionSte…
score: 8
has comment: http://stackoverflow.com/comment/36666280
has comment: http://stackoverflow.com/comment/36675398
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23822550
answers question: http://stackoverflow.com/q/23822550
upvote count: 8
has comment: http://stackoverflow.com/comment/36675105

http://stackoverflow.com/a/23882304
type: Answer
has comment: http://stackoverflow.com/comment/36765433
answers question: http://stackoverflow.com/q/23882242
score: 0
has body: Just use split(",") for String Class to get Array of "," Seperated values. String data = "Domlur, Old Hal Airport Road, Bangalore, Karnataka" ; String dataArray[] = data.split(","); for(int i=0;i&lt;dataArray.length;i++){ dataArray[i] = dataArray[i].trim(); // Here i am using trim() for removing space in left and right } Or you can do it Simpler System.out.println(data.split(",")[0]+","+data.split(",")[1]);

http://stackoverflow.com/comment/36982681
score: 0
type: Comment
has text: @mookpoint - All the external mapping file has done is told MOXy to remove the `@XmlList` from the property.
comment on: http://stackoverflow.com/a/23962669
type: AnswerComment

http://stackoverflow.com/q/23819301
has body: I've been writing a program to graph datapoints in Java. I need a lots of flexibility and speed so I don't want to use an existing library as much as possible. Right now, it essentially uses Graphics2D to draw lines and dots representing the points in a file of data. My problem is, some of my datasets have upwards of 100,000 points.When it is going to be rendered with all full drag/zoom functionality, it is getting quite slow. My question is, how can I reduce this dataset or make a simplification of it so that I can display the graph without changing the overall shape? I could only draw every third point, for instance, but what if that skipped over and didn't display an important outlier? I could try averaging groups of points, but that could have the same problem. And for services like Google Finance, where they probably have millions of points to display, how do they deal with this?
tagged with: rendering
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36645357
tagged with: optimization
type: Question
has answer: http://stackoverflow.com/a/23819541
answer count: 1
downvote count: 0
tagged with: dataset
has comment: http://stackoverflow.com/comment/36645191
favorite count: 0
tagged with: graphing
has comment: http://stackoverflow.com/comment/36645083
has title: How can I optimize the rendering of a graph while preserving the shape?

http://stackoverflow.com/a/23873479
has body: LocalDate is supposed to represent an actual date - you only pass a day name (Monday) which can't be translated into a proper 26-May-2014, for example. If all you want is to parse the day of week, you can use: DateTimeFormatter fmt = DateTimeFormatter.ofPattern("EEE", Locale.ITALY); DayOfWeek day = DayOfWeek.from(fmt.parse("lun"));
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/23873200
answers question: http://stackoverflow.com/q/23873200
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36747807
type: Answer

http://stackoverflow.com/a/23853222
score: 8
has comment: http://stackoverflow.com/comment/83163385
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23848014
upvote count: 8
has body: As far as I can tell, unlock() will check with the local Play Games app first to see if the achievement is already unlocked, and only if it is not will it send the request to the server. This means that calling unlock() on an already unlocked achievement should not affect any quotas apart from the first time it is called on a device - since the device's instance of the Play Games may not have synced that achievement from the server yet. On the other hand, it is possible to check the state of all achievements after signing-in and keeping a local copy of their states - which indeed you should do if the player is NOT signed-in (so that you can unlock any achievements earned at the next sign-in). This process is not documented well anywhere except for the API documentation but there are no full examples, so I will give you one here :) Ensure that you run this method asynchronously (using AsyncTask or a separate thread) as it will take some time to complete (waiting for responses from the server). Also, do this only when the player is signed in successfully - onSignInSucceeded() is a good place for it. Update for Play Service Games 11.8.0 public void loadAchievements() { mAchievementsClient.load(true).addOnCompleteListener(new OnCompleteListener&lt;AnnotatedData&lt;AchievementBuffer&gt;&gt;() { @Override public void onComplete(@NonNull Task&lt;AnnotatedData&lt;AchievementBuffer&gt;&gt; task) { AchievementBuffer buff = task.getResult().get(); Log.d("BUFF", "onComplete: "); int bufSize = buff.getCount(); for (int i=0; i &lt; bufSize; i++) { Achievement ach = buff.get(i); String id = ach.getAchievementId(); boolean unlocked = ach.getState() == Achievement.STATE_UNLOCKED; } buff.release(); } }); Older Play Service Games public void loadAchievements() { boolean fullLoad = false; // set to 'true' to reload all achievements (ignoring cache) float waitTime = 60.0f; // seconds to wait for achievements to load before timing out // load achievements PendingResult p = Games.Achievem…
accepted answer of: http://stackoverflow.com/q/23848014
type: AcceptedAnswer

http://stackoverflow.com/a/23849713
downvote count: 0
has comment: http://stackoverflow.com/comment/36704175
has comment: http://stackoverflow.com/comment/36703817
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36703601
type: AcceptedAnswer
has body: There is no need to use a MouseListener. You just need to use a proper editor for the column and the table will handle it for you. Read the section from the Swing tutorial on How to Use Tables for more information and working examples. Basically you need to do two things: Add Boolean data to the TableModel Override the getColumnClass(...) method of the TableModel to return Boolean.class for that column and the table will choose the appropriate editor. Above is the answer for your question, but for future information the MouseEvent is relative to the table, so you want to use table methods to access the data. That is you would use table.getValueAt(...) and table.setValueAt(...). These reference the data as it is currently displayed in the view of the table. That is the view could be sorted or the column could have been moved.
accepted answer of: http://stackoverflow.com/q/23849667
answers question: http://stackoverflow.com/q/23849667
score: 3

http://stackoverflow.com/comment/36659392
comment on: http://stackoverflow.com/q/23826574
score: 0
type: QuestionComment
type: Comment
has text: is this Your own app or an example? Because if you are using an example with the same package Name, then it is possible that it doesn´t work..

http://stackoverflow.com/comment/36571626
has text: Do you mean wrapping other exceptions when you say exception chaining?
type: QuestionComment
comment on: http://stackoverflow.com/q/23780523
score: 0
type: Comment

http://stackoverflow.com/a/23878988
has body: To answer the question in your title, because you assigned three successive different values to it inside the loop.
answers question: http://stackoverflow.com/q/23878855
score: 0
type: Answer

http://stackoverflow.com/comment/36723958
type: Comment
comment on: http://stackoverflow.com/a/23859604
type: AnswerComment
score: 0
has text: Thanks, but i dont want to insert the values myself, i want them to be inserted automatically via the users score

http://stackoverflow.com/comment/36879038
comment on: http://stackoverflow.com/a/23941631
score: 0
type: AnswerComment
type: Comment
has text: The AlarmManager should be permanent, but stops your receiver when the application is closed. You could check this Thread, that has a similar problem to yours. http://stackoverflow.com/questions/16274988/using-an-alarmmanager-to-check-periodically-that-my-permanent-service-is-running

http://stackoverflow.com/comment/36868365
has text: Where are you updating your player position?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23935973

http://stackoverflow.com/comment/36800384
has text: Is the XML file you supplied the layout that is being set as the contentView in your activity (i.e. is it activity_main) or is it the fragment layout?
score: 0
comment on: http://stackoverflow.com/q/23899900
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26387956
answers question: http://stackoverflow.com/q/23893345
type: Answer
has body: Could you add @Temporal(TemporalType.DATE) @javax.persistence.Column(name = "FECHA_PUBLICACION_DESDE", nullable = false, insertable = true, updatable = true, length = 19, precision = 0) @Temporal(TemporalType.DATE) private Date fechaPublicacionDesde;
score: 0

http://stackoverflow.com/a/23879133
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36799376
accepted answer of: http://stackoverflow.com/q/23877596
answers question: http://stackoverflow.com/q/23877596
has body: There are many ways you could approach this. One of the simplest to understand if you're just starting out learning to program, would be to have a bunch of images for different levels of the cup. For example: // Sets the image for the three cup, based on the fill level supplied public void setThreeCupImage(int fillLevel) { // make an int array containing the relevant images. int[] threeCupLevels = {R.drawable.threecup_level_1, R.drawable.threecup_level_2, R.drawable.threecup_level_3}; // get reference to an ImageView you've put in you layout xml. ImageView threeCupImage = (ImageView)findViewById(R.id.image_threecup); // set the ImageView to display the required image from the array. threeCupImage.setImageResource(threeCupLevels[fillLevel]); } Some tips regarding how you've written your other code... Hard coding mathematical results is not a good idea as you have done here: else if (threecup.getText().toString().equals("0") &amp;&amp; (fivecup.getText().toString().equals("5"))){ fivecup.setText("2"); threecup.setText("3"); This is inflexible and quickly becomes bulky and complicated in larger problems. Try and make you code more general. Computers are good at maths! Let them do the maths for you! For example, think about what the main variables are in this problem. They are: The sizes of the cups The levels they are filled to A more general way to code your problem may be to first define a Cup class: public class Cup { // public fields of the class public final int cupSize; // this is final because a cup does not change size. public int cupLevel; // this is NOT final because level can vary // class constructor public Cup(int size, int level) { cupSize = size; cupLevel = level; } } Then you can create cups and change their contents as needed: // create a new cup with a size of 5 and fill level of 0 (empty) Cup fiveCup = new Cup(5, 0) // create a new cup with a size of 3 and fill level of 3 (full) Cup threeCup = new Cup(3, 3) // change the level of fiveCup fiveCup.cupL…
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/36852862
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23928392
has text: That may be useful but is the kind of list Internet is full of. I am talking about small changes, not the big ones. I'll edit the question to add an example.

http://stackoverflow.com/comment/36773262
score: 0
type: Comment
type: QuestionComment
has text: So what is the problem - use Mockito
comment on: http://stackoverflow.com/q/23882277

http://stackoverflow.com/comment/36791715
comment on: http://stackoverflow.com/a/23895972
has text: @invariant I don't know of a clean way to do it by just declaring a bean. You could create your own `ApplicationContextAware` bean which adds them.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36721081
type: AnswerComment
comment on: http://stackoverflow.com/a/23841643
score: 0
type: Comment
has text: I downloaded the code and tried it out, and for my purposes I think it works, however there is one problem. If I try to abstract parts of the code such that I can specify a quote and a location for the text bubble, I get a compiler error saying that since it uses inner classes, the parameters I pass in have to be declared final. Now the error itself is obvious, but I wonder how you would go about adding in the ability to specify a quote and location, given this setup. I could try to rehash this code entirely but I wonder if there's a way to do it preserving this architecture

http://stackoverflow.com/comment/36763870
has text: Exactly , wrap this in a method with the url as a parameter , again this may not work as in the second answer you may be forwarded to an administration page. You will then need to read that page and decide if it is blocked.
type: AnswerComment
comment on: http://stackoverflow.com/a/23881448
type: Comment
score: 1

http://stackoverflow.com/q/23906727
type: AnsweredQuestion
has title: Does empty synchronized(this){} have any meaning to memory visibility between threads?
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/23920046
type: Question
upvote count: 27
answer count: 2
tagged with: volatile
downvote count: 0
score: 27
tagged with: synchronized
favorite count: 0
has answer: http://stackoverflow.com/a/23961401
accepted answer: http://stackoverflow.com/a/23920046
tagged with: memory-model
possible better answer: http://stackoverflow.com/a/23961401
has body: I read this in an upvoted comment on StackOverflow: But if you want to be safe, you can add simple synchronized(this) {} at the end of you @PostConstruct [method] [note that variables were NOT volatile] I was thinking that happens-before is forced only if both write and read is executed in synchronized block or at least read is volatile. Is the quoted sentence correct? Does an empty synchronized(this) {} block flush all variables changed in current method to "general visible" memory? Please consider some scenerios what if second thread never calls lock on this? (suppose that second thread reads in other methods). Remember that question is about: flush changes to other threads, not give other threads a way (synchronized) to poll changes made by original thread. Also no-synchronization in other methods is very likely in Spring @PostConstruct context - as original comment says. is memory visibility of changes forced only in second and subsequent calls by another thread? (remember that this synchronized block is a last call in our method) - this would mark this way of synchronization as very bad practice (stale values in first call)

http://stackoverflow.com/comment/36823605
comment on: http://stackoverflow.com/a/23912485
type: AnswerComment
has text: @ElliottFrisch : But your code just returns 0 for all byte numbers.
score: 0
type: Comment

http://stackoverflow.com/comment/36717713
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23857169
type: Comment
has text: Eclipse\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs ??? I add this library

http://stackoverflow.com/comment/36721614
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23858751
has text: Can you try shutting down your database and running this program again? we need proof that the database that you're trying to access is indeed the database that you *think* you're accessing.

http://stackoverflow.com/a/23919650
has body: Using the getScaledInstance() method works fine for me. Here's the code i was testing with: public class Resize { public static void main(String[] args) throws Exception { final Image logo = ImageIO.read(new URL("http://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png")); final Dimension dim = new Dimension(logo.getWidth(null), logo.getHeight(null)); final JFrame frame = new JFrame(); frame.add(new JPanel() { @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(logo.getScaledInstance(dim.width, dim.height, 0), 0, 0, this); } }); final JSlider xSlider = new JSlider(JSlider.HORIZONTAL, 1, dim.width*3, dim.width); final JSlider ySlider = new JSlider(JSlider.VERTICAL, 1, dim.height*3, dim.height); ChangeListener cl = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { dim.width = xSlider.getValue(); dim.height = ySlider.getValue(); frame.repaint(); } }; xSlider.addChangeListener(cl); ySlider.addChangeListener(cl); frame.add(xSlider, "South"); frame.add(ySlider, "East"); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); } }
accepted answer of: http://stackoverflow.com/q/23917518
type: Answer
answers question: http://stackoverflow.com/q/23917518
has comment: http://stackoverflow.com/comment/36859308
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36613735
type: Comment
has text: invokeLater will not help to avoid the repainting issue. Only SwingWorker
comment on: http://stackoverflow.com/a/23802872
score: 0
type: AnswerComment

http://stackoverflow.com/q/23898541
linked to: http://stackoverflow.com/q/4343202
linked to: http://stackoverflow.com/q/2776975
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23898577
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36796869
type: Question
has comment: http://stackoverflow.com/comment/36796755
answer count: 3
accepted answer: http://stackoverflow.com/a/23898577
possible better answer: http://stackoverflow.com/a/23899481
downvote count: 0
has answer: http://stackoverflow.com/a/23899481
favorite count: 0
has comment: http://stackoverflow.com/comment/36796842
tagged with: generics
has comment: http://stackoverflow.com/comment/36796904
has body: There is an external interface named Shape (name changed, but you get the idea). I have a class that has a constructor that takes Collection&lt;? extends Shape&gt; This class is under test. I am writing the unit tests. I want to create a Collection that extends Shape to provide to the constructor. I notice that no class in our project implements Shape, so I write an inner class: private class TestShape implements Shape { private static final long serialVersionUID = 1L; @Override public String getAuthority() { return "Foo"; } } Then I try to create my Collection ... private ArrayList&lt;? extends Shape&gt; shapes; shapes = new ArrayList&lt;Shape&gt;(); shapes.add(new TestShape()); Eclipse however is unhappy with me ... The method add(capture#1-of ? extends Shape) in the type ArrayList&lt;capture#1-of ? extends Shape&gt; is not applicable for the arguments (Test.TestShape) Why? edit: Lots of editing because generics syntax makes SO unhappy
has comment: http://stackoverflow.com/comment/36796737
has answer: http://stackoverflow.com/a/23899850
has title: java generics: bounded wildcard upsetting eclipse
upvote count: 1
has comment: http://stackoverflow.com/comment/36796816

http://stackoverflow.com/comment/36695316
score: 0
type: Comment
type: QuestionComment
has text: @DavidWallace Ok, I make it a class of it's own. Do you have any suggestion of how to make it work? How to get the withdrawals and deposits with transactionday...
comment on: http://stackoverflow.com/q/23844711

http://stackoverflow.com/comment/36598794
score: 0
comment on: http://stackoverflow.com/q/23794575
type: Comment
type: QuestionComment
has text: @EricLippert probably not, as various other sets of 10 digits also sum to 45

http://stackoverflow.com/comment/36638448
type: Comment
has text: Did you add the .jar to the classpath in Eclipse, after downloading?
type: QuestionComment
comment on: http://stackoverflow.com/q/23811134
score: 0

android-library
type: Tag
tags question: http://stackoverflow.com/q/23797596
tag name: android-library

http://stackoverflow.com/comment/36765950
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23882057
type: QuestionComment
has text: Hi, Got error removed after adding 3 annotations to my 'test.proto' file. namely "@max_repeated_length/@max_string_length/@max_bytes_length". Thanks for help.

http://stackoverflow.com/comment/36772466
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23886093
has text: no..its a method of imapmessage class

http://stackoverflow.com/comment/36647396
score: 2
has text: Welcome to Stack Overflow! An actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) would involve less guess work and better responses
type: QuestionComment
comment on: http://stackoverflow.com/q/23820488
type: Comment

http://stackoverflow.com/comment/36727851
type: Comment
has text: Yes exactly as outlined on the bottom of the page here: http://developer.android.com/guide/topics/sensors/sensors_position.html
score: 0
comment on: http://stackoverflow.com/a/23861387
type: AnswerComment

http://stackoverflow.com/comment/36892453
comment on: http://stackoverflow.com/q/23875038
type: Comment
type: QuestionComment
has text: The same principle can't be applied to Gradle, and I don't think it has to be.
score: 0

http://stackoverflow.com/comment/36746841
has text: You can go the the java control panel in the advanced tab and enable the console so you can see the stack trace of the error. However, here are a few guesses as to what it might be. Did you include all of the necessary libraries with your applet (lwjgl_util_applet.jar, gdx.jar, all gdx backends, all gdx natives, etc)? Did you sign all of them as well as your applet? Are you running it all on a web server (as opposed to just opening the index.html in your browser with no server)?
comment on: http://stackoverflow.com/a/23860391
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36942514
comment on: http://stackoverflow.com/a/23900559
type: Comment
has text: Sorry, I just realized that AutopopulatedList can't be declared directly on the controller. What we need is a wrapper model. I updated the answer. Please check.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36730489
score: 0
has text: Correct, but hat doesn't make it not a duplicate.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23863439

http://stackoverflow.com/comment/36672366
type: QuestionComment
has text: can you post a picture of what you want and what is happening? maybe the points you are settings hardcoded are not correct?
comment on: http://stackoverflow.com/q/23833326
score: 0
type: Comment

http://stackoverflow.com/q/23897305
tagged with: file
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23897325
score: 1
has comment: http://stackoverflow.com/comment/36794590
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23897325
has answer: http://stackoverflow.com/a/23897488
tagged with: newline
has answer: http://stackoverflow.com/a/23897533
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/23897488
answer count: 3
has body: I would like to save some words into *.txt file. But there is one condition: each word must be on new line. So I wrote this: String content =""; String nl = System.lineSeparator(); content += "my" + nl + "some" + nl + "random" + nl + "words"; But this code not working - all words are in the same line. So i tried with special characters - \r\n : String content =""; content += "my" + "\r\n" + "some" + "\r\n" + "random" + "\r\n" + "words"; Still didn't works - in file all words are in same line: mysomerandomwords In addition to this: my string content is save to file by: <a href="data:text/txt;charset=utf-8,<%=content%>" download="results.txt"> Download What kind of separator should I use to put words in another lines? (I'm using Netbeans 8.0. File is opens in windows notepad).
has comment: http://stackoverflow.com/comment/36794304
upvote count: 2
has title: Line separator for Windows in java
linked to: http://stackoverflow.com/q/18045391

http://stackoverflow.com/comment/36596368
score: 0
has text: Can you post a few lines from your input file and the expected count for those lines?
type: Comment
comment on: http://stackoverflow.com/q/23793343
type: QuestionComment

http://stackoverflow.com/a/23791025
has comment: http://stackoverflow.com/comment/36591478
has comment: http://stackoverflow.com/comment/36591680
upvote count: 2
has body: Line 97 is your problem. BonusB is null, so you cannot add it: add(BonusB);
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36591687
answers question: http://stackoverflow.com/q/23790915
has comment: http://stackoverflow.com/comment/36591624

http://stackoverflow.com/comment/36841895
score: 0
type: AnswerComment
type: Comment
has text: Why is the answer nearly always simple?
comment on: http://stackoverflow.com/a/23898526

http://stackoverflow.com/a/23832194
type: Answer
has body: Change line = line.replaceAll("", "new sentence"); to line = line.replaceAll(line 2, "new sentence");
answers question: http://stackoverflow.com/q/23832120
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/23824684
tagged with: generics
has comment: http://stackoverflow.com/comment/36655619
has title: how to solve.. abstract class? generics?
score: 0
has comment: http://stackoverflow.com/comment/36655530
type: AnsweredQuestion
tagged with: hashmap
has comment: http://stackoverflow.com/comment/36656050
accepted answer: http://stackoverflow.com/a/23825030
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36655346
tagged with: arraylist
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/36656573
has answer: http://stackoverflow.com/a/23825030
has body: In my current setup I have a centralized helper class like the following: @Override protected void onPostExecute(String result) { super.onPostExecute(result); if(task == null) { return; } Gson gson = new GsonBuilder().create(); ResponseJson p = null; try { p = gson.fromJson(result, ResponseJson.class); } catch(JsonSyntaxException e) { //Toast.makeText(getApplicationContext(), getApplicationContext().getResources().getString(R.string.toast_sync_completed), Toast.LENGTH_SHORT).show(); Log.e("", e.getMessage() + " got '" + result + "'"); } Log.i("", p.toString()); Log.i("", result); if(p.status.equals(ResultStatus.SUCCESS.toString())) { task.success(p.data); } else if (p.status.equals(ResultStatus.FAIL.toString())) { task.fail(p.data); } else if (p.status.equals(ResultStatus.ERROR.toString())) { task.error(p.message); } else { throw new UnsupportedOperationException(); } } the problem is i want to make the ResponseJson class to be dynamic and the data attribute to be unique (sometimes i need ArrayList&lt;Something&gt; other times HashMap&lt;String, String&gt;) works for converting my JSON result. can i achieve this using generics or some other means?

http://stackoverflow.com/comment/36628523
has text: sorry I am not good programmer and new android what you mean keep integrating the SDK. keep update files or download another files. I think I missing something but did know what is it?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23808496

http://stackoverflow.com/comment/36756133
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23877604
type: Comment
has text: @braj To be honest, I don't trust the OPs code, as the text area isn't even been added to the screen, but is suggested as the course of the problem, either the code is wrong or the description is wrong. The tip is still valid and is used to cover my back side ;)

http://stackoverflow.com/a/23930622
has comment: http://stackoverflow.com/comment/36856660
accepted answer of: http://stackoverflow.com/q/23930545
score: 1
has comment: http://stackoverflow.com/comment/36857019
answers question: http://stackoverflow.com/q/23930545
upvote count: 1
type: AcceptedAnswer
has body: it's a catch statement. what is in that block, will be executed if either a ClassNotFoundException or an IOException is thrown In releases prior to Java SE 7, it is difficult to create a common method to eliminate the duplicated code because the variable ex has different types. The following example, which is valid in Java SE 7 and later, eliminates the duplicated code: catch (IOException|SQLException ex) { logger.log(ex); throw ex; } The catch clause specifies the types of exceptions that the block can handle, and each exception type is separated with a vertical bar (|). Source : http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html
has comment: http://stackoverflow.com/comment/36856910
type: Answer
has comment: http://stackoverflow.com/comment/36856963
downvote count: 0

primary-key
tag name: primary-key
tags question: http://stackoverflow.com/q/23783248
type: Tag
tags question: http://stackoverflow.com/q/23825909

http://stackoverflow.com/comment/36757969
has text: What's wrong with the example where the derived class is calling a method permitted by the access rules, in the parent and not in the grandfather? I don't really see how your answer adds value...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23878533

http://stackoverflow.com/q/23882684
score: 1
tagged with: java
tagged with: database
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23882783
tagged with: api
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sql
accepted answer: http://stackoverflow.com/a/23882783
has title: jPlaton Database API - No rows returned
upvote count: 1
has body: I am developing a cloud based web application using the jPlaton platform and I have written a Java class where I am trying to run a query against the MySQL server. The query was first written and run in Navicat, so I am sure it is correct and returns the result I need. But through Java and the jPlaton API it just returns the column description and no rows. ArrayList res = service.getSession().executeQuery(utl.StaticString.DEFAULT_DATABASE, select.toString()); To I have to add or change something? Thanks
type: AnsweredQuestion

http://stackoverflow.com/a/23902743
answers question: http://stackoverflow.com/q/23902245
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23902245
type: Answer
upvote count: 1
has body: Your code is adding additional source directories, rather than overriding the defaults. To do the latter, use: sourceSets { main { java { srcDirs = ['src'] } resources { srcDirs = ['src'] } } } For more information, see SourceSet in the Gradle Build Language Reference.
score: 1

http://stackoverflow.com/comment/36676667
score: 3
has text: Stacktrace, please. http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
comment on: http://stackoverflow.com/q/23836049
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36756410
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23877045
type: AnswerComment
has text: Will that then allow me to load different content, depending on which country the user is in @nAvEeD kHaN

http://stackoverflow.com/q/23909436
tagged with: java
has title: Transferring file from local machine to server in WinSCP using Java
tagged with: winscp
linked to: http://stackoverflow.com/q/5925572
type: Question
has body: I want to write a notepad file and upload it to a WinSCP path. I used to create those files manually: Open the WinSCP, give the credentials, open the desired path and upload the file. Now I am in a situation to automate those things. Text will be entered in a text box or fetched from DB, it has to be written in a notepad file and should be uploaded to a WinSCP path. I have implemented writing the file and it is working fine. Now, how do I upload the file using Java?
has comment: http://stackoverflow.com/comment/36817029
has comment: http://stackoverflow.com/comment/36816905
has answer: http://stackoverflow.com/a/23910019
upvote count: 2
has comment: http://stackoverflow.com/comment/36817081
has comment: http://stackoverflow.com/comment/36819057
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/21060737
tagged with: jsch
favorite count: 0
type: UnansweredQuestion
tagged with: jcifs
linked to: http://stackoverflow.com/q/14617
linked to: http://stackoverflow.com/q/17454529
tagged with: scp
score: 2

http://stackoverflow.com/comment/36632073
score: 0
comment on: http://stackoverflow.com/q/23812601
type: Comment
has text: what do you mean by using this file ?? what do you want to do with the file..read, delete, save ?
type: QuestionComment

http://stackoverflow.com/q/23907728
favorite count: 0
type: Question
score: 3
tagged with: log4j
upvote count: 3
has answer: http://stackoverflow.com/a/27394213
answer count: 3
tagged with: java-8
has body: I try to port existing Java project into embedded environment. But I found log4j-1.2.14 could not work under such environment. Since it has dependency with Beans. I build the EJDK8 compact 2 environment. More information about EJDK8: http://www.oracle.com/technetwork/java/embedded/resources/tech/compact-profiles-overview-2157132.html When start the project, it has the following exceptions. Exception in thread "main" java.lang.NoClassDefFoundError: java/beans/IntrospectionException [java] at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:649) [java] at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612) [java] at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509) [java] at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415) [java] at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441) [java] at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470) [java] at org.apache.log4j.LogManager.(LogManager.java:122) [java] at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66) [java] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270) [java] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281) [java] at com.truviso.system.Application.(Application.java:36) [java] Caused by: java.lang.ClassNotFoundException: java.beans.IntrospectionException [java] at java.net.URLClassLoader$1.run(Unknown Source) [java] at java.net.URLClassLoader$1.run(Unknown Source) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(Unknown Source) [java] at java.lang.ClassLoader.loadClass(Unknown Source) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) [java] at java.lang.ClassLoader.loadClass(Unknown Source) [java] ... 11 more After reading log4j source code, I found there are many dependencies with jav…
has answer: http://stackoverflow.com/a/23907828
tagged with: java
has answer: http://stackoverflow.com/a/32144540
type: UnansweredQuestion
tagged with: embedded
downvote count: 0
has title: How to use log4j in Embedded JDK compact 1/2/3

http://stackoverflow.com/comment/36665560
type: QuestionComment
has text: The printlines print out: `FixtureA: null` `FixtureB: com.badlogic.gdx.physics.box2d.Fixture@76d5989c`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23814987

http://stackoverflow.com/comment/36718723
score: 0
type: AnswerComment
has text: It returns `false` for me.
type: Comment
comment on: http://stackoverflow.com/a/23857743

android-framelayout
tag name: android-framelayout
type: Tag
tags question: http://stackoverflow.com/q/23869019

http://stackoverflow.com/a/23898460
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23898427
answers question: http://stackoverflow.com/q/23898427
has body: The problem is here: System.out.println("Average of column 1:" + (myTable [0][0] + myTable [0][1] + myTable [0][2] + myTable [0][3] + myTable [0][4]) / 4 ); You're accessing to myTable[0][4], when myTable is defined as int[5][4]. Fix this and your code will work. System.out.println("Average of column 1:" + (myTable [0][0] + myTable [0][1] + myTable [0][2] + myTable [0][3]) / 4 ); A biggest problem here is your design. You should use a for loop to set the values in your myTable instead of using 20 variables (!). Here's an example: int[][] myTable = new int[5][4]; for (int i = 0; i &lt; myTable.length; i++) { for (int j = 0; j &lt; myTable[i].length; j++) { System.out.println("Type a number:"); myTable[i][j] = Integer.parseInt(mVHS.readLine()); } }
score: 5
has comment: http://stackoverflow.com/comment/36796644

if-statement
tags question: http://stackoverflow.com/q/23828617
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/23781104
tags question: http://stackoverflow.com/q/23874230
tags question: http://stackoverflow.com/q/23877596
tags question: http://stackoverflow.com/q/23911834
tags question: http://stackoverflow.com/q/23820794
tags question: http://stackoverflow.com/q/23782750
tags question: http://stackoverflow.com/q/23836980
tags question: http://stackoverflow.com/q/23802043

http://stackoverflow.com/comment/36807177
has text: This sounds like a badly paraphrased homework questions. VTC
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23903403
score: 0

android-maps-v2
tag name: android-maps-v2
tags question: http://stackoverflow.com/q/23819737
type: Tag

http://stackoverflow.com/comment/36802588
type: AnswerComment
comment on: http://stackoverflow.com/a/23895398
has text: @Peggy, No the validate() is not needed. The ListModel is responsible for notifying the JList when the model is changed and the JList will repaint itself. If you think you need that method then you still have a problem with your program somewhere.
type: Comment
score: 0

http://stackoverflow.com/a/23898474
downvote count: 1
has comment: http://stackoverflow.com/comment/46137334
has comment: http://stackoverflow.com/comment/36796771
type: Answer
has body: Make sure you have setup the correct permission for your DeviceAdminReceiver implementation class and it's checked as App Administrator in Settings <wipe-data /> For more info follow this guide http://developer.android.com/guide/topics/admin/device-admin.html
answers question: http://stackoverflow.com/q/23898406
score: 2
has comment: http://stackoverflow.com/comment/46135835
upvote count: 3
has comment: http://stackoverflow.com/comment/36828573
has comment: http://stackoverflow.com/comment/50095746

activemq-classic
tags question: http://stackoverflow.com/q/23782390
tags question: http://stackoverflow.com/q/23824212
tag name: activemq-classic
type: Tag

http://stackoverflow.com/comment/36583271
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23785252
has text: Was the cast as @ElliottFrisch said.

http://stackoverflow.com/a/25636406
score: 15
answers question: http://stackoverflow.com/q/23936140
has comment: http://stackoverflow.com/comment/40064542
downvote count: 1
type: Answer
has body: According to the doc you pointed: The dataType. See the documentation for the supported datatypes. If the data type is a custom object, set it's name, or nothing. In case of an enum use 'string' and allowableValues for the enum constants. I think you should add the enum values manually: @ApiModel public class Input { @ApiModelProperty(dataType = "string", allowableValues = "Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday", value = "description", notes = "notes") public Day day; }
upvote count: 16

google-app-engine
tag name: google-app-engine
tags question: http://stackoverflow.com/q/23808432
type: Tag
tags question: http://stackoverflow.com/q/23823252
tags question: http://stackoverflow.com/q/23819136
tags question: http://stackoverflow.com/q/23816191
tags question: http://stackoverflow.com/q/23784658
tags question: http://stackoverflow.com/q/23932859
tags question: http://stackoverflow.com/q/23790799
tags question: http://stackoverflow.com/q/23848507
tags question: http://stackoverflow.com/q/23782097
tags question: http://stackoverflow.com/q/23815982
tags question: http://stackoverflow.com/q/23798847
tags question: http://stackoverflow.com/q/23892109
tags question: http://stackoverflow.com/q/23834167
tags question: http://stackoverflow.com/q/23823943
tags question: http://stackoverflow.com/q/23871548
tags question: http://stackoverflow.com/q/23880866
tags question: http://stackoverflow.com/q/23907593
tags question: http://stackoverflow.com/q/23823994
tags question: http://stackoverflow.com/q/23830762
tags question: http://stackoverflow.com/q/23820871
tags question: http://stackoverflow.com/q/23821743
tags question: http://stackoverflow.com/q/23855793
tags question: http://stackoverflow.com/q/23874896
tags question: http://stackoverflow.com/q/23888240
tags question: http://stackoverflow.com/q/23932568
tags question: http://stackoverflow.com/q/23827607
tags question: http://stackoverflow.com/q/23857214
tags question: http://stackoverflow.com/q/23929873
tags question: http://stackoverflow.com/q/23936528
tags question: http://stackoverflow.com/q/23854942
tags question: http://stackoverflow.com/q/23782628
tags question: http://stackoverflow.com/q/23818577
tags question: http://stackoverflow.com/q/23778367
tags question: http://stackoverflow.com/q/23827025
tags question: http://stackoverflow.com/q/23845710
tags question: http://stackoverflow.com/q/23935445
tags question: http://stackoverflow.com/q/23844347

http://stackoverflow.com/comment/36750360
comment on: http://stackoverflow.com/a/23873107
type: Comment
has text: Can't I just create two classes `Connection frame` and `Home frame`, and then just relate them ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23875277
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36751247
tagged with: java
has comment: http://stackoverflow.com/comment/36751311
score: -1
type: Question
tagged with: gridbaglayout
has title: GridBagConstraints.gridheight doesn't work correctly
has answer: http://stackoverflow.com/a/23875314
accepted answer: http://stackoverflow.com/a/23875314
upvote count: 0
has body: I set the layout of my instance of JFrame to new GridBagLayout(). I wanted to add a JTable to my layout, but the gridheight property doesn't seem to work correctly: JFrame frame = new JFrame("GUI Test"); JTable tblTestTable = new JTable(new Object[][] { {"Bar", "Foo"} }, new Object[] { "Foo", "Bar" }); GridBagConstraints c = new GridBagConstraints() {{ anchor = GridBagConstraints.WEST; insets = new Insets(2, 5, 2, 5); weightx = 1; weighty = 1; }}; c.fill = GridBagConstraints.BOTH; c.gridx = 2; c.gridy = 0; c.gridheight = 3; // Doesn't work frame.add(tblTestTable, c); frame.pack(); frame.setVisible(true); This is a small piece of my code. The layout manager renders tblTestTable as a element with just 1 row, even if I set gridheight to 3. I read something about gridheight doesn't working, if gridx is bigger than 0, but I couldn't find a fix for it. Is there already a trick to bypass this?
has comment: http://stackoverflow.com/comment/36751418
answer count: 1
has comment: http://stackoverflow.com/comment/36751158
favorite count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/36751472
downvote count: 1

http://stackoverflow.com/a/23845239
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23845225
has body: no matter what code you are using: Java, Jsp, php, ... it is NEVER a good idea to store an un-altered, unhashed password in a DB for a serious application, if you actually need something more than just the suggestion of security.
downvote count: 0
type: Answer

http://stackoverflow.com/q/23933083
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23933393
tagged with: nio
has comment: http://stackoverflow.com/comment/36861639
answer count: 2
possible better answer: http://stackoverflow.com/a/23933439
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23933439
has body: It seems that there is no method to query a buffer whether it is in read or write state. Getting the state would be useful in unit tests at least. What is the best way to get the state?
has answer: http://stackoverflow.com/a/23933393
type: AnsweredQuestion
has title: Querying java.nio.Buffer read/write (flip) state
upvote count: 2
has comment: http://stackoverflow.com/comment/38248054
downvote count: 1

http://stackoverflow.com/comment/36662083
type: QuestionComment
comment on: http://stackoverflow.com/q/23828530
score: 0
type: Comment
has text: Do you mean like `stringValue.split("\\.")[1]` for example?

http://stackoverflow.com/q/23919927
type: Question
tagged with: jakarta-ee
tagged with: weblogic
has title: Changing an EJB from 2.1 to 3.0
tagged with: ejb
has body: I have an existing Web Application (Servlet) that remotely accesses an EJB currently written to the EJB 2.1 Specification (EJBHome, EJBObject, SessionBean, all configuration in ejb-jar.xml). The servlet access the EJB via JNDI lookup, the JNDI name being specified in weblogic-ejb-jar.xml. I would like to update the EJB to EJB3.0, which will (hopefully) make it easier to add to the API. My issue is that I need to do it with a minimum of change to the existing servlet code. In other words, I still need to: Access the EJB with a simple, global JNDI name (it is stored in a database, and the servlet can can change the name it looks up on the fly), and Be able to use the 2.1 style: String jndiName = getJndiName(); // e.g. "BeanV2.0" BeanHome home = (BeanHome) PortableRemoteObject.narrow( jndiContext.lookup(jndiName), BeanHome.class); BeanRemote remote = home.create(); remote.doBusiness(); // call business method I have tried a stripped down version, applying @RemoteHome, but I keep getting errors during deployment. I am deploying (for development/production) on Weblogic, mostly 10.3.5 (11gR1), and am limited to EJB 3.0. I am using Eclipse (with the Oracle Weblogic Pack) for development. Thanks.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23933640
tagged with: ejb-3.0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36865934
has comment: http://stackoverflow.com/comment/36851646
tagged with: java

http://stackoverflow.com/comment/36651880
type: Comment
score: 1
has text: No, "pointer" is worse and is still wrong for the same reason. Rather, under Call by Value, *reassignments* to [parameter] variables have no effect on the callers bindings. Even under a reassignment, the reference (value) itself is never changed.
comment on: http://stackoverflow.com/a/23822933
type: AnswerComment

http://stackoverflow.com/q/23797852
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: monitor
accepted answer: http://stackoverflow.com/a/23797907
tagged with: interrupted-exception
upvote count: 3
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37088670
answer count: 1
tagged with: try-catch
has title: If a thread gets interrupted on wait(), will the monitor be re-acquired before reaching the catch block outside of the synchronization block?
has body: Please consider the following code: try{ synchronized(myLock){ myLock.wait(); // gets interrupted while waiting. } }catch(InterruptedException ie){ } If a thread gets interrupted while blocked on wait(), will the monitor of myLock be re-acquired (temporarily?) before ended up in the catch block?
has comment: http://stackoverflow.com/comment/36604296
has answer: http://stackoverflow.com/a/23797907

http://stackoverflow.com/q/23925951
linked to: http://stackoverflow.com/q/9824053
tagged with: arraylist
has body: In a program I was working on, I ran into a data storage issue, specifically related to ArrayLists. This is not the actual code I was testing, but it provides an example of what I mean. public class test { public static void test() { ArrayList&lt;Integer&gt; bob = new ArrayList&lt;Integer&gt;(); bob.add(129); bob.add(129); System.out.println(bob.get(0) == 129 ); System.out.println(bob.get(1) == 129 ); System.out.println(bob.get(0) == bob.get(1) ); } } If you run it, you get, true, true, and false. The code recognizes that both are equal to 129 but for some reason returns false when it attempts to see if they are equal to each other. However, if you change the value to 127, it returns true, true, and true. Testing this multiple times for different values and you will see that the minimum value to receive true, true, and true is -128 and the maximum is 127. This is the interval for byte, which leads me to suspect that the == operation uses byte in this case. What is interesting is that if you modify the code so that it reads public class test { public static void test() { ArrayList&lt;Integer&gt; bob = new ArrayList&lt;Integer&gt;(); bob.add(129); bob.add(129); int a = bob.get(0); int b = bob.get(1); System.out.println(a == 129 ); System.out.println(b == 129 ); System.out.println(a == b ); } } it works just as intended. true, true, and true are outputted. Why does saving the values as int before the comparison change the outcome? Is it because if they are not saved, the comparison will use byte by default for the == comparison?
tagged with: byte
has title: Does == comparison use byte in ArrayList comparisons?
duplicate of: http://stackoverflow.com/q/9824053
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/23926096
has answer: http://stackoverflow.com/a/23926274
tagged with: integer
tagged with: equals
possible better answer: http://stackoverflow.com/a/23926080
score: 6
has answer: http://stackoverflow.com/a/23926080
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36848485
has answer: http://stackoverflow.com/a/23926151
type: Question
has answer: http://stackoverflow.com/a/23926149
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/23926074
accepted answer: http://stackoverflow.com/a/23926151

http://stackoverflow.com/q/23788738
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/29416180
type: Question
tagged with: pageobjects
accepted answer: http://stackoverflow.com/a/29416180
score: 0
answer count: 2
has body: I have an link in HTML and I use Page Object pattern to write scripts with Selenium Webdriver. But my link is hidden and I can't perform MouseMove action when object is initialized with pageFactory. Here is my class: public class DashboardPage { WebDriver driver; @FindBy(xpath = Constants.admin) public WebElement adminButton; @FindBy(xpath = Constants.usersAndRoles) public WebElement usersAndRolesButton; @FindBy(xpath = Constants.users) public WebElement usersButton; public DashboardPage (WebDriver dr){ driver =dr; } public UsersPage goToUsersPage(){ adminButton.click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); Actions builder = new Actions(driver); builder.moveToElement(usersAndRolesButton).build().perform(); //usersAndRolesButton.click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); usersButton.click(); return PageFactory.initElements(driver, UsersPage.class); }
possible better answer: http://stackoverflow.com/a/23797956
has answer: http://stackoverflow.com/a/23797956
has comment: http://stackoverflow.com/comment/36590633
has title: How can i perform mouse move using Selenium WebDriver for Java and PageFactory
tagged with: selenium-webdriver

http://stackoverflow.com/comment/36870557
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23937759
has text: Thanks a lot Andrew! It works and now i understand the error. Many thanks!
score: 0

http://stackoverflow.com/a/23924755
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23924693
has comment: http://stackoverflow.com/comment/36849515
has body: Your code won't even compile... You're numClicks is defined as a local variable within the paint method... public void paint(Graphics g) { this.setSize(1010, 360); long numClicks = 0; //&lt;--Long in question //... Then you try and access some undefined variable called numClicks in your mouseClicked method... public void mouseClicked(MouseEvent e) { if ((e.getX() &lt; 50 &amp;&amp; e.getX() &gt; 250) &amp;&amp; (e.getY() &lt; 50 &amp;&amp; e.getY() &gt; 250)) { numClicks++; //&lt;-- this doesn't increase, why? } } Start by declaring numClicks as an instance variable... public class Main extends Applet implements MouseListener { private long numClicks = 0; public void paint(Graphics g) { And then remove the local decleation from paint public void paint(Graphics g) { this.setSize(1010, 360); //long numClicks = 0; //&lt;--Long in question You mouse coordinates are impossible to be true... if ((e.getX() &lt; 50 &amp;&amp; e.getX() &gt; 250) &amp;&amp; (e.getY() &lt; 50 &amp;&amp; e.getY() &gt; 250)) { x/y can't be less the 50 and greater the 250 at the same time... You might also want to register the Applet to receive mouse events... public void init() { super.init(); addMouseListener(this); } On a side note... You should be calling super.paint before performing custom painting....but then I'd question the reason behind Applet over JApplet, but that's me... Updated with working example import java.applet.Applet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class Main extends Applet implements MouseListener { private long numClicks; @Override public void init() { super.init(); addMouseListener(this); } @Override public void paint(Graphics g) { this.setSize(1010, 360); int autoFingerNum = 0; int faultyButtonNum = 0; int slickButtonNum = 0; int coolButtonNum = 0; int heatSinkNum = 0; int superButtonNum = 0; g.setColor(Color.cyan); g.fillRect(0, 0, 1010, 360); g.setColor(…
downvote count: 0
has comment: http://stackoverflow.com/comment/36847011
has comment: http://stackoverflow.com/comment/36847084
type: Answer
has comment: http://stackoverflow.com/comment/36847540

http://stackoverflow.com/a/23886357
has comment: http://stackoverflow.com/comment/36772675
accepted answer of: http://stackoverflow.com/q/23886299
type: AcceptedAnswer
has body: Pseudocode is String existing = Read whole content of file. String newcontent = "Blah Blah This is first line" + existing f.write(newcontent);
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23886299
upvote count: 2

http://stackoverflow.com/a/23894509
accepted answer of: http://stackoverflow.com/q/23858208
has comment: http://stackoverflow.com/comment/36795895
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/36798723
upvote count: 1
has body: You can use a list value for this: Value.Builder listValueBuilder = Value.newBuilder(); for (String value : values) { listValueBuilder.addListValue(Value.newBuilder().setStringValue(value)); } entityBuilder.addProperty(Property.newBuilder() .setName(name) .setValue(listValueBuilder)); Or, using the convenience methods from DatastoreHelper: Value.Builder[] valueArray = new Value.Builder[values.length]; for (int i = 0; i &lt; values.length; i++) { valueArray[i] = DatastoreHelper.makeValue(values[i]); } entityBuilder.addProperty( DatastoreHelper.makeProperty(name, DatastoreHelper.makeValue(valueArray))); and to retrieve the values: for (Property property : entity.getPropertyList()) { // Find the list property by name. if (property.getName().equals(name)) { for (Value value : property.getValue().getListValueList()) { // Print each string value from the list value. System.out.println(value.getStringValue()); } } } or, using DatastoreHelper again: Map&lt;String, Value&gt; propertyMap = DatastoreHelper.getPropertyMap(entity); for (Value value : propertyMap.get(name).getListValueList()) { // Print each string value from the list value. System.out.println(value.getStringValue()); }
has comment: http://stackoverflow.com/comment/36800816
answers question: http://stackoverflow.com/q/23858208

http://stackoverflow.com/q/23850407
has comment: http://stackoverflow.com/comment/36739774
tagged with: java
has comment: http://stackoverflow.com/comment/36724490
has title: Why does Java CPU profile (using visualvm) show so many hits on a method that does nothing?
score: 6
has comment: http://stackoverflow.com/comment/36735315
has answer: http://stackoverflow.com/a/23850454
linked to: http://stackoverflow.com/q/375913
upvote count: 7
downvote count: 1
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/23874078
has comment: http://stackoverflow.com/comment/36740860
has body: This is something I think I've seen before with other profiling tools in other environments, but it's particularly dramatic in this case. I'm taking a CPU profile of a task that runs for about 12 minutes, and it's showing almost half the time spent in a method that literally does nothing: it's got an empty body. What can cause this? I don't believe that the method is being called a ridiculous number of times, certainly not to account for half the execution time. For what it's worth, the method in question is called startContent() and it's used to notify a parsing event. The event is passed down a chain of filters (perhaps a dozen of them), and the startContent() method on each filter does almost nothing except to call startContent() on the next filter in the chain. This is pure Java code, and I'm running it on a Mac. Attached is a screen shot of the CPU sampler output: and here is a sample showing the call stack: (After a delay due to vacation) Here are a couple of pictures showing the output from the profiler. These figures are much more what I would expect the profile to look like. The profiler output seems entirely meaningful, while the sampler output is spurious. As some of you will have guessed, the job in question is a run of the Saxon XML schema validator (on a 9Gb input file). The profile shows about half the time being spent validating element content against simple types (which happens during endElement processing) and about half being spent testing key constraints for uniqueness; the two profiler views show highlight the activity involved in these two aspects of the task. I'm not able to supply the data as it comes from a client.
has comment: http://stackoverflow.com/comment/36735025
has comment: http://stackoverflow.com/comment/36714178
has comment: http://stackoverflow.com/comment/36724519
has comment: http://stackoverflow.com/comment/36724806
has answer: http://stackoverflow.com/a/23967677
linked to: http://stackoverflow.com/q/1777556
favorite count: 0
linked to: http://stackoverflow.com/q/926266
tagged with: visualvm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36704741
has comment: http://stackoverflow.com/comment/36704705
answer count: 4
has comment: http://stackoverflow.com/comment/36738321
has comment: http://stackoverflow.com/comment/36738615
has answer: http://stackoverflow.com/a/23872048

http://stackoverflow.com/comment/36800634
has text: @Squonk - Should it work if I'm using the Async Class when splitting my Json after receiving? "private class myMethod extends AsyncTask<Void, Void, Void>"
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23882552
type: Comment

http://stackoverflow.com/q/23922387
has comment: http://stackoverflow.com/comment/36842274
has comment: http://stackoverflow.com/comment/36842225
has comment: http://stackoverflow.com/comment/36841798
has comment: http://stackoverflow.com/comment/36841765
has comment: http://stackoverflow.com/comment/36841961
has comment: http://stackoverflow.com/comment/36842415
has comment: http://stackoverflow.com/comment/36841804
has comment: http://stackoverflow.com/comment/36842005
linked to: http://stackoverflow.com/q/3542051
answer count: 0
has comment: http://stackoverflow.com/comment/36841843
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36841820
tagged with: java
has comment: http://stackoverflow.com/comment/36842737
type: Question
has body: I'm taking this oracle java tutorial and trying to use this code in Eclipse. I've been able to just create new classes and copy the code into the class. I can't seem to use this code in Eclipse. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/examples/StringSwitchDemo.java I keep getting Class not found errors. I named the class correctly. Here's a screenshot. https://i.sstatic.net/r58wX.jpg I don't understand what I need to change to allow the code to run. public class StringSwitchDemo { public static int getMonthNumber(String month) { int monthNumber = 0; if (month == null) { return monthNumber; } switch (month.toLowerCase()) { case "january": monthNumber = 1; break; case "february": monthNumber = 2; break; case "march": monthNumber = 3; break; case "april": monthNumber = 4; break; case "may": monthNumber = 5; break; case "june": monthNumber = 6; break; case "july": monthNumber = 7; break; case "august": monthNumber = 8; break; case "september": monthNumber = 9; break; case "october": monthNumber = 10; break; case "november": monthNumber = 11; break; case "december": monthNumber = 12; break; default: monthNumber = 0; break; } return monthNumber; } public static void main(String[] args) { String month = "August"; int returnedMonthNumber = StringSwitchDemo.getMonthNumber(month); if (returnedMonthNumber == 0) { System.out.println("Invalid month"); } else { System.out.println(returnedMonthNumber); } } } I got this errors in my IDE (Eclipse)
has comment: http://stackoverflow.com/comment/36841866
has comment: http://stackoverflow.com/comment/36842323
has comment: http://stackoverflow.com/comment/36842041
has comment: http://stackoverflow.com/comment/36841836
has comment: http://stackoverflow.com/comment/36841995
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36842088
has comment: http://stackoverflow.com/comment/36841980
score: 0
has comment: http://stackoverflow.com/comment/36841889
has comment: http://stackoverflow.com/comment/36842034
has comment: http://stackoverflow.com/comment/36841840
tagged with: classnotfoundexception
duplicate of: http://stackoverflow.com/q/3542051
has comment: http://stackoverflow.com/comment/36841812
has comment: http://stackoverflow.com/comment/36842862
has comment: http://stackoverflow.com/comment/36846081
has title: java.lang.ClassNotFoundException error - Oracle Java tutorial
has comment: http://stackoverflow.com/comment/36841972
has comment: http://stackoverflow.com/comment/36841871

http://stackoverflow.com/a/23790485
accepted answer of: http://stackoverflow.com/q/23790423
has body: StringBuilder/Buffer do not override hashCode and equals. This means each instance of the object should be a unique hash code and the value or state of it does not matter. You should use the String for a key. StringBuilder/Buffer is also mutable which is generally not a good idea to use as a key for a HashMap since storing the value under it can cause the value to be inaccessible after modification. http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/StringBuilder.java
answers question: http://stackoverflow.com/q/23790423
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/36636276
type: QuestionComment
type: Comment
has text: Seems like a good candidate for a new issue in [plugin's jira](http://jira.codehaus.org/browse/MANIMALSNIFFER).
comment on: http://stackoverflow.com/q/23814482
score: 0

http://stackoverflow.com/q/23916855
has comment: http://stackoverflow.com/comment/36831946
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23916931
has body: Title says it all, before anyone says that there is a thread about closing a GUI without the program end then hold on a second. My question is that, how can the PROGRAM close a GUI and not the user so it can progress onto another frame.
has title: How Can A Program Close A GUI Without The Program Ending
has comment: http://stackoverflow.com/comment/36831025
score: -1
has answer: http://stackoverflow.com/a/23917129
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/8632705
has comment: http://stackoverflow.com/comment/36831184
favorite count: 0
possible better answer: http://stackoverflow.com/a/23917129
has comment: http://stackoverflow.com/comment/36831112
has comment: http://stackoverflow.com/comment/36831276
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23916931
tagged with: java

http://stackoverflow.com/comment/36867122
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23936165
score: 4
has text: Read more about Java I/O to learn how to create/search/read files on the File System and Java Swing (jTable) to learn how to manipulate the GUI. Sorry but we can't just give you the code, there's no fun in that, right? Here's a good place to start: http://docs.oracle.com/javase/tutorial/essential/io/

http://stackoverflow.com/comment/36643519
comment on: http://stackoverflow.com/a/23818467
has text: It takes talent to make a mistake here. In your solution you return null if the integer is larger than the number of LETTERS not words.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36595568
score: 0
type: Comment
type: QuestionComment
has text: Well, the new code won't work if the `__MACOSX` directory contains any non-empty directories. You should confirm what really is the content of that directory by some other means than trying to blindly remove it after it has been copied on a mobile device's storage.
comment on: http://stackoverflow.com/q/23792881

http://stackoverflow.com/q/23783165
has answer: http://stackoverflow.com/a/23783836
type: AnsweredQuestion
upvote count: 1
tagged with: fileutils
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36577501
has answer: http://stackoverflow.com/a/23783319
tagged with: character-encoding
linked to: http://stackoverflow.com/q/6002256
has comment: http://stackoverflow.com/comment/36576582
answer count: 2
has comment: http://stackoverflow.com/comment/36577714
has title: ö character encoding issue in CSV file creation
downvote count: 0
favorite count: 0
has body: I am trying to create a CSV file from my Java code. File file = File.createTempFile("DummyReport", ".csv"); SomeListofObjects items = getSomeList(); FileUtils.write(file, "ID;CREATION;" + System.lineSeparator()); FileUtils.writeLines(file, activities.getItems(), true); return file; I am facing some issue with special chars. When I debug the code, I found that I have a character as "ö". But in the csv file generated, it is coming weirdly "Ã¶". Can we set this in FileUtile or File? Can some one help me to solve this?
has comment: http://stackoverflow.com/comment/36577639
accepted answer: http://stackoverflow.com/a/23783319
possible better answer: http://stackoverflow.com/a/23783836
tagged with: apache-commons-io

http://stackoverflow.com/a/23844333
type: Answer
has comment: http://stackoverflow.com/comment/36729403
has comment: http://stackoverflow.com/comment/36692880
score: 0
has comment: http://stackoverflow.com/comment/36695514
has comment: http://stackoverflow.com/comment/36692772
answers question: http://stackoverflow.com/q/23843963
has body: There is an extra space in the keyname used in onResume. You are using "scoinCount " instead on "scoinCount". Modify on resume as @Override public void onResume() { super.onResume(); scoinCount = (long) prefs.getFloat("scoinCount", 1.0f); scoinLong = (long) prefs.getFloat("scoinLong", 0.0f); } Try to store the keyname in a string variable and use it everywhere. That will about bugs like this.

http://stackoverflow.com/q/23839915
favorite count: 0
has title: Java 'finally' exception throwing rules
tagged with: exception
has body: Lets say I have a class that has two OutputStream members: public class A { OutputStream os1 = ... OutputStream os2 = ... ... } Now, in this class, I have a cleanup() method which must at least attempt to close both streams: public void cleanup() throws IOException { try { os1.close(); } finally { os2.close(); } } Now, I'm confident that the above code will try to close both streams, but what is interesting is what happens when both calls to close() throw an IOException. I want to say that the exception from os2 will propogate upward, but perhaps the behavior is undefined. I've done some googling but I'm not finding anything that answers this question well.
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23840002
upvote count: 1
has comment: http://stackoverflow.com/comment/98859231
downvote count: 1
has answer: http://stackoverflow.com/a/23839949
type: Question
has answer: http://stackoverflow.com/a/23839946
tagged with: try-catch-finally
linked to: http://stackoverflow.com/q/56112598
answer count: 3
possible better answer: http://stackoverflow.com/a/23839946
accepted answer: http://stackoverflow.com/a/23839949

http://stackoverflow.com/comment/36650410
has text: Yes I am currently trying to do this in java, I want to append a new attribute in HTML body tag, I don't want it in CSS.
comment on: http://stackoverflow.com/q/23822079
score: 0
type: Comment
type: QuestionComment